-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.fleet.yml
More file actions
83 lines (78 loc) · 2.45 KB
/
Copy pathdocker-compose.fleet.yml
File metadata and controls
83 lines (78 loc) · 2.45 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
# Docker Compose fleet template for darkreach
#
# Spins up a full fleet: PostgreSQL, DB migrations, coordinator, and scalable workers.
#
# Usage:
# docker compose -f docker-compose.fleet.yml up -d # 1 worker
# docker compose -f docker-compose.fleet.yml up -d --scale worker=4 # 4 workers
# docker compose -f docker-compose.fleet.yml logs -f worker # watch workers
# docker compose -f docker-compose.fleet.yml down -v # teardown + data
#
# Workers need a search job ID. Create one via the dashboard at http://localhost:7001,
# then set SEARCH_JOB_ID before scaling workers:
# SEARCH_JOB_ID=42 docker compose -f docker-compose.fleet.yml up -d --scale worker=4
services:
postgres:
image: postgres:16
environment:
POSTGRES_PASSWORD: darkreach
POSTGRES_DB: darkreach
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
init-db:
build: .
entrypoint: ["/app/init-db-docker.sh"]
environment:
DATABASE_URL: postgres://postgres:darkreach@postgres:5432/darkreach
depends_on:
postgres:
condition: service_healthy
restart: "no"
coordinator:
build: .
command: ["dashboard", "--port", "7001", "--database-url", "postgres://postgres:darkreach@postgres:5432/darkreach"]
ports:
- "7001:7001"
environment:
DATABASE_URL: postgres://postgres:darkreach@postgres:5432/darkreach
depends_on:
init-db:
condition: service_completed_successfully
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:7001/healthz"]
interval: 30s
timeout: 5s
start_period: 10s
retries: 3
worker:
build: .
command: ["work", "--database-url", "postgres://postgres:darkreach@postgres:5432/darkreach", "--search-job-id", "${SEARCH_JOB_ID:-1}"]
environment:
DATABASE_URL: postgres://postgres:darkreach@postgres:5432/darkreach
depends_on:
init-db:
condition: service_completed_successfully
restart: unless-stopped
volumes:
- checkpoints:/app/checkpoints
deploy:
resources:
limits:
memory: 4G
healthcheck:
test: ["CMD-SHELL", "pgrep -x darkreach || exit 1"]
interval: 30s
timeout: 5s
start_period: 10s
retries: 3
volumes:
pgdata:
checkpoints: