-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
216 lines (197 loc) · 5.28 KB
/
docker-compose.yml
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
version: "3.9"
# Required for promtail scraping
x-logging: &default-logging
driver: "journald"
options:
tag: "{{.Name}}"
services:
#####
## Required services for listory
#####
db:
image: postgres:16.4
environment:
POSTGRES_PASSWORD: listory
POSTGRES_USER: listory
POSTGRES_DB: listory
networks:
- db
api:
build:
context: .
target: build-api
command: ["npm", "run", "start:dev"]
environment:
DB_HOST: db
DB_USERNAME: listory
DB_PASSWORD: listory
DB_DATABASE: listory
JWT_SECRET: listory
APP_URL: "http://localhost:3000"
NODE_ENV: local # pretty logs
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4318
env_file: .env
volumes:
- ./src:/app/src:ro
- ./dist:/app/dist # build cache
ports:
- 3000 # API
- "9464:9464" # Metrics
labels:
- "traefik.enable=true" # Enable reverse-proxy for this service
- "traefik.http.routers.api.rule=PathPrefix(`/api`)"
- "traefik.http.routers.api.entrypoints=web"
networks:
- web
- db
logging: *default-logging
frontend:
build:
context: .
target: build-frontend
command: ["npm", "run", "start", "--", "--host"]
volumes:
- ./frontend/vite.config.js:/app/frontend/vite.config.js:ro
- ./frontend/postcss.config.js:/app/frontend/postcss.config.js:ro
- ./frontend/tailwind.config.js:/app/frontend/tailwind.config.js:ro
- ./frontend/index.html:/app/frontend/index.html:ro
- ./frontend/src:/app/frontend/src:ro
- ./frontend/public:/app/frontend/public:ro
ports:
- 5173
labels:
- "traefik.enable=true" # Enable reverse-proxy for this service
- "traefik.http.routers.frontend.rule=PathPrefix(`/`)"
- "traefik.http.routers.frontend.entrypoints=web"
networks:
- web
proxy:
image: traefik:v2.11.13
command:
#- --log.level=debug
#- --accesslog=true
- --api # Enables the web UI
- --api.insecure=true
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --providers.docker.network=listory_web
- --entrypoints.web.address=:3000
ports:
- "3000:3000" # The HTTP port
- "8080:8080" # The web UI
networks:
- web
volumes:
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
#####
## console REPL
#####
console:
profiles:
- console
build:
context: .
target: build-api
command: ["npm", "run", "start:console"]
stdin_open: true
tty: true
environment:
DB_HOST: db
DB_USERNAME: listory
DB_PASSWORD: listory
DB_DATABASE: listory
JWT_SECRET: listory
APP_URL: "http://localhost:3000"
NODE_ENV: local # pretty logs
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4318
env_file: .env
volumes:
- ./src:/app/src:ro
- ./dist:/app/dist # build cache
ports:
- "9464:9464" # Metrics
networks:
- db
logging: *default-logging
#####
## Observability
## Adopted from https://github.com/stefanprodan/dockprom/blob/master/docker-compose.yml
#####
prometheus:
profiles: ["observability"]
image: prom/prometheus:v2.54.1
volumes:
- ./observability/prometheus:/etc/prometheus
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=200h"
- "--web.enable-lifecycle"
ports:
- "9090:9090"
networks:
- observability
- web
loki:
profiles: ["observability"]
image: grafana/loki:2.9.10
command: ["-config.file=/etc/loki/loki.yaml"]
ports:
- "3100" # loki needs to be exposed so it receives logs
volumes:
- ./observability/loki/loki.yaml:/etc/loki/loki.yaml
networks:
- observability
promtail:
profiles: ["observability"]
image: grafana/promtail:2.9.10
command: ["-config.file=/etc/promtail.yaml"]
volumes:
- ./observability/promtail/promtail.yaml:/etc/promtail.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/log/journal/:/var/log/journal/
- /run/log/journal/:/run/log/journal/
- /etc/machine-id:/etc/machine-id
ports:
- "3102"
networks:
- observability
depends_on:
- loki
tempo:
profiles: ["observability"]
image: grafana/tempo:2.6.1
command: ["-config.file=/etc/tempo.yaml"]
volumes:
- ./observability/tempo/tempo.yaml:/etc/tempo.yaml
- tempo_data:/tmp/tempo
ports:
- "3101" # tempo
- "4318" # OpenTelemetry HTTP
networks:
- observability
- web
grafana:
profiles: ["observability"]
image: grafana/grafana-oss:10.4.12
volumes:
- ./observability/grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_SECURITY_ADMIN_USER=listory
- GF_SECURITY_ADMIN_PASSWORD=listory
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_USERS_ALLOW_SIGN_UP=false
- GF_SERVER_HTTP_PORT=2345
ports:
- "2345:2345"
networks:
- observability
volumes:
prometheus_data: {}
tempo_data: {}
networks:
db: {}
web: {}
observability: {}