-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
210 lines (199 loc) · 5.88 KB
/
Copy pathdocker-compose.yml
File metadata and controls
210 lines (199 loc) · 5.88 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
services:
db:
image: postgres:17
restart: unless-stopped
environment:
POSTGRES_DB: data_rentgen
POSTGRES_USER: data_rentgen
POSTGRES_PASSWORD: changeme
POSTGRES_INITDB_ARGS: --encoding=UTF-8 --lc-collate=C --lc-ctype=C
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB
start_period: 5s
interval: 5s
timeout: 5s
retries: 3
db-migration:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.migrations upgrade head
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
db:
condition: service_healthy
db-create-partitions:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.scripts.create_partitions
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
db-migration:
condition: service_completed_successfully
db-refresh-views:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.scripts.refresh_analytic_views
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
db-migration:
condition: service_completed_successfully
profiles:
- analytics
- all
db-cleanup-partitions:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.scripts.cleanup_partitions truncate --keep-after $(date --date='-1 year' '+%Y-%m-%d')
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
db-migration:
condition: service_completed_successfully
profiles:
- cleanup
- all
db-seed:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.scripts.seed
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
db-migration:
condition: service_completed_successfully
profiles:
- seed
- all
server:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: python -m data_rentgen.server --host 0.0.0.0 --port 8000
restart: unless-stopped
ports:
- 8000:8000
# PROMETHEUS_MULTIPROC_DIR is required for multiple workers, see:
# https://prometheus.github.io/client_python/multiprocess/
environment:
PROMETHEUS_MULTIPROC_DIR: /tmp/prometheus-metrics
# tmpfs dir is cleaned up each container restart
tmpfs:
- /tmp/prometheus-metrics:mode=1777
volumes:
- ./config.docker.yml:/app/config.yml:ro
healthcheck:
test: [CMD-SHELL, curl -f http://localhost:8000/monitoring/ping]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
depends_on:
db:
condition: service_healthy
db-migration:
condition: service_completed_successfully
profiles:
- server
- frontend
- all
broker:
image: bitnamilegacy/kafka:3.9
restart: unless-stopped
environment:
KAFKA_CFG_NODE_ID: '0'
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_LISTENERS: DOCKER://:9092,LOCALHOST://:9093,CONTROLLER://:9094,INTERBROKER://:9095
KAFKA_CFG_ADVERTISED_LISTENERS: DOCKER://broker:9092,LOCALHOST://localhost:9093,INTERBROKER://broker:9095
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,INTERBROKER:PLAINTEXT,DOCKER:SASL_PLAINTEXT,LOCALHOST:SASL_PLAINTEXT
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@broker:9094
KAFKA_CFG_INTER_BROKER_LISTENER_NAME: DOCKER
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CFG_SASL_MECHANISM_CONTROLLER_PROTOCOL: PLAIN
KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL: PLAIN
KAFKA_CLIENT_USERS: data_rentgen
KAFKA_CLIENT_PASSWORDS: changeme
KAFKA_CFG_SASL_ENABLED_MECHANISMS: PLAIN,SCRAM-SHA-256
ports:
- 9093:9093
volumes:
- kafka_data:/bitnami/kafka
healthcheck:
test: [CMD-SHELL, kafka-topics.sh --bootstrap-server 127.0.0.1:9095 --list]
interval: 10s
timeout: 5s
retries: 5
profiles:
- broker
- consumer
- http2kafka
- all
consumer:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: python -m data_rentgen.consumer --host 0.0.0.0 --port 8000
restart: unless-stopped
ports:
- 8001:8000
# PROMETHEUS_MULTIPROC_DIR is required for multiple workers, see:
# https://prometheus.github.io/client_python/multiprocess/
environment:
PROMETHEUS_MULTIPROC_DIR: /tmp/prometheus-metrics
# tmpfs dir is cleaned up each container restart
tmpfs:
- /tmp/prometheus-metrics:mode=1777
volumes:
- ./config.docker.yml:/app/config.yml:ro
healthcheck:
test: [CMD-SHELL, curl -f http://localhost:8000/monitoring/ping]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
depends_on:
broker:
condition: service_healthy
db-migration:
condition: service_completed_successfully
profiles:
- consumer
- all
frontend:
image: mtsrus/data-rentgen-ui:${VERSION:-latest}
restart: unless-stopped
ports:
- 3000:3000
volumes:
- ./config.docker.yml:/app/config.yml:ro
depends_on:
server:
condition: service_healthy
profiles:
- frontend
- all
http2kafka:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: python -m data_rentgen.http2kafka --host 0.0.0.0 --port 8000
restart: unless-stopped
ports:
- 8002:8000
volumes:
- ./config.docker.yml:/app/config.yml:ro
healthcheck:
test: [CMD-SHELL, curl -f http://localhost:8000/monitoring/ping]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
depends_on:
broker:
condition: service_healthy
profiles:
- http2kafka
- all
volumes:
postgres_data:
kafka_data: