Commit graph

10 commits

Author SHA1 Message Date
senke
bf24a5e3ce feat(infra): add coturn service + wire WEBRTC_TURN_* envs in compose
WebRTC 1:1 calls were silently broken behind symmetric NAT (corporate
firewalls, mobile CGNAT, Incus default networking) because no TURN
relay was deployed. The /api/v1/config/webrtc endpoint and the
useWebRTC frontend hook were both wired correctly from v1.0.9 Day 1,
but with no TURN box on the network the handler returned STUN-only
and the SPA's `nat.hasTurn` flag stayed false.

Added :
  * docker-compose.prod.yml: new `coturn` service using the official
    coturn/coturn:4.6.2 image, network_mode: host (UDP relay range
    49152-65535 doesn't survive Docker NAT), config passed entirely
    via CLI args so no template render is needed. TLS cert volume
    points at /etc/letsencrypt/live/turn.veza.fr by default; override
    with TURN_CERT_DIR for non-LE setups. Healthcheck uses nc -uz to
    catch crashed/unbound listeners.
  * Both backend services (blue + green): WEBRTC_STUN_URLS,
    WEBRTC_TURN_URLS, WEBRTC_TURN_USERNAME, WEBRTC_TURN_CREDENTIAL
    pulled from env with `:?` strict-fail markers so a misconfigured
    deploy crashes loudly instead of degrading silently to STUN-only.
  * docker-compose.staging.yml: same 4 env vars but with safe fallback
    defaults (Google STUN, no TURN) so staging boots without a coturn
    box. Operators can flip to relay by setting the envs externally.

Operator must set the following secrets at deploy time :
  WEBRTC_TURN_PUBLIC_IP   the host's public IP (used both by coturn
                          --external-ip and by the backend STUN/TURN
                          URLs the SPA receives)
  WEBRTC_TURN_USERNAME    static long-term credential username
  WEBRTC_TURN_CREDENTIAL  static long-term credential password
  WEBRTC_TURN_REALM       optional, defaults to turn.veza.fr

Smoke test : turnutils_uclient -u $USER -w $CRED -p 3478 $PUBLIC_IP
should return a relay allocation within ~1s. From the SPA, watch
chrome://webrtc-internals during a call and confirm the selected
candidate pair is `relay` when both peers are on symmetric NAT.

The Ansible role under infra/coturn/ is the canonical Incus-native
deploy path documented in infra/coturn/README.md; this compose
service is the simpler single-host option that unblocks calls today.
v1.1 will switch from static to ephemeral REST-shared-secret
credentials per ORIGIN_SECURITY_FRAMEWORK.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 15:44:12 +02:00
senke
6a54268476 fix(infra): wire AWS_S3_ENABLED + TRACK_STORAGE_BACKEND in prod/staging compose
The prod and staging compose files were passing AWS_S3_ENDPOINT,
AWS_S3_BUCKET, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY but NOT
the two flags that actually activate the routing:
  - AWS_S3_ENABLED      (default false in code → S3 stack skipped)
  - TRACK_STORAGE_BACKEND  (default "local" in code → uploads to disk)

So both prod and staging deploys were silently writing track uploads
to local disk despite the apparent S3 wiring. With blue/green
active/active behind HAProxy, that's an HA bug — uploads on the blue
pod aren't visible to green and vice-versa.

Set both flags in:
  - docker-compose.staging.yml backend service (1 instance)
  - docker-compose.prod.yml backend_blue + backend_green (2 instances,
    same env block via replace_all)

The code already validates on startup that TRACK_STORAGE_BACKEND=s3
requires AWS_S3_ENABLED=true (config.go:1040-1042) so a partial
config now fails-loud instead of falling back to local.

The S3StorageService is already implemented (services/s3_storage_service.go)
and wired into TrackService.UploadTrack via the storageBackend dispatcher
(core/track/service.go:432). HLS segment output remains on the
hls_*_data volume — that's a separate concern (stream server local
write), out of scope for this compose-only fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 15:39:30 +02:00
senke
4310dbb734 chore(docker): pin MinIO + mc to dated release tags
MinIO images were pinned to `:latest` in 4 compose files — supply-
chain risk (auto-updates on every `docker compose pull`, bit-rot if
upstream changes behavior). Pin to dated RELEASE.* tags documented
by MinIO (conservative Sep 2025 release).

Changed:
  docker-compose.yml           ×2 (minio + mc)
  docker-compose.dev.yml       ×2
  docker-compose.prod.yml      ×2
  docker-compose.staging.yml   ×2

Tags:
  minio/minio:RELEASE.2025-09-07T16-13-09Z
  minio/mc:RELEASE.2025-09-07T05-25-40Z

Operator should bump to latest verified release when they next
revisit infra. Tag chosen conservatively — if it does not exist in
local Docker cache, `docker compose pull` will surface the error
immediately (safer than silent drift).

Refs: AUDIT_REPORT.md §6.1 Dette 1 (MinIO :latest 4 occurrences).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 20:32:01 +02:00
senke
4464f98194 chore(release): v0.981 — Beta (staging deploy, bug bash, smoke test)
Some checks failed
Stream Server CI / test (push) Failing after 0s
2026-03-02 19:33:42 +01:00
senke
218b4b33d6 feat(streaming): wire HLS pipeline end-to-end with serving routes
- Add HLSEnabled and HLSStorageDir to backend config (HLS_STREAMING env)
- Register HLS serving routes (master.m3u8, quality playlist, segments)
  behind HLSEnabled feature flag on existing track routes
- Add GetHLSStatus and TriggerHLSTranscode methods to StreamService
  for stream server communication
- Update docker-compose (dev, staging, prod) with HLS env vars and
  shared hls-data volume between backend and stream-server
- Stream callback already correctly updates stream_manifest_url
2026-02-22 21:20:35 +01:00
senke
1fb80d6c2f feat(chat): Sprint 4 -- Docker cleanup, frontend migration to Go WS
- Remove Rust chat-server from docker-compose.yml, staging.yml, prod.yml
- Remove VITE_WS_URL from docker frontend env vars (auto-derived from API_URL)
- Update env.ts: derive WS_URL from API_URL (/api/v1/ws) when not explicitly set
- Remove 127.0.0.1:8081 dev hack from useChat.ts
- Add missing types: EditMessage, DeleteMessage, FetchHistory, SearchMessages,
  SyncMessages, MessageEdited, MessageDeleted, SearchResults, SyncChunk
- Update MSW chat/token handler to return ws_url: /api/v1/ws
- Update .env.example and .env.storybook
2026-02-22 20:46:58 +01:00
senke
89cc015e54 feat(v0.501): Sprint 1 -- infrastructure foundations
- Add MinIO S3-compatible storage to docker-compose (dev, staging, prod)
- Create migrations 103-108 (waveform_url, user_folders, user_files,
  user_storage_quotas, gear_items.is_public, gear_images)
- Add Go models: UserFile, UserFolder, StorageQuota, GearImage
- Add WaveformURL to Track model, IsPublic + GearImages to GearItem model
2026-02-22 18:10:25 +01:00
senke
3e0e1b5286 feat(infra): complete staging compose with chat, stream, and reverse proxy
INF-07: Added chat-server, stream-server, Caddy reverse proxy,
and healthchecks for all services in staging compose.
2026-02-22 17:36:03 +01:00
senke
8fa866baaa fix(security): harden docker-compose.prod.yml and staging -- sslmode, secrets
Production (docker-compose.prod.yml):
- Change sslmode=disable to sslmode=require on all 3 DATABASE_URLs
- Replace JWT_SECRET fallback defaults with :? syntax (fails if unset)
- Replace DB_PASS default 'password' with :? syntax (fails if unset)
- Separate RABBITMQ_PASS from DB_PASS, require explicit setting

Staging (docker-compose.staging.yml):
- Add sslmode=require to DATABASE_URL
- Replace all default passwords with :? syntax (fails if unset)

docker-compose up with these files will now FAIL if required secrets
are not explicitly provided via environment variables.

Addresses audit findings: A02 (Cryptographic Failures), section 7 (Infra).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-11 22:43:09 +01:00
senke
8efbb97e6f stabilisation commit A 2026-01-07 19:39:21 +01:00