-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
86 lines (81 loc) · 3.02 KB
/
Copy pathdocker-compose.yml
File metadata and controls
86 lines (81 loc) · 3.02 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
services:
# ── PostgreSQL ──────────────────────────────────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: focal_postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-focal_lens}
POSTGRES_USER: ${POSTGRES_USER:-focal}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-focal_secret}
volumes:
- pg_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-focal} -d ${POSTGRES_DB:-focal_lens}"]
interval: 5s
timeout: 5s
retries: 15
# ── focal-proxy ─────────────────────────────────────────────────────────────
proxy:
build:
context: .
dockerfile: Dockerfile.proxy
container_name: focal_proxy
restart: unless-stopped
environment:
DATABASE_URL: ${DATABASE_URL:-postgres://focal:focal_secret@postgres:5432/focal_lens}
FOCAL_LISTEN_ADDR: 0.0.0.0:8080
FOCAL_REQUIRE_CHECKSUM: ${FOCAL_REQUIRE_CHECKSUM:-false}
RUST_LOG: ${RUST_LOG:-focal_proxy=info,tower_http=info}
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8080/v1/health || exit 1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 15s
# ── Dashboard ───────────────────────────────────────────────────────────────
dashboard:
build:
context: .
dockerfile: Dockerfile.dashboard
container_name: focal_dashboard
restart: unless-stopped
environment:
FOCAL_PROXY_URL: ${FOCAL_PROXY_URL:-http://proxy:8080}
ports:
- "3000:3000"
depends_on:
proxy:
condition: service_healthy
# ── Seed (runs once, then exits) ────────────────────────────────────────────
seed:
image: postgres:16-alpine
container_name: focal_seed
environment:
PGHOST: postgres
PGPORT: "5432"
PGDATABASE: ${POSTGRES_DB:-focal_lens}
PGUSER: ${POSTGRES_USER:-focal}
PGPASSWORD: ${POSTGRES_PASSWORD:-focal_secret}
volumes:
- ./scripts/seed.sql:/seed.sql:ro
entrypoint: >
sh -c "
echo 'Waiting for proxy to be ready...' &&
until pg_isready -h postgres -U ${POSTGRES_USER:-focal} -d ${POSTGRES_DB:-focal_lens}; do sleep 2; done &&
psql -v ON_ERROR_STOP=1 -f /seed.sql &&
echo 'Seed complete.'
"
depends_on:
proxy:
condition: service_healthy
restart: "no"
volumes:
pg_data: