Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
159 lines (146 loc) · 5.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
159 lines (146 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
services:
# ── Core stack ─────────────────────────────────────────────────────────────
# tcp-camera-backend, camera-web-api, and ffmpeg-streamer all bind the same
# unix socket via the shared "ipc" volume at /tmp/instachron/frames.sock.
tcp-camera-backend:
build:
context: .
dockerfile: services/tcp-camera-backend/Dockerfile
ports:
- "${TCP_PORT:-5000}:5000"
volumes:
- ipc:/tmp/instachron
environment:
TCP_ADDR: "0.0.0.0:5000"
IPC_SOCKET_PATH: /tmp/instachron/frames.sock
restart: unless-stopped
camera-web-api:
build:
context: .
dockerfile: services/camera-web-api/Dockerfile
ports:
- "${API_PORT:-8080}:8080"
volumes:
- ipc:/tmp/instachron
# Uncomment to override the default cameras.json rotation config:
# - ./services/camera-web-api/cameras.json:/app/cameras.json:ro
environment:
HTTP_ADDR: ":8080"
IPC_SOCKET_PATH: /tmp/instachron/frames.sock
TCP_ADDR: ":9001"
TCP_ENABLED: "true"
depends_on:
- tcp-camera-backend
restart: unless-stopped
# ── Restream layer ──────────────────────────────────────────────────────────
camera-web-restreamer-api:
build:
context: .
dockerfile: services/camera-web-restreamer-api/Dockerfile
ports:
- "${RESTREAMER_PORT:-8090}:8090"
environment:
HTTP_ADDR: ":8090"
UPSTREAM_TCP_ADDR: "camera-web-api:9001"
TCP_ADDR: ":9002"
depends_on:
- camera-web-api
restart: unless-stopped
camera-web-restream-enhancer-api:
build:
context: .
dockerfile: services/camera-web-restream-enhancer-api/Dockerfile
ports:
- "${ENHANCER_PORT:-8091}:8091"
environment:
HTTP_ADDR: ":8091"
UPSTREAM_TCP_ADDR: "camera-web-api:9001"
TCP_ADDR: ":9003"
JPEG_QUALITY: "${JPEG_QUALITY:-85}"
depends_on:
- camera-web-api
restart: unless-stopped
# ── Optional: Lanczos upscale restream transform ───────────────────────────
# Activate with: docker compose --profile upscaler up
camera-web-restream-upscaler-api:
build:
context: .
dockerfile: services/camera-web-restream-upscaler-api/Dockerfile
ports:
- "${UPSCALER_PORT:-8092}:8092"
environment:
HTTP_ADDR: ":8092"
UPSTREAM_TCP_ADDR: "camera-web-api:9001"
TCP_ADDR: ":9004"
JPEG_QUALITY: "${UPSCALER_JPEG_QUALITY:-85}"
NUM_WORKERS: "${UPSCALER_WORKERS:-}"
UPSCALE_FACTOR: "${UPSCALE_FACTOR:-2}"
QUEUE_MULTIPLIER: "${QUEUE_MULTIPLIER:-1}"
MAX_INPUT_WIDTH: "${MAX_INPUT_WIDTH:-640}"
MAX_INPUT_HEIGHT: "${MAX_INPUT_HEIGHT:-360}"
METRICS_INTERVAL_SEC: "${METRICS_INTERVAL_SEC:-60}"
depends_on:
- camera-web-api
profiles:
- upscaler
restart: unless-stopped
# ── Optional: ffmpeg RTMP streamer ──────────────────────────────────────────
# Requires a stream destination. Set exactly one of:
# TWITCH_STREAM_KEY, YOUTUBE_STREAM_KEY, STREAM_URL, or RTMP_URL
# Activate with: docker compose --profile streaming up
ffmpeg-streamer:
build:
context: .
dockerfile: services/ffmpeg-streamer/Dockerfile
volumes:
- ipc:/tmp/instachron
environment:
IPC_SOCKET_PATH: /tmp/instachron/frames.sock
STREAM_URL: "${STREAM_URL:-}"
RTMP_URL: "${RTMP_URL:-}"
TWITCH_STREAM_KEY: "${TWITCH_STREAM_KEY:-}"
YOUTUBE_STREAM_KEY: "${YOUTUBE_STREAM_KEY:-}"
CAMERA_ID: "${CAMERA_ID:-0}"
MERGE_ALL: "${MERGE_ALL:-false}"
FFMPEG_PATH: "${FFMPEG_PATH:-ffmpeg}"
STREAM_FRAME_RATE: "${STREAM_FRAME_RATE:-10}"
FFMPEG_RESTART_DELAY: "${FFMPEG_RESTART_DELAY:-5s}"
CELL_WIDTH: "${CELL_WIDTH:-320}"
CELL_HEIGHT: "${CELL_HEIGHT:-240}"
depends_on:
- tcp-camera-backend
profiles:
- streaming
restart: unless-stopped
# ── Optional: H.264 timelapse recording ────────────────────────────────────
# Activate with: docker compose --profile recording up
camera-recorder:
build:
context: .
dockerfile: services/camera-recorder/Dockerfile
ports:
- "${RECORDER_PORT:-8094}:8094"
volumes:
- recordings:/recordings
environment:
HTTP_ADDR: ":8094"
UPSTREAM_TCP_ADDR: "camera-web-api:9001"
STORAGE_ROOT_DIR: /recordings
OUTPUT_FPS: "${RECORDER_OUTPUT_FPS:-10}"
TIMELAPSE_FACTOR: "${TIMELAPSE_FACTOR:-10}"
SEGMENT_RAW_DURATION: "${SEGMENT_RAW_DURATION:-10m}"
MAX_FILE_BYTES: "${RECORDER_MAX_FILE_BYTES:-104857600}"
KEEP_FILES_PER_CAMERA: "${KEEP_FILES_PER_CAMERA:-144}"
QUEUE_SIZE_PER_CAMERA: "${RECORDER_QUEUE_SIZE:-128}"
FFMPEG_PRESET: "${RECORDER_FFMPEG_PRESET:-veryfast}"
FFMPEG_CRF: "${RECORDER_FFMPEG_CRF:-23}"
depends_on:
- camera-web-api
profiles:
- recording
restart: unless-stopped
volumes:
# Shared unix socket directory for tcp-camera-backend, camera-web-api,
# and ffmpeg-streamer. The socket file lives at /tmp/instachron/frames.sock.
ipc:
recordings: