-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
265 lines (262 loc) · 7.66 KB
/
compose.yaml
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
services:
static:
image: nginx
volumes:
- evi_files:/usr/share/nginx/html
container_name: static-files
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.files.rule=Host(`${DOMAIN}`) && PathPrefix(`/filestorage`)"
- "traefik.http.routers.files.entrypoints=${ENTRY_POINTS}"
- "traefik.http.middlewares.fileStrip.stripprefix.prefixes=/filestorage"
- "traefik.http.routers.files.middlewares=fileStrip@docker"
- "${FILES_CA}"
frontend: # ---------------------------------------------------------Frontend
build: ./frontend
ports:
- "3001:3000"
env_file:
- fe.env
depends_on:
- "api"
develop:
watch:
- action: rebuild
path: ./frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.fe.rule=Host(`${DOMAIN}`) && !PathPrefix(`/admin`) && !PathPrefix(`/grafana`) && !PathPrefix(`/filestorage`)"
- "traefik.http.routers.fe.entrypoints=${ENTRY_POINTS}"
- "traefik.http.routers.fe.middlewares=clickJack@docker"
- "${FE_CA}"
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
admin-frontend: # --------------------------------------------------------- Admin Frontend
build: ./admin-frontend
ports:
- "3002:3000"
env_file:
- fe.env
depends_on:
- "api"
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
develop:
watch:
- action: rebuild
path: ./admin-frontend
labels:
- "traefik.enable=true"
- "traefik.http.routers.admin.rule=Host(`${DOMAIN}`) && (PathPrefix(`/admin`) || HeaderRegexp(`Referer`, `http.*${DOMAIN}/admin/.*`))"
- "traefik.http.routers.admin.entrypoints=${ENTRY_POINTS}"
- "traefik.http.middlewares.adminStrip.stripprefix.prefixes=/admin"
- "traefik.http.routers.admin.middlewares=adminStrip@docker, clickJack@docker"
- "${ADMIN_CA}"
traefik: # ------------------------------------------------------Traefik
image: traefik:v3.1
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entryPoints.web.address=:80"
- "--entryPoints.websecure.address=:443"
- "--log.level=DEBUG"
- "--${CA_CERT_LINE1}"
- "--${CA_CERT_LINE2}"
- "--${CA_CERT_LINE3}"
- "--${CA_CERT_LINE4}"
- "--${CA_CERT_LINE5}"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "../letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
- traefik.enable=true
- "traefik.http.middlewares.clickJack.headers.customrequestheaders.Content-Security-Policy=frame-ancestors 'self'"
grafana: # -------------------------------------------------------------Grafana
image: docker.io/grafana/grafana-oss
container_name: grafana
env_file:
- graf.env
ports:
- "3000:3000" # Changed Grafana's port to avoid conflict with frontend
volumes:
- grafana-data:/var/lib/grafana
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`${DOMAIN}`) && PathPrefix(`/grafana`)"
- "traefik.http.routers.grafana.entrypoints=${ENTRY_POINTS}"
- "${GRAF_CA}"
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
api: # ------------------------------------------------------------------API
build: ./api
ports:
- "8181:8080"
env_file:
- api.env
depends_on:
- "postgres"
- "redis-cache"
volumes:
- evi_files:/app/filestorage
develop:
watch:
- action: rebuild
path: ./api
logging:
driver: loki
options:
loki-url: http://loki:3100/loki/api/v1/push
mode: non-blocking
max-buffer-size: 4m
loki-retries: "3"
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
orchestrator: # ---------------------------------------------------Orchestrator
build: ./orchestrator
ports:
- "8090:8090"
env_file:
- api.env
depends_on:
- "postgres"
develop:
watch:
- action: rebuild
path: ./orchestrator
logging:
driver: loki
options:
loki-url: http://loki:3100/loki/api/v1/push
mode: non-blocking
max-buffer-size: 4m
loki-retries: "3"
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
postgres: # ----------------------------------------------------------Postgres
image: postgres
ports:
- "5432:5432"
env_file:
- db.env
volumes:
- pgdata:/var/lib/postgresql/data
- ./initdb:/docker-entrypoint-initdb.d
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
redis-cache: # --------------------------------------------------------Redis
image: redis
ports:
- "6379:6379"
env_file:
- red.env
command: sh -c 'redis-server --requirepass "$$REDIS_PASSWORD"'
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
prometheus: # ----------------------------------------------------------Prometheus
image: docker.io/prom/prometheus
container_name: prometheus
ports:
- "9090:9090"
command: "--config.file=/etc/prometheus/prometheus.yml"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
cadvisor: # -----------------------------------------------------------Cadvisor
image: gcr.io/cadvisor/cadvisor
container_name: cadvisor
privileged: true
devices:
- /dev/kmsg
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro
ports:
- 8081:8080
environment:
- allowlisted_container_labels=com.docker.swarm.service.name
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
loki: # ---------------------------------------------------------------Loki
image: grafana/loki
ports:
- "3100:3100"
volumes:
- loki-data:/loki
command: -config.file=/etc/loki/loki-config.yaml
configs:
- source: loki-config
target: /etc/loki/loki-config.yaml
user: root
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
promtail: # -----------------------------------------------------------Promtail
image: grafana/promtail
volumes:
- /var/log:/var/log
- /var/lib/docker/containers:/var/lib/docker/containers
- /var/run/docker.sock:/var/run/docker.sock:ro
command: -config.file=/etc/promtail/config.yaml
configs:
- source: promtail-config
target: /etc/promtail/config.yaml
labels:
- "traefik.enable=false"
restart: on-failure
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
volumes: # ---------------------------------------------------------------Volumes
pgdata:
evi_files:
prometheus-data:
driver: local
grafana-data:
driver: local
loki-data:
driver: local
configs: # ---------------------------------------------------------------Configs
loki-config:
file: ./loki-config.yaml
promtail-config:
file: ./promtail-config.yaml