-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
242 lines (232 loc) Β· 6.03 KB
/
docker-compose.yml
File metadata and controls
242 lines (232 loc) Β· 6.03 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:
# Kong API Gateway
kong:
image: kong:latest
container_name: bw-kong
restart: unless-stopped
ports:
- "8000:8000" # HTTP API
- "8443:8443" # HTTPS API
- "8001:8001" # Admin API
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /var/lib/kong/kong.yml
KONG_PROXY_ACCESS_LOG: /dev/stdout
KONG_ADMIN_ACCESS_LOG: /dev/stdout
KONG_PROXY_ERROR_LOG: /dev/stderr
KONG_ADMIN_ERROR_LOG: /dev/stderr
KONG_ADMIN_LISTEN: 0.0.0.0:8001
KONG_PROXY_LISTEN: 0.0.0.0:8000
volumes:
- ./kong/config.yml:/var/lib/kong/kong.yml:ro
networks:
- bw-network
depends_on:
- auth-service
- post-service
healthcheck:
test: ["CMD", "kong", "health"]
interval: 30s
timeout: 10s
retries: 3
# Authentication Service
auth-service:
build:
context: ./auth-service
dockerfile: Dockerfile
args:
NODE_AUTH_TOKEN: ${NODE_AUTH_TOKEN}
container_name: bw-auth-service
restart: unless-stopped
ports:
- "9001:9001" # HTTP API
- "50051:50051" # gRPC
env_file:
- ./auth-service/.env
environment:
DATABASE_URL: "postgresql://admin:master123@postgres:5432/postgres?schema=auth"
REDIS_URL: "redis://redis:6379"
RABBITMQ_URL: "amqp://guest:guest@rabbitmq:5672"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- bw-network
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:9001/health || exit 1",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Post Service
post-service:
build:
context: ./post-service
dockerfile: Dockerfile
args:
NODE_AUTH_TOKEN: ${NODE_AUTH_TOKEN}
container_name: bw-post-service
restart: unless-stopped
ports:
- "9002:9002" # HTTP API
- "50052:50052" # gRPC
env_file:
- ./post-service/.env
environment:
DATABASE_URL: "postgresql://admin:master123@postgres:5432/postgres?schema=post"
REDIS_URL: "redis://redis:6379"
RABBITMQ_URL: "amqp://guest:guest@rabbitmq:5672"
depends_on:
auth-service:
condition: service_healthy
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- bw-network
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider http://localhost:9002/health || exit 1",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: bw-postgres
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: master123
POSTGRES_DB: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- bw-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U admin -d postgres"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
container_name: bw-redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
networks:
- bw-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
# RabbitMQ Message Broker
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: bw-rabbitmq
restart: unless-stopped
ports:
- "5672:5672" # AMQP
- "15672:15672" # Management UI (http://localhost:15672)
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- bw-network
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
# Mailhog β local SMTP catcher for development (auth-worker welcome emails)
mailhog:
image: mailhog/mailhog:latest
container_name: bw-mailhog
restart: unless-stopped
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI (http://localhost:8025)
networks:
- bw-network
# Auth Worker β RabbitMQ consumer for auth-service events
auth-worker:
build:
context: ./auth-worker
dockerfile: Dockerfile
args:
NODE_AUTH_TOKEN: ${NODE_AUTH_TOKEN}
container_name: bw-auth-worker
restart: unless-stopped
env_file:
- ./auth-worker/.env
environment:
DATABASE_URL: "postgresql://admin:master123@postgres:5432/postgres?schema=auth"
REDIS_URL: "redis://redis:6379"
RABBITMQ_URL: "amqp://guest:guest@rabbitmq:5672"
MAIL_HOST: "mailhog"
MAIL_PORT: "1025"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- bw-network
# Post Worker β RabbitMQ consumer for post-service events
post-worker:
build:
context: ./post-worker
dockerfile: Dockerfile
args:
NODE_AUTH_TOKEN: ${NODE_AUTH_TOKEN}
container_name: bw-post-worker
restart: unless-stopped
env_file:
- ./post-worker/.env
environment:
DATABASE_URL: "postgresql://admin:master123@postgres:5432/postgres?schema=post"
REDIS_URL: "redis://redis:6379"
RABBITMQ_URL: "amqp://guest:guest@rabbitmq:5672"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
networks:
- bw-network
networks:
bw-network:
driver: bridge
volumes:
postgres_data:
redis_data:
rabbitmq_data: