-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
263 lines (246 loc) · 9.23 KB
/
Copy pathdocker-compose.yml
File metadata and controls
263 lines (246 loc) · 9.23 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
version: "3.8"
services:
postgres:
image: pgvector/pgvector:pg16
environment:
POSTGRES_DB: deepmail
POSTGRES_USER: deepmail
POSTGRES_PASSWORD: ${DB_PASSWORD:-deepmail_dev_password}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U deepmail"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
nats:
image: nats:2.10-alpine
ports:
- "4222:4222"
- "8222:8222"
command: ["-js", "-m", "8222"]
volumes:
- nats_data:/data
# Build Zig rate limiter library first
zig-builder:
image: rust:1.78-slim
working_dir: /workspace
volumes:
- .:/workspace
command: >
bash -c "
apt-get update && apt-get install -y curl &&
curl -fsSL https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz | tar -xJ &&
mv zig-linux-x86_64-0.12.0 /usr/local/zig &&
ln -sf /usr/local/zig/zig /usr/local/bin/zig &&
cd /workspace/zig-modules/rate-limiter && zig build -Doptimize=ReleaseFast
"
profiles:
- build
deepmail-auth:
build:
context: .
dockerfile: crates/deepmail-auth/Dockerfile
environment:
- DEEPMAIL_AUTH_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_auth
- DEEPMAIL_AUTH_GRPC_ADDR=0.0.0.0:50051
- DEEPMAIL_AUTH_NATS_URL=nats://nats:4222
- DEEPMAIL_AUTH_JWT_PRIVATE_KEY_PEM=${JWT_PRIVATE_KEY}
- DEEPMAIL_AUTH_JWT_PUBLIC_KEY_PEM=${JWT_PUBLIC_KEY}
- DEEPMAIL_AUTH_SMTP_GRPC_ADDR=http://deepmail-otp-smtp:50052
- DEEPMAIL_AUTH_JWT_ACCESS_EXPIRY_SECONDS=900
- DEEPMAIL_AUTH_JWT_REFRESH_EXPIRY_DAYS=7
- DEEPMAIL_AUTH_OTP_EXPIRY_SECONDS=600
- DEEPMAIL_AUTH_OTP_MAX_ATTEMPTS=5
- DEEPMAIL_AUTH_LOCKOUT_DURATION_MINUTES=15
- DEEPMAIL_AUTH_LOCKOUT_MAX_ATTEMPTS=5
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
zig-builder:
condition: service_completed_successfully
ports:
- "50051:50051"
volumes:
- ./zig-modules/rate-limiter/zig-out/lib:/usr/local/lib:ro
deepmail-otp-smtp:
build:
context: .
dockerfile: crates/deepmail-otp-smtp/Dockerfile
environment:
- DEEPMAIL_OTP_SMTP_ENABLED=true
- DEEPMAIL_OTP_SMTP_HOST=smtp.gmail.com
- DEEPMAIL_OTP_SMTP_PORT=587
- DEEPMAIL_OTP_SMTP_USERNAME=${SMTP_USERNAME}
- DEEPMAIL_OTP_SMTP_PASSWORD=${SMTP_APP_PASSWORD}
- DEEPMAIL_OTP_SMTP_STARTTLS=true
- DEEPMAIL_OTP_SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL:-security@deepmail.local}
- DEEPMAIL_OTP_SMTP_FROM_NAME=DeepMail Security
ports:
- "50052:50052"
depends_on:
nats:
condition: service_started
deepmail-gateway:
build:
context: .
dockerfile: crates/deepmail-gateway/Dockerfile
environment:
- DEEPMAIL_GATEWAY_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_gateway
- DEEPMAIL_GATEWAY_INGEST_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_ingest
- DEEPMAIL_GATEWAY_REDIS_URL=redis://redis:6379
- DEEPMAIL_GATEWAY_HTTP_PORT=8080
- DEEPMAIL_GATEWAY_CORS_ALLOW_ORIGIN=http://localhost:3000
- DEEPMAIL_GATEWAY_AUTH_GRPC_URL=http://deepmail-auth:50051
- DEEPMAIL_GATEWAY_SCORING_GRPC_URL=http://deepmail-scoring:50053
- DEEPMAIL_GATEWAY_REPORT_GRPC_URL=http://deepmail-report:50054
- DEEPMAIL_GATEWAY_IOC_GRPC_URL=http://deepmail-ioc:50055
- DEEPMAIL_GATEWAY_GRAPH_GRPC_URL=http://deepmail-graph:50056
- DEEPMAIL_GATEWAY_TENANT_GRPC_URL=http://deepmail-tenant:50057
- DEEPMAIL_GATEWAY_BILLING_GRPC_URL=http://deepmail-billing:50058
- DEEPMAIL_GATEWAY_NOTIFY_GRPC_URL=http://deepmail-notify:50059
- DEEPMAIL_GATEWAY_RATE_LIMIT_PER_MINUTE=100
- RUST_LOG=info
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
deepmail-auth:
condition: service_started
zig-builder:
condition: service_completed_successfully
ports:
- "8080:8080"
volumes:
- ./zig-modules/rate-limiter/zig-out/lib:/usr/local/lib:ro
# Placeholder services (build from source)
deepmail-scoring:
build:
context: .
dockerfile: crates/deepmail-scoring/Dockerfile
environment:
- DEEPMAIL_SCORING_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_scoring
- DEEPMAIL_SCORING_GRPC_ADDR=0.0.0.0:50053
- DEEPMAIL_SCORING_NATS_URL=nats://nats:4222
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
ports:
- "50053:50053"
deepmail-report:
build:
context: .
dockerfile: crates/deepmail-report/Dockerfile
environment:
- DEEPMAIL_REPORT_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_report
- DEEPMAIL_REPORT_GRPC_ADDR=0.0.0.0:50054
depends_on:
postgres:
condition: service_healthy
ports:
- "50054:50054"
deepmail-ioc:
build:
context: .
dockerfile: crates/deepmail-ioc/Dockerfile
environment:
- DEEPMAIL_IOC_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_ioc
- DEEPMAIL_IOC_GRPC_ADDR=0.0.0.0:50055
depends_on:
postgres:
condition: service_healthy
ports:
- "50055:50055"
deepmail-graph:
build:
context: .
dockerfile: crates/deepmail-graph/Dockerfile
environment:
- DEEPMAIL_GRAPH_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_graph
- DEEPMAIL_GRAPH_GRPC_ADDR=0.0.0.0:50056
depends_on:
postgres:
condition: service_healthy
ports:
- "50056:50056"
deepmail-tenant:
build:
context: .
dockerfile: crates/deepmail-tenant/Dockerfile
environment:
- DEEPMAIL_TENANT_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_tenant
- DEEPMAIL_TENANT_GRPC_ADDR=0.0.0.0:50057
depends_on:
postgres:
condition: service_healthy
ports:
- "50057:50057"
deepmail-billing:
build:
context: .
dockerfile: crates/deepmail-billing/Dockerfile
environment:
- DEEPMAIL_BILLING_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_billing
- DEEPMAIL_BILLING_GRPC_ADDR=0.0.0.0:50058
depends_on:
postgres:
condition: service_healthy
ports:
- "50058:50058"
deepmail-notify:
build:
context: .
dockerfile: crates/deepmail-notify/Dockerfile
environment:
- DEEPMAIL_NOTIFY_DATABASE_URL=postgres://deepmail:${DB_PASSWORD:-deepmail_dev_password}@postgres:5432/deepmail_notify
- DEEPMAIL_NOTIFY_GRPC_ADDR=0.0.0.0:50059
- DEEPMAIL_NOTIFY_NATS_URL=nats://nats:4222
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
ports:
- "50059:50059"
deepmail-dashboard:
build:
context: .
dockerfile: deepmail-dashboard/Dockerfile
environment:
- NEXT_PUBLIC_API_URL=http://localhost:8080
- NODE_ENV=development
ports:
- "3000:3000"
depends_on:
- deepmail-gateway
volumes:
- deepmail-dashboard-node-modules:/app/node_modules
- ./deepmail-dashboard:/app
volumes:
postgres_data:
redis_data:
nats_data:
deepmail-dashboard-node-modules:
networks:
default:
name: deepmail-network