Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
129 lines (119 loc) · 4.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
129 lines (119 loc) · 4.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
# The database lives on the postgres-data volume. Earlier stacks used
# foundation-db (older schema of this backend) and db-data (the Node.js era,
# PostgreSQL 16); neither is referenced, so both are left untouched rather than
# deleted. Remove them with `docker volume rm` once they are no longer needed.
# Credentials and the signing secret below are for local development only.
name: misko
x-database-url: &database-url postgres://misko:misko_local_only@db:5432/misko_foundation?sslmode=disable
services:
db:
image: postgres:18.6-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873
environment:
POSTGRES_USER: misko
POSTGRES_PASSWORD: misko_local_only
POSTGRES_DB: misko_foundation
volumes:
- postgres-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U misko -d misko_foundation"]
interval: 2s
timeout: 3s
retries: 20
migrate:
build: ./backend
entrypoint: ["/bootstrap", "migrate"]
environment:
DATABASE_URL: *database-url
depends_on:
db:
condition: service_healthy
profiles: [setup]
# Run with `docker compose --profile setup run --rm setup` so the one-time
# administrator password is printed to your terminal rather than a log.
# With WORKER_BOOTSTRAP_TOKEN set in .env (see .env.example) it also seeds
# the dev-worker from that token, so the worker profile needs no manual
# registration. The seed is refused when APP_ENV=production.
setup:
build: ./backend
entrypoint: ["/bootstrap", "setup"]
environment:
DATABASE_URL: *database-url
ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@misko.local}
LAB_NAME: ${LAB_NAME:-Misko Laboratory}
LAB_TIMEZONE: ${LAB_TIMEZONE:-UTC}
WORKER_BOOTSTRAP_TOKEN: ${WORKER_BOOTSTRAP_TOKEN:-}
APP_ENV: ${APP_ENV:-}
depends_on:
db:
condition: service_healthy
profiles: [setup]
# Registers an analysis worker directly in the database and prints its token
# once; run it like setup, with `run --rm` and the worker's name, model
# version and paradigms as arguments:
# docker compose --profile setup run --rm register-worker \
# -name worker-1 -model-version "misko-tracker-bgsub 2.2.0" \
# -paradigm MWM -paradigm NOVEL_OBJECT -paradigm POLE -paradigm TREADMILL
register-worker:
build: ./backend
entrypoint: ["/bootstrap", "register-worker"]
environment:
DATABASE_URL: *database-url
depends_on:
db:
condition: service_healthy
profiles: [setup]
backend:
build: ./backend
environment:
DATABASE_URL: *database-url
HTTP_ADDR: :4000
JWT_SECRET: ${JWT_SECRET:-local-development-only-signing-secret}
# Videos and analysis outputs are kept on the local-videos volume and
# served by the API under /api/local-storage. Set GCS_BUCKET to use a
# private Cloud Storage bucket instead; a bucket takes precedence.
LOCAL_STORAGE_DIR: /data/videos
GCS_BUCKET: ${GCS_BUCKET:-}
GCS_SIGNER_EMAIL: ${GCS_SIGNER_EMAIL:-}
volumes:
- local-videos:/data/videos
ports:
- "127.0.0.1:4000:4000"
depends_on:
db:
condition: service_healthy
stop_grace_period: 15s
# The web panel. Nginx serves the built single page application and proxies
# /api to the backend service, so the browser talks to one origin.
frontend:
build: ./frontend
ports:
- "127.0.0.1:${FRONTEND_PORT:-8080}:80"
depends_on:
- backend
# Queues analysis runs for verified, calibrated recordings and requeues
# expired leases. It needs the database only; workers call the API.
jobs:
build: ./backend
entrypoint: ["/jobs"]
environment:
DATABASE_URL: *database-url
JOB_INTERVAL: ${JOB_INTERVAL:-10s}
depends_on:
db:
condition: service_healthy
# Analysis worker; start it with --profile worker. Its token is
# MISKO_WORKER_TOKEN or, when that is unset, the WORKER_BOOTSTRAP_TOKEN the
# setup command seeded as dev-worker, so after a seeded setup it starts with
# no manual steps. It reads sources and writes outputs through signed URLs,
# from local storage on the API or from GCS.
worker:
build: ./worker
profiles: [worker]
environment:
MISKO_API_URL: http://backend:4000
MISKO_WORKER_TOKEN: ${MISKO_WORKER_TOKEN:-${WORKER_BOOTSTRAP_TOKEN:-}}
depends_on:
- backend
volumes:
postgres-data:
local-videos: