-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
188 lines (179 loc) · 5.36 KB
/
docker-compose.yml
File metadata and controls
188 lines (179 loc) · 5.36 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
services:
postgres-auth:
image: postgres:16-alpine
container_name: api-gw-postgres-auth
restart: unless-stopped
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: authdb
ports:
- "5432:5432"
volumes:
- pg-auth-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d authdb"]
interval: 5s
timeout: 5s
retries: 5
postgres-project:
image: postgres:16-alpine
container_name: api-gw-postgres-project
restart: unless-stopped
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: projectdb
ports:
- "5433:5432"
volumes:
- pg-project-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d projectdb"]
interval: 5s
timeout: 5s
retries: 5
mongodb:
image: mongo:7
container_name: api-gw-mongodb
restart: unless-stopped
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: api-gw-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
auth-service:
build:
context: .
dockerfile: services/auth-service/Dockerfile
container_name: api-gw-auth-service
restart: unless-stopped
ports:
- "4001:4001"
environment:
NODE_ENV: production
AUTH_PORT: 4001
DATABASE_URL: postgresql://user:password@postgres-auth:5432/authdb?schema=public
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET:-dev-access-token-secret-min-32-chars!!}
REFRESH_TOKEN_SECRET: ${REFRESH_TOKEN_SECRET:-dev-refresh-token-secret-min-32-chars!}
# OAuth (optional)
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET:-}
GOOGLE_REDIRECT_URI: ${GOOGLE_REDIRECT_URI:-http://localhost:3000/api/v1/oauth/google/callback}
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID:-}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET:-}
GITHUB_REDIRECT_URI: ${GITHUB_REDIRECT_URI:-http://localhost:3000/api/v1/oauth/github/callback}
# Email / SMTP (optional — defaults to mock)
EMAIL_DRIVER: ${EMAIL_DRIVER:-mock}
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
SMTP_SECURE: ${SMTP_SECURE:-false}
FROM_EMAIL: ${FROM_EMAIL:-noreply@api-gateway.local}
depends_on:
postgres-auth:
condition: service_healthy
project-service:
build:
context: .
dockerfile: services/project-service/Dockerfile
container_name: api-gw-project-service
restart: unless-stopped
ports:
- "4002:4002"
environment:
NODE_ENV: production
PROJECT_PORT: 4002
DATABASE_URL: postgresql://user:password@postgres-project:5432/projectdb?schema=public
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET:-dev-access-token-secret-min-32-chars!!}
depends_on:
postgres-project:
condition: service_healthy
analytics-service:
build:
context: .
dockerfile: services/analytics-service/Dockerfile
container_name: api-gw-analytics-service
restart: unless-stopped
ports:
- "4003:4003"
environment:
NODE_ENV: production
ANALYTICS_PORT: 4003
MONGO_URI: mongodb://mongodb:27017/logging
GATEWAY_URL: http://gateway:3000
ALERT_SECRET: ${ALERT_SECRET:-dev-alert-secret-change-in-production}
AUTH_SERVICE_URL: http://auth-service:4001
PROJECT_SERVICE_URL: http://project-service:4002
LOGGING_SERVICE_URL: http://logging-service:4004
depends_on:
mongodb:
condition: service_healthy
logging-service:
build:
context: .
dockerfile: services/logging-service/Dockerfile
container_name: api-gw-logging-service
restart: unless-stopped
ports:
- "4004:4004"
environment:
NODE_ENV: production
LOGGING_PORT: 4004
MONGO_URI: mongodb://mongodb:27017/logging
depends_on:
mongodb:
condition: service_healthy
gateway:
build:
context: .
dockerfile: gateway/Dockerfile
container_name: api-gw-gateway
restart: unless-stopped
ports:
- "3000:3000"
environment:
NODE_ENV: production
GATEWAY_PORT: 3000
REDIS_URL: redis://redis:6379
ACCESS_TOKEN_SECRET: ${ACCESS_TOKEN_SECRET:-dev-access-token-secret-min-32-chars!!}
AUTH_SERVICE_URL: http://auth-service:4001
PROJECT_SERVICE_URL: http://project-service:4002
ANALYTICS_SERVICE_URL: http://analytics-service:4003
LOGGING_SERVICE_URL: http://logging-service:4004
CORS_ORIGINS: "*"
ALERT_SECRET: ${ALERT_SECRET:-dev-alert-secret-change-in-production}
depends_on:
auth-service:
condition: service_started
project-service:
condition: service_started
analytics-service:
condition: service_started
logging-service:
condition: service_started
redis:
condition: service_healthy
volumes:
pg-auth-data:
pg-project-data:
mongo-data:
redis-data: