-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
116 lines (112 loc) · 2.97 KB
/
Copy pathdocker-compose.yml
File metadata and controls
116 lines (112 loc) · 2.97 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
services:
postgres:
image: postgres:17
container_name: arda-metrics-postgres
environment:
- POSTGRES_DB=metrics_db
- POSTGRES_USER=metrics_user
- POSTGRES_PASSWORD=metrics_password
ports:
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- analytics-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U metrics_user -d metrics_db"]
interval: 30s
timeout: 5s
retries: 5
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 256M
cpus: '0.25'
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: arda-metrics-backend
# Override Dockerfile CMD to enable --reload for local development
command: ["uvicorn", "backend.api.main:app", "--host", "0.0.0.0", "--port", "8008", "--log-config", "/app/backend/logging_config.yaml", "--reload", "--reload-dir", "/app/backend"]
ports:
- "8008:8008"
environment:
- DATABASE_URL=${DATABASE_URL:-postgresql://metrics_user:metrics_password@postgres:5432/metrics_db}
- LOG_LEVEL=${LOG_LEVEL:-info}
- PYTHONUNBUFFERED=1
volumes:
- ./backend:/app/backend # Dev mode: live code reload
networks:
- analytics-network
depends_on:
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import sys; import httpx; r = httpx.get('http://localhost:8008/api/health/live', timeout=2); sys.exit(0 if r.status_code == 200 else 1)"]
interval: 15s
timeout: 3s
retries: 3
start_period: 30s
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 1G
cpus: '2.0'
reservations:
memory: 512M
cpus: '1.0'
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: development # Use dev stage for local development
container_name: arda-metrics-frontend
ports:
- "5173:5173" # Vite dev server
environment:
- VITE_PROXY_TARGET=http://backend:8008
- VITE_API_URL=/api
volumes:
- ./frontend:/app # Dev mode: live code reload
- /app/node_modules # Prevent overwriting node_modules
networks:
- analytics-network
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 512M
cpus: '1.0'
reservations:
memory: 256M
cpus: '0.5'
volumes:
postgres-data:
driver: local
networks:
analytics-network:
driver: bridge