-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
267 lines (254 loc) · 6.02 KB
/
docker-compose.yml
File metadata and controls
267 lines (254 loc) · 6.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
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
services:
postgres:
container_name: lunaris_database
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: lunaris
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d lunaris"]
interval: 5s
timeout: 5s
retries: 10
networks:
- lunaris
deploy:
resources:
limits:
cpus: "1.0"
memory: 256M
redis:
container_name: lunaris_cache
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis_data:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
networks:
- lunaris
deploy:
resources:
limits:
cpus: "0.5"
memory: 128M
backend:
container_name: lunaris_backend
build:
context: ./backend
dockerfile: Dockerfile
target: runner
restart: unless-stopped
command: >
sh -c "npx prisma generate &&
npx prisma migrate deploy &&
node --watch server.js"
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/lunaris
REDIS_URL: redis://redis:6379
PORT: 8000
NODE_ENV: development
LOG_LEVEL: info
CORS_ORIGIN: http://localhost:3000
WORKER_CONCURRENCY: 2
volumes:
- ./backend:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- lunaris
deploy:
resources:
limits:
cpus: "1.0"
memory: 512M
prisma-studio:
container_name: lunaris_prisma_studio
build:
context: ./backend
dockerfile: Dockerfile
target: runner
restart: unless-stopped
command: npx prisma studio --port 5555 --hostname 0.0.0.0
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/lunaris
volumes:
- ./backend:/app
- /app/node_modules
ports:
- "5555:5555"
depends_on:
postgres:
condition: service_healthy
networks:
- lunaris
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
worker:
container_name: lunaris_worker
build:
context: ./backend
dockerfile: Dockerfile
target: worker-runtime
restart: unless-stopped
command: >
sh -c "npx prisma generate &&
node --watch worker.js"
environment:
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/lunaris
REDIS_URL: redis://redis:6379
NODE_ENV: development
LOG_LEVEL: info
WORKER_CONCURRENCY: 1
METRICS_PORT: 9091
volumes:
- ./backend:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
backend:
condition: service_started
ports:
- "9091:9091"
networks:
- lunaris
shm_size: '256m'
deploy:
resources:
limits:
cpus: "1.5"
memory: 800M
frontend:
container_name: lunaris_frontend
build:
context: ./frontend
dockerfile: Dockerfile
restart: unless-stopped
environment:
VITE_BACKEND_URL: http://nginx:80
volumes:
- ./frontend:/app
- /app/node_modules
ports:
- "3000:3000"
depends_on:
- nginx
networks:
- lunaris
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
nginx:
container_name: lunaris_router
image: nginx:1.27-alpine
restart: unless-stopped
ports:
- "8000:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- backend
networks:
- lunaris
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:80/nginx-health"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
memory: 64M
prometheus:
container_name: lunaris_metrics
image: prom/prometheus:v2.51.0
restart: unless-stopped
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=15d'
- '--web.enable-lifecycle'
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
ports:
- "9090:9090"
depends_on:
backend:
condition: service_started
networks:
- lunaris
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
grafana:
container_name: lunaris_dashboard
image: grafana/grafana:10.4.2
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_ANALYTICS_REPORTING_ENABLED: "false"
GF_ANALYTICS_CHECK_FOR_UPDATES: "false"
GF_SERVER_ROOT_URL: http://localhost:3001
volumes:
- ./monitoring/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro
- ./monitoring/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro
- ./monitoring/grafana/dashboards:/etc/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
ports:
- "3001:3000"
depends_on:
prometheus:
condition: service_healthy
networks:
- lunaris
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: "0.5"
memory: 256M
networks:
lunaris:
driver: bridge
volumes:
postgres_data:
redis_data:
prometheus_data:
grafana_data: