Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
75 lines (69 loc) · 1.83 KB
/
Copy pathcompose.yaml
File metadata and controls
75 lines (69 loc) · 1.83 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
services:
# --- 1. The Gateway (The only public entry point) ---
gateway:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./nginx-gateway.conf:/etc/nginx/nginx.conf:ro
depends_on:
- frontend
- backend
networks:
- bpm-network
# --- 2. Frontend (Accessible only via Gateway) ---
frontend:
build:
context: ./frontend-bpm
dockerfile: Dockerfile
# No ports exposed here!
networks:
- bpm-network
# --- 3. Backend (Accessible only via Gateway) ---
backend:
build:
context: ./backend-bpm
dockerfile: Dockerfile
# In production, use Gunicorn, not Flask run
command: gunicorn --bind 0.0.0.0:4000 flaskr:app
environment:
- DB_URL=postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- SEED_DB=true
depends_on:
db:
condition: service_healthy
networks:
- bpm-network
# --- 4. Database (PostGIS) ---
db:
image: postgis/postgis:17-3.5
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- bpm-network
# No ports exposed! DB is isolated.
# --- 5. Cron Job for Daily Clustering at Midnight ---
clustering-cron:
image: alpine
depends_on:
- backend
command: >
sh -c "apk add --no-cache curl &&
echo '0 0 * * * curl -sf -X POST http://backend:4000/areas/cluster/run >> /proc/1/fd/1 2>&1' > /etc/crontabs/root &&
crond -f -l 2"
networks:
- bpm-network
volumes:
pgdata:
networks:
bpm-network:
driver: bridge