-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
208 lines (195 loc) · 6.01 KB
/
docker-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
version: "3.7"
volumes:
postgres-storage:
driver: local
driver_opts:
type: none
device: "${PWD}/data/postgres"
o: bind
grafana-storage:
networks:
cardbox:
services:
vector:
image: timberio/vector:latest-debian
container_name: vector
hostname: vector
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./services/vector/vector.toml:/etc/vector/vector.toml
networks:
cardbox:
migrations:
image: ghcr.io/cardbox/backend/migrations:latest
networks:
cardbox:
depends_on:
- database
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
DATABASE_HOST: database
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
traefik:
container_name: traefik
hostname: traefik
image: traefik:v2.4
labels:
traefik.enable: "true"
traefik.http.routers.traefik.entrypoints: web
traefik.http.routers.traefik.rule: "Host(`traefik.${DOMAIN_NAME}`)"
traefik.http.routers.traefik-secure.entrypoints: websecure
traefik.http.routers.traefik-secure.rule: "Host(`traefik.${DOMAIN_NAME}`)"
traefik.http.routers.traefik-secure.tls: "true"
traefik.http.routers.traefik-secure.service: "api@internal"
networks:
cardbox:
environment:
DOMAIN_NAME: ${DOMAIN_NAME}
expose:
- "8082"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./services/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
- ./services/traefik/config-local.yml:/etc/traefik/config.yml:ro
- ./tls:/tls
restart: unless-stopped
loki:
image: grafana/loki:latest
container_name: loki
hostname: loki
expose:
- "3100"
environment:
- JAEGER_AGENT_HOST=tempo
- JAEGER_ENDPOINT=http://tempo:14268/api/traces
- JAEGER_SAMPLER_TYPE=const
- JAEGER_SAMPLER_PARAM=1
networks:
cardbox:
prometheus:
container_name: prometheus
image: prom/prometheus:latest
command: [ "--config.file=/etc/prometheus.yaml" ]
volumes:
- ./services/grafana/prometheus.yaml:/etc/prometheus.yaml
networks:
cardbox:
grafana:
image: grafana/grafana:latest
container_name: grafana
labels:
traefik.enable: "true"
traefik.http.routers.grafana.rule: "Host(`grafana.${DOMAIN_NAME}`)"
traefik.http.routers.grafana.tls: "true"
networks:
cardbox:
volumes:
- ./services/grafana/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
- grafana-storage:/var/lib/grafana
tempo:
image: grafana/tempo:latest
container_name: tempo
command: [ "-config.file=/etc/tempo.yaml" ]
expose:
- "14268" # jaeger ingest
- "3100" # tempo
- "55680" # otlp grpc
- "55681" # otlp http
- "9411" # zipkin
networks:
cardbox:
volumes:
- ./services/grafana/tempo-local.yaml:/etc/tempo.yaml
- ./data/tempo-data:/tmp/tempo
restart: unless-stopped
database:
container_name: cardbox-database
image: postgres:13
restart: always
volumes:
- "postgres-storage:/var/lib/postgresql/data"
networks:
cardbox:
labels:
traefik.enable: "false"
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
postgresql-exporter:
image: quay.io/prometheuscommunity/postgres-exporter
depends_on:
- database
- migrations
expose:
- "9187"
networks:
cardbox:
environment:
DATA_SOURCE_NAME: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}?sslmode=disable
api-internal:
container_name: cardbox-api-internal
image: ghcr.io/cardbox/backend/api-internal:latest
restart: always
expose:
- "9110"
depends_on:
- database
- migrations
labels:
traefik.enable: "true"
traefik.http.routers.api-internal.rule: "Host(`${DOMAIN_NAME}`) && PathPrefix(`/api/internal`)"
traefik.http.routers.api-internal.middlewares: "api-internal-stripprefix@file"
traefik.http.routers.api-internal.tls: "true"
networks:
cardbox:
environment:
CARDBOX_DATABASE__DATABASE: ${POSTGRES_DB}
CARDBOX_DATABASE__HOST: database
CARDBOX_DATABASE__PASSWORD: ${POSTGRES_PASSWORD}
CARDBOX_DATABASE__POOL_SIZE: 8
CARDBOX_DATABASE__USER: ${POSTGRES_USER}
CARDBOX_MODE: production
CARDBOX_USE_OPENTELEMETRY: "true"
CARDBOX_SERVER__HOST: "0.0.0.0"
CARDBOX_SERVER__PORT: "9110"
CARDBOX_ACCESSO__URL: ${CARDBOX_ACCESSO__URL}
CARDBOX_ACCESSO__CLIENT_ID: ${CARDBOX_ACCESSO__CLIENT_ID}
CARDBOX_ACCESSO__REDIRECT_BACK_URL: ${CARDBOX_ACCESSO__REDIRECT_BACK_URL}
CARDBOX_ACCESSO__CLIENT_SECRET: ${CARDBOX_ACCESSO__CLIENT_SECRET}
CARDBOX_ACCESSO__SSL_VALIDATE: ${CARDBOX_ACCESSO__SSL_VALIDATE}
DATABASE_HOST: ${DATABASE_HOST}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
OPENTELEMETRY_ENDPOINT_URL: "tempo:6831"
RUST_LOG: info
frontend:
container_name: cardbox-frontend
image: ghcr.io/cardbox/frontend/main:latest
depends_on:
- api-internal
labels:
traefik.enable: "true"
traefik.http.routers.frontend.tls: "true"
traefik.http.routers.frontend.rule: "Host(`${DOMAIN_NAME}`)"
traefik.http.services.frontend-service.loadbalancer.server.port: "3000"
traefik.http.routers.frontend.service: "frontend-service"
expose:
- "3000"
networks:
cardbox:
environment:
PUBLIC_URL: https://cardbox.local
IMAGE_URL: https://cardbox.local/images
BACKEND_URL: http://cardbox-api-internal:9110
PORT: 3000
STATUSPAGE_ID: ${STATUSPAGE_ID}