-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
177 lines (166 loc) · 4.3 KB
/
docker-compose.yml
File metadata and controls
177 lines (166 loc) · 4.3 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
services:
db:
image: postgres:17
restart: unless-stopped
env_file: .env.docker
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
env_file: .env.docker
depends_on:
db:
condition: service_healthy
db-create-partitions:
image: mtsrus/data-rentgen:${VERSION:-latest}
command: |
python -m data_rentgen.db.scripts.create_partitions
env_file: .env.docker
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
env_file: .env.docker
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='-1year' '+%Y-%m-%d')
env_file: .env.docker
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
env_file: .env.docker
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
env_file: .env.docker
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
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
env_file: .env.docker
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
env_file: .env.docker
ports:
- 8001:8000
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
env_file: .env.docker
ports:
- 3000:3000
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
env_file: .env.docker
ports:
- 8002:8000
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: