-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
273 lines (262 loc) · 8.75 KB
/
Copy pathdocker-compose.yml
File metadata and controls
273 lines (262 loc) · 8.75 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
services:
# --- Shared Infrastructure ---
postgres:
image: postgres:16-alpine
container_name: chassis-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- chassis_pgdata:/var/lib/postgresql/data
- ./infrastructure/postgres/init:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: chassis-redis
restart: unless-stopped
command: redis-server /usr/local/etc/redis/redis.conf --requirepass ${REDIS_PASSWORD}
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- chassis_redis_data:/data
- ./infrastructure/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 5s
timeout: 3s
retries: 5
rabbitmq:
image: rabbitmq:3.13-management-alpine
container_name: chassis-rabbitmq
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
ports:
- "${RABBITMQ_PORT:-5672}:5672"
- "${RABBITMQ_MGMT_PORT:-15672}:15672"
volumes:
- chassis_rabbit_data:/var/lib/rabbitmq
- ./infrastructure/rabbitmq/definitions.json:/etc/rabbitmq/definitions.json
- ./infrastructure/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 5s
retries: 5
seq:
image: datalust/seq:latest
container_name: chassis-seq
restart: unless-stopped
environment:
ACCEPT_EULA: "Y"
ports:
- "5341:5341"
- "5342:80"
volumes:
- chassis_seq_data:/data
identity-service:
build:
context: ./services/identity-service
dockerfile: Dockerfile
container_name: chassis-identity
ports:
- "${IDENTITY_SERVICE_PORT:-3001}:3001"
environment:
- DATABASE_URL=postgresql://chassis_app:chassis_app_pwd@postgres:5432/saas_chassis?schema=iam
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
- RABBITMQ_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672
- JWT_SECRET=${JWT_SECRET}
- JWT_EXPIRY=${JWT_EXPIRY:-15m}
- JWT_REFRESH_EXPIRY=${JWT_REFRESH_EXPIRY:-7d}
- PORT=3001
- NODE_ENV=production
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3001/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
tenant-manager:
build:
context: ./services/tenant-manager
dockerfile: Dockerfile
container_name: chassis-tenant-manager
ports:
- "${TENANT_MANAGER_PORT:-3002}:3002"
environment:
- DATABASE_URL=postgresql://chassis_app:chassis_app_pwd@postgres:5432/saas_chassis?schema=tenant_mgmt
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
- RABBITMQ_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672
- JWT_SECRET=${JWT_SECRET}
- INTERNAL_SERVICE_TOKEN=${INTERNAL_SERVICE_TOKEN}
- IDENTITY_SERVICE_URL=http://identity-service:3001
- PORT=3002
- NODE_ENV=production
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
identity-service:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3002/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
billing-engine:
build:
context: ./services/billing-engine
dockerfile: Dockerfile
container_name: chassis-billing
ports:
- "${BILLING_ENGINE_PORT:-3003}:3003"
environment:
- DATABASE_URL=postgresql://chassis_app:chassis_app_pwd@postgres:5432/saas_chassis?schema=billing
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
- RABBITMQ_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672
- JWT_SECRET=${JWT_SECRET}
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY:-}
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET:-}
- STRIPE_SUCCESS_URL=${STRIPE_SUCCESS_URL:-http://localhost:3000/billing/success}
- STRIPE_CANCEL_URL=${STRIPE_CANCEL_URL:-http://localhost:3000/billing/cancel}
- STRIPE_PORTAL_RETURN_URL=${STRIPE_PORTAL_RETURN_URL:-http://localhost:3000/billing}
- INTERNAL_SERVICE_TOKEN=${INTERNAL_SERVICE_TOKEN}
- PORT=3003
- NODE_ENV=production
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
tenant-manager:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3003/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
universal-ledger:
build:
context: ./services/universal-ledger
dockerfile: Dockerfile
container_name: chassis-ledger
ports:
- "${LEDGER_SERVICE_PORT:-3006}:3006"
environment:
- DATABASE_URL=Host=postgres;Database=saas_chassis;Username=chassis_app;Password=chassis_app_pwd;SearchPath=ledger
- RABBITMQ_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672
- SEQ_URL=http://seq:5341
- ASPNETCORE_ENVIRONMENT=Production
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3006/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
api-gateway:
build:
context: ./services/api-gateway
dockerfile: Dockerfile
container_name: chassis-gateway
ports:
- "${API_GATEWAY_PORT:-8080}:8080"
environment:
- PORT=8080
- JWT_SECRET=${JWT_SECRET}
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379
- INTERNAL_SERVICE_TOKEN=${INTERNAL_SERVICE_TOKEN}
- IDENTITY_SERVICE_URL=http://identity-service:3001
- TENANT_MANAGER_URL=http://tenant-manager:3002
- BILLING_ENGINE_URL=http://billing-engine:3003
- AUDIT_SERVICE_URL=http://audit-service:3005
- LEDGER_SERVICE_URL=http://universal-ledger:3006
# Product routes are NOT configured here — the chassis is product-agnostic.
# When a product (e.g., BariManager) is deployed, it registers itself by
# adding to PRODUCT_ROUTES. See 10-BARIMANAGER-IMPLEMENTATION.md for how
# BariManager's docker-compose.override.yml injects its route.
- PRODUCT_ROUTES=${PRODUCT_ROUTES:-}
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
audit-service:
build:
context: ./services/audit-service
dockerfile: Dockerfile
container_name: chassis-audit
ports:
- "${AUDIT_SERVICE_PORT:-3005}:3005"
environment:
- DATABASE_URL=postgresql://chassis_app:chassis_app_pwd@postgres:5432/saas_chassis
- RABBITMQ_URL=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq:5672
- PORT=3005
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:3005/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
flyway:
image: flyway/flyway:10-alpine
container_name: chassis-flyway
depends_on:
postgres:
condition: service_healthy
volumes:
- ./migrations/iam:/flyway/sql/iam
- ./migrations/billing:/flyway/sql/billing
- ./migrations/tenants:/flyway/sql/tenants
- ./migrations/ledger:/flyway/sql/ledger
environment:
- FLYWAY_URL=jdbc:postgresql://postgres:5432/${POSTGRES_DB:-saas_chassis}
- FLYWAY_USER=${POSTGRES_USER}
- FLYWAY_PASSWORD=${POSTGRES_PASSWORD}
- FLYWAY_SCHEMAS=iam,billing,tenant_mgmt,ledger
- FLYWAY_LOCATIONS=filesystem:/flyway/sql
- FLYWAY_CONNECT_RETRIES=5
command: migrate
profiles:
- migrate
volumes:
chassis_pgdata:
chassis_redis_data:
chassis_rabbit_data:
chassis_seq_data: