-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
220 lines (208 loc) · 5.71 KB
/
Copy pathdocker-compose.yml
File metadata and controls
220 lines (208 loc) · 5.71 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
networks:
velosim-net:
driver: bridge
volumes:
postgres_data:
driver: local
prometheus_data:
driver: local
services:
# --- Postgres ---
postgres:
image: postgres:15-alpine
container_name: velosim-postgres
environment:
POSTGRES_USER: velosim
POSTGRES_PASSWORD: velosim
POSTGRES_DB: velosim
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./back/database/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./back/alembic/seeds:/docker-entrypoint-initdb.d/seeds
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U velosim"]
interval: 2s
timeout: 5s
retries: 10
start_period: 5s
networks:
- velosim-net
# --- Loki ---
loki:
image: grafana/loki:2.9.0
container_name: velosim-loki
ports:
- "3100:3100"
volumes:
- ./grafana_logging/loki-config.yaml:/etc/loki/local-config.yaml:ro
- ./grafana_logging/loki/chunks:/loki/chunks
- ./grafana_logging/loki/index:/loki/index
- ./grafana_logging/loki/cache:/loki/cache
- ./grafana_logging/loki/wal:/loki/wal
- ./grafana_logging/loki/compactor:/loki/compactor
command: -config.file=/etc/loki/local-config.yaml
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3100/ready || exit 1"]
interval: 5s
timeout: 3s
retries: 5
networks:
- velosim-net
# --- Grafana ---
grafana:
image: grafana/grafana:11.0.0
container_name: velosim-grafana
ports:
- "3001:3000" # Expose on 3001 to avoid conflict with frontend
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=velosim
volumes:
# Provisioning files for datasources/dashboards
- ./grafana_logging/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./grafana_logging/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
# Persistent Grafana data (dashboards, settings, etc)
- ./grafana_logging/grafana_data:/var/lib/grafana
depends_on:
loki:
condition: service_healthy
restart: unless-stopped
networks:
- velosim-net
# --- Alloy (log collector) ---
alloy:
image: grafana/alloy:latest
container_name: velosim-alloy
ports:
- "12345:12345"
volumes:
- ./grafana_logging/alloy/config.alloy:/etc/alloy/config.alloy:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log:/var/log:ro
- ./grafana_logging/alloy/data:/var/lib/alloy/data
- ./grafana_logging:/logs:ro
command:
- run
- /etc/alloy/config.alloy
- --storage.path=/var/lib/alloy/data
- --server.http.listen-addr=0.0.0.0:12345
restart: unless-stopped
depends_on:
loki:
condition: service_healthy
networks:
- velosim-net
# --- GraphHopper Routing Server ---
graphhopper:
image: israelhikingmap/graphhopper:10.2
container_name: velosim-graphhopper
command: >-
--input /data/montreal-latest.osm.pbf
ports:
- "8989:8989"
volumes:
- ./graphhopper-data:/data
environment:
- JAVA_OPTS=${GRAPHHOPPER_JAVA_OPTS:--Xmx2g -Xms2g}
restart: unless-stopped
healthcheck:
test:
[
"CMD-SHELL",
"wget --quiet --tries=1 --spider http://localhost:8989/health || exit 1",
]
interval: 15s
timeout: 10s
retries: 5
start_period: 180s
networks:
- velosim-net
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 3g
cpus: '2'
# --- Backend API ---
backend:
build:
context: .
dockerfile: back/Dockerfile
container_name: velosim-backend
ports:
- "8000:8000"
volumes:
- ./back:/app/back
- ./grafana_logging:/app/grafana_logging
- ./sim:/app/sim
- ./scripts:/app/scripts
- ./graphhopper-data:/app/graphhopper-data:ro
environment:
# Database connection
- DATABASE_URL=postgresql://velosim:velosim@postgres:5432/velosim
# GraphHopper connection - use service name for Docker networking
- GRAPHHOPPER_URL=http://graphhopper:8989
env_file:
- path: .env
required: false
depends_on:
postgres:
condition: service_healthy
graphhopper:
condition: service_healthy
restart: unless-stopped
networks:
- velosim-net
# --- Frontend (For full deployment) ---
frontend:
build:
context: .
dockerfile: front/Dockerfile
args:
- VITE_MAPBOX_ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN:-}
- VITE_BACKEND_URL=http://localhost:8000
container_name: velosim-frontend
ports:
- "3000:3000" # Frontend always uses 3000 (both Docker and production)
depends_on:
- backend
restart: unless-stopped
networks:
- velosim-net
# --- Nginx Proxy (For full deployment) ---
proxy:
build:
context: ./docker/nginx-proxy
dockerfile: Dockerfile
container_name: velosim-proxy
ports:
- "80:80"
depends_on:
- backend
- frontend
restart: unless-stopped
networks:
- velosim-net
# --- Prometheus ---
prometheus:
image: prom/prometheus:latest
container_name: velosim-prometheus
ports:
- "9090:9090"
volumes:
- ./grafana_logging/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
restart: unless-stopped
networks:
- velosim-net