-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
242 lines (209 loc) · 5.68 KB
/
docker-compose.yml
File metadata and controls
242 lines (209 loc) · 5.68 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
services:
consul:
image: hashicorp/consul:latest
ports:
- "5150:5150" # Web UI and API
- "8600:8600/udp" # DNS
command: "agent -dev -config-file=consul-service.json -client=0.0.0.0"
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:5150/v1/status/leader" ]
interval: 30s # Check every 30 seconds
timeout: 10s # Timeout after 10 seconds
retries: 3 # Consider container unhealthy after 3 failures
start_period: 30s # Start checking after 30 seconds
volumes:
- ./consul-service.json:/consul-service.json
networks:
- consul-network
kafka:
image: docker.io/bitnamilegacy/kafka:3.8
ports:
- "9092:9092"
volumes:
- "kafka_data:/bitnami"
environment:
- KAFKA_CFG_NODE_ID=0
- KAFKA_CFG_PROCESS_ROLES=controller,broker
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT
networks:
- consul-network
spicedb:
build:
context: .
dockerfile: config/spicedb/Dockerfile.spicedb
ports:
- "50051:50051" # GRPC port
- "8443:8443" # HTTP port (secured with TLS)
environment:
- SPICEDB_LOG_LEVEL=debug
- SPICEDB_GRPC_PRESHARED_KEY=spiceDBKey
- SPICEDB_GRPC_TLS_CERT_PATH=/spicedb.crt
- SPICEDB_GRPC_TLS_KEY_PATH=/spicedb.key
- SPICEDB_HTTP_TLS_CERT_PATH=/spicedb.crt
- SPICEDB_HTTP_TLS_KEY_PATH=/spicedb.key
- SPICEDB_DATASTORE_ENGINE=postgres
- SPICEDB_DATASTORE_CONN_URI=postgres://postgres:postgres@db:5432/spicedb?sslmode=disable
depends_on:
- db
volumes:
- ./config/spicedb/spicedb.crt:/spicedb.crt
- ./config/spicedb/spicedb.key:/spicedb.key
networks:
- consul-network
api-gateway:
build:
context: ./kontest-api-gateway
ports:
- "5153:5153" # Port for your Go service
depends_on:
consul:
condition: service_healthy
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
- API_GATEWAY_HOST=api-gateway
- API_GATEWAY_PORT=5153
networks:
- consul-network
kontest-api:
deploy:
replicas: 2
build:
context: ./kontest-api
# ports:
# - "5151:5151" # Port for your Go service
depends_on:
consul:
condition: service_healthy
db:
condition: service_started
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
- DB_HOST=db
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=postgres
# - KONTEST_API_SERVER_HOST=kontest-api
networks:
- consul-network
kontest-user-stats-service:
deploy:
replicas: 2
build:
context: ./kontest-user-stats-service
# ports:
# - "5152:5152" # Port for your Go service
depends_on:
consul:
condition: service_healthy
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
# - KONTEST_API_USER_STATS_SERVICE_HOST=kontest-user-stats-service
networks:
- consul-network
kontest-email-service:
deploy:
replicas: 2
build:
context: ./kontest-email-service
# ports:
# - "5157:5157"
depends_on:
consul:
condition: service_healthy
kafka:
condition: service_started
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
# - KONTEST_EMAIL_SERVICE_HOST=kontest-email-service
- KAFKA_HOST=kafka
- KAFKA_PORT=9092
networks:
- consul-network
kontest-authentication-service:
deploy:
replicas: 2
build:
context: ./kontest-authentication
# ports:
# - "5155:5155"
depends_on:
consul:
condition: service_healthy
kafka:
condition: service_started
db:
condition: service_started
spicedb:
condition: service_started
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
- DB_HOST=db
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=postgres
# - KONTEST_AUTHENTICATION_SERVICE_HOST=kontest-authentication-service
- KAFKA_HOST=kafka
- KAFKA_PORT=9092
- SPICEDB_HOST=spicedb
- SPICEDB_PORT=50051
- SPICEDB_TOKEN=spiceDBKey
- SPICEDB_TLS_CERT_PATH=/spicedb.crt
networks:
- consul-network
volumes:
- ./config/spicedb/spicedb.crt:/spicedb.crt
kontest-user-service:
deploy:
replicas: 2
build:
context: ./kontest-user-service
# ports:
# - "5156:5156"
depends_on:
consul:
condition: service_healthy
db:
condition: service_started
environment:
- CONSUL_HOST=consul
- CONSUL_PORT=5150
- DB_HOST=db
- DB_PORT=5432
- DB_USER=postgres
- DB_PASSWORD=postgres
# - KONTEST_USER_SERVICE_HOST=kontest-user-service
# - KONTEST_USER_SERVICE_PORT=5156
- API_GATEWAY_HOST=api-gateway
- API_GATEWAY_PORT=5153
networks:
- consul-network
db:
image: postgres:latest
environment:
- POSTGRES_USER=${DB_USER:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
ports:
- "5432:5432"
networks:
- consul-network
volumes:
- db-data:/var/lib/postgresql
- ./config/init-scripts/init-database-scripts:/docker-entrypoint-initdb.d
networks:
consul-network:
driver: bridge
volumes:
db-data:
driver: local
kafka_data:
driver: local