-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
202 lines (191 loc) · 5.17 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
version: "3.9"
services:
api:
container_name: users.api
build:
context: .
restart: unless-stopped
environment:
- CONFIG_PATH=${CONFIG_PATH}
volumes:
- ./config:/app/config:ro
- ./private.key:/app/private.key
- ./public.key:/app/public.key
depends_on:
database:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- users.postgres.network
- users.rabbitmq.network
expose:
- ${EXPOSE_SERVER_PORT}
ports:
- ${EXPOSE_SERVER_PORT}:${SERVER_PORT}
env_file:
- .env
healthcheck:
test: [ "CMD-SHELL", "curl -fsSL http://localhost:${SERVER_PORT}/api/healthcheck" ]
interval: 10s
timeout: 60s
retries: 5
start_period: 10s
migration:
container_name: users.migration
build:
context: .
restart: on-failure
depends_on:
database:
condition: service_healthy
networks:
- users.postgres.network
volumes:
- ./config:/app/config:ro
- ./alembic.ini:/app/alembic.ini:ro
- ./src:/app/src:ro
- ./migrations:/app/migrations:ro
environment:
- CONFIG_PATH=${CONFIG_PATH}
command: [ "python", "-m", "alembic", "upgrade", "head" ]
database:
container_name: users.database
hostname: users.database
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
PGDATA: ${POSTGRES_PGDATA}
ports:
- ${POSTGRES_PORT}:5432
volumes:
- users.postgres.data:${POSTGRES_PGDATA}:rw
networks:
- users.postgres.network
env_file:
- .env
healthcheck:
test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ]
interval: 10s
timeout: 60s
retries: 5
start_period: 10s
postgres_backup:
container_name: users.postgres_backup
image: prodrigestivill/postgres-backup-local:15-alpine
networks:
- users.postgres.network
env_file:
- .env
environment:
- POSTGRES_HOST=database
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- BACKUP_DIR=/backups
- POSTGRES_EXTRA_OPTS=-Z6 --schema=public --blobs
- SCHEDULE=${POSTGRES_BACKUP_SCHEDULE}
- HEALTHCHECK_PORT=${PG_DUMP_HEALTHCHECK_PORT}
volumes:
- ${POSTGRES_BACKUP_DIR}:/backups
rabbitmq:
image: rabbitmq:3.11-management-alpine
container_name: users.rabbitmq
hostname: users.rabbitmq
restart: unless-stopped
ports:
- ${RABBITMQ_PORT}:${RABBITMQ_PORT}
- ${RABBITMQ_UI_PORT}:${RABBITMQ_UI_PORT}
networks:
- users.rabbitmq.network
volumes:
- users.rabbitmq.data:/var/lib/rabbitmq/:rw
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "rabbitmq-diagnostics check_running -q"]
interval: 10s
timeout: 60s
retries: 5
start_period: 10s
grafana:
image: grafana/grafana:9.5.2
container_name: users.grafana
hostname: users.grafana
restart: unless-stopped
expose:
- "3000"
ports:
- "127.0.0.1:3000:3000"
networks:
- users.grafana.network
volumes:
- users.grafana.data:/var/lib/grafana:rw
- ./grafana/provisioning:/etc/grafana/provisioning:rw
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USER}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
- GF_USERS_ALLOW_SIGN_UP=false
- VIRTUAL_HOST=users.grafana
- NETWORK_ACCESS=internal
- VIRTUAL_PORT=3000
depends_on:
- prometheus
loki:
image: grafana/loki:2.8.2
container_name: users.loki
hostname: users.loki
expose:
- ${LOKI_EXPOSE_PORT}
volumes:
- ./loki/config.yaml:/etc/loki/config.yaml:ro
- users.loki.data:/tmp/:rw
command: -config.file=/etc/loki/config.yaml
restart: unless-stopped
networks:
- users.grafana.network
vector:
image: timberio/vector:0.29.1-alpine
container_name: users.vector
hostname: users.vector
restart: unless-stopped
expose:
- ${VECTOR_EXPOSE_PORT}
networks:
- users.grafana.network
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./vector/vector.toml:/etc/vector/vector.toml:ro
logging:
driver: "json-file"
options:
max-size: "10m"
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus:/etc/prometheus/
container_name: users.prometheus
hostname: users.prometheus
command:
- --config.file=/etc/prometheus/prometheus.yml
ports:
- ${PROMETHEUS_PORT}:${PROMETHEUS_PORT}
restart: unless-stopped
environment:
TZ: ${PROMETHEUS_TIMEZONE}
networks:
- users.postgres.network
- users.grafana.network
volumes:
users.postgres.data: {}
users.rabbitmq.data: {}
users.grafana.data: {}
users.loki.data: {}
networks:
users.postgres.network: {}
users.grafana.network: {}
users.rabbitmq.network: {}