-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
205 lines (193 loc) · 5.07 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
version: "3.9"
services:
postgres:
image: postgres:16.2
container_name: postgres
networks:
- ates
healthcheck:
test: "pg_isready -U $$POSTGRES_USER"
interval: 10s
timeout: 5s
retries: 10
environment:
- POSTGRES_DB=postgres
- POSTGRES_HOST=localhost
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
- ./db/storage:/var/lib/postgresql/data
ports:
- "5436:5432"
# AuthZ & AuthN
keycloak:
image: quay.io/phasetwo/phasetwo-keycloak:23.0.7
container_name: keycloak
depends_on:
- postgres
networks:
- ates
environment:
- KC_DB=postgres
- KC_DB_URL_HOST=postgres
- KC_DB_URL_DATABASE=ates_keycloak
- KC_DB_USERNAME=postgres
- KC_DB_PASSWORD=postgres
- KC_HEALTH_ENABLED=true
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
healthcheck:
test: [ "CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8080;echo -e \"GET /auth/health/ready HTTP/1.1\r\nhost: http://localhost\r\nConnection: close\r\n\r\n\" >&3;grep \"HTTP/1.1 200 OK\" <&3" ]
interval: 5s
timeout: 5s
retries: 50
ports:
- "7000:8080"
command:
- start-dev
- --http-relative-path=/auth
# Business
task-tracker:
build: ./task_tracker
container_name: task-tracker
networks:
- ates
volumes:
- ./task_tracker:/code:cached
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 9000 -b '0.0.0.0'"
ports:
- "9000:9000"
depends_on:
postgres:
condition: service_started
keycloak:
condition: service_healthy
kafka:
condition: service_started
environment:
RAILS_ENV: development
DATABASE_NAME: ates_task_tracker_development
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: postgres
accounting:
build: ./accounting
container_name: accounting
networks:
- ates
volumes:
- ./accounting:/code:cached
command: bash -c "(bundle exec karafka server &) && rm -f tmp/pids/server.pid && bundle exec rails s -p 10000 -b '0.0.0.0'"
ports:
- "10000:10000"
depends_on:
postgres:
condition: service_started
keycloak:
condition: service_healthy
kafka:
condition: service_started
environment:
RAILS_ENV: development
DATABASE_NAME: ates_accounting_development
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: postgres
accounting-bg-worker:
build: ./accounting
networks:
- ates
volumes:
- ./accounting:/code:cached
command: bash -c "bundle exec clockwork config/clockwork.rb"
depends_on:
postgres:
condition: service_started
keycloak:
condition: service_healthy
kafka:
condition: service_started
environment:
RAILS_ENV: development
DATABASE_NAME: ates_accounting_development
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: postgres
analytics:
build: ./analytics
container_name: analytics
networks:
- ates
volumes:
- ./analytics:/code:cached
command: bash -c "(bundle exec karafka server &) && rm -f tmp/pids/server.pid && bundle exec rails s -p 11000 -b '0.0.0.0'"
ports:
- "11000:11000"
depends_on:
postgres:
condition: service_started
keycloak:
condition: service_healthy
kafka:
condition: service_started
environment:
RAILS_ENV: development
DATABASE_NAME: ates_analytics_development
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: postgres
# Kafka cluster
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- 22181:2181
networks:
- ates
volumes:
- zookeeper-data:/var/lib/zookeeper/data
- zookeeper-log:/var/lib/zookeeper/log
kafka:
image: confluentinc/cp-kafka:7.6.0
depends_on:
- zookeeper
ports:
- 9092:9092
networks:
- ates
hostname: kafka
environment:
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
volumes:
- kafka-data:/var/lib/kafka/data
kafka-ui:
image: provectuslabs/kafka-ui
container_name: kafka-ui
ports:
- 12000:8080
networks:
- ates
restart: always
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092
- KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper:2181
links:
- kafka
- zookeeper
networks:
ates:
volumes:
zookeeper-data:
zookeeper-log:
kafka-data: