CD — Kai-Sa-Cam Deployment / deploy (push) Successful in 10s
The app returned 401 on every request because jwtVerify could not fetch the Cloudflare Access signing keys (getaddrinfo EAI_AGAIN): kai-sa-cam was only attached to internal networks (kai-sa-cam-internal and the external kai-sa-cam-tunnel, which has Internal=true), so it had no DNS or route to the Internet. Network - add a dedicated kai-sa-cam-egress bridge network, attached to kai-sa-cam only - kai-sa-go2rtc stays on kai-sa-cam-internal only (no published ports, no outbound access); the video stream remains reachable solely through the authenticated /go2rtc proxy Auth (index.ts) - log the reason when an Access JWT is rejected instead of silently returning 401 - fail closed: exit at startup when CF_ACCESS_TEAM_DOMAIN or CF_ACCESS_AUD is missing, unless ALLOW_NO_AUTH=1 Media (media.ts) - replace inline require() calls with ESM imports (resolve, mkdirSync) - resolve the path first, then check it against MEDIA_DIR + path.sep (previous check ran after existsSync and accepted sibling prefixes) - on export, delete files only on the response "finish" event, not when the archive is finalized, so an interrupted download no longer loses media - snapshots: stop calling reject() after the response was sent, which caused unhandled rejections Recorder (recorder.ts) - enforce DISK_MIN_FREE_GB with statfsSync (was a stub returning true) - track the recording in a single state object and wait on an exit promise instead of polling; make cleanup idempotent - return 502 when ffmpeg exits right after start - recover orphaned .part files at startup - return file names instead of full paths from /start, /stop and /status
78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
name: kai-sa-cam
|
|
|
|
services:
|
|
kai-sa-go2rtc:
|
|
image: alexxit/go2rtc:1.9.9
|
|
container_name: kai-sa-go2rtc
|
|
profiles: ["dev", "prod"]
|
|
restart: unless-stopped
|
|
environment:
|
|
- PULSE_SERVER=unix:/run/user/1001/pulse/native
|
|
devices:
|
|
- /dev/video0:/dev/video0
|
|
- /dev/snd:/dev/snd
|
|
volumes:
|
|
- ./config/kai-sa-go2rtc.yaml:/config/go2rtc.yaml:ro
|
|
- /run/user/1001/pulse/native:/run/user/1001/pulse/native
|
|
- /home/esiahdmin/.config/pulse/cookie:/root/.config/pulse/cookie:ro
|
|
networks:
|
|
- kai-sa-cam-internal
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
|
|
kai-sa-cam:
|
|
build:
|
|
context: ./apps/kai-sa-cam
|
|
dockerfile: Dockerfile
|
|
container_name: kai-sa-cam
|
|
profiles: ["dev", "prod"]
|
|
restart: unless-stopped
|
|
user: "1001:1001"
|
|
environment:
|
|
- TZ=${TZ:-Europe/Paris}
|
|
- USER_ID=${USER_ID:-1000}
|
|
- GROUP_ID=${GROUP_ID:-1000}
|
|
- APP_ORIGIN=${APP_ORIGIN:-https://kaisa.esiah.dev}
|
|
- MEDIA_DIR=/media
|
|
- CONFIG_DIR=/config
|
|
- LOG_LEVEL=${LOG_LEVEL:-info}
|
|
- MAX_RECORDING_MINUTES=${MAX_RECORDING_MINUTES:-120}
|
|
- DISK_MIN_FREE_GB=${DISK_MIN_FREE_GB:-2}
|
|
- GO2RTC_URL=http://kai-sa-go2rtc:1984
|
|
- GO2RTC_RTSP_URL=rtsp://kai-sa-go2rtc:8554/webcam
|
|
- PULSE_SERVER=${PULSE_SERVER}
|
|
- XDG_RUNTIME_DIR=/run/user/1001
|
|
- CF_ACCESS_TEAM_DOMAIN=${CF_ACCESS_TEAM_DOMAIN:-}
|
|
- CF_ACCESS_AUD=${CF_ACCESS_AUD:-}
|
|
volumes:
|
|
- ./media:/media
|
|
- ./config:/config
|
|
- /run/user/1001/pulse/native:/run/user/1001/pulse/native
|
|
- /home/esiahdmin/.config/pulse/cookie:/home/1001/.config/pulse/cookie:ro
|
|
networks:
|
|
- kai-sa-cam-internal
|
|
- kai-sa-cam-tunnel
|
|
- kai-sa-cam-egress
|
|
cap_drop:
|
|
- ALL
|
|
security_opt:
|
|
- no-new-privileges:true
|
|
read_only: true
|
|
tmpfs:
|
|
- /tmp
|
|
- /var/cache
|
|
init: true
|
|
|
|
networks:
|
|
kai-sa-cam-internal:
|
|
internal: true
|
|
kai-sa-cam-tunnel:
|
|
external: true
|
|
name: kai-sa-cam-tunnel
|
|
kai-sa-cam-egress: {}
|