-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
303 lines (292 loc) · 9.42 KB
/
docker-compose.dev.yml
File metadata and controls
303 lines (292 loc) · 9.42 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# =============================================================================
# MailForge Development Docker Compose
# =============================================================================
#
# Usage:
# docker compose -f docker-compose.dev.yml up -d
# docker compose -f docker-compose.dev.yml logs -f
# docker compose -f docker-compose.dev.yml down
#
# Features:
# - Hot reload for API and Worker
# - MailHog for email testing (UI at http://localhost:8025)
# - Debug ports exposed
# - Volume mounts for source code
# - Lower resource limits
#
# =============================================================================
services:
# ===========================================================================
# PostgreSQL Database (Development)
# ===========================================================================
postgres:
image: postgres:16-alpine
container_name: opensend-postgres-dev
restart: unless-stopped
volumes:
- pgdata-dev:/var/lib/postgresql/data
- ./packages/shared/src/db/migrations:/docker-entrypoint-initdb.d/migrations:ro
- ./scripts/init-db.sh:/docker-entrypoint-initdb.d/01-init-db.sh:ro
environment:
POSTGRES_USER: opensend
POSTGRES_PASSWORD: opensend
POSTGRES_DB: opensend
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U opensend -d opensend"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
networks:
- opensend-dev
# ===========================================================================
# Redis (Development)
# ===========================================================================
redis:
image: redis:7-alpine
container_name: opensend-redis-dev
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- opensend-dev
# ===========================================================================
# MailHog - Email Testing (captures all outbound emails)
# ===========================================================================
mailhog:
image: mailhog/mailhog:latest
container_name: opensend-mailhog
restart: unless-stopped
ports:
- "1025:1025" # SMTP port
- "8025:8025" # Web UI
environment:
MH_STORAGE: memory
MH_SMTP_BIND_ADDR: 0.0.0.0:1025
MH_UI_BIND_ADDR: 0.0.0.0:8025
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8025"]
interval: 10s
timeout: 5s
retries: 3
networks:
- opensend-dev
labels:
- "com.opensend.service=mailhog"
- "com.opensend.description=Email testing UI at http://localhost:8025"
# ===========================================================================
# MailForge API Server (Development with hot reload)
# ===========================================================================
api:
build:
context: .
dockerfile: packages/api/Dockerfile
target: builder # Use builder stage for dev dependencies
container_name: opensend-api-dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
DATABASE_URL: postgres://opensend:opensend@postgres:5432/opensend
API_SECRET: dev-secret-change-in-production
API_PORT: 3000
API_HOST: 0.0.0.0
REDIS_URL: redis://redis:6379
NODE_ENV: development
LOG_LEVEL: debug
LOG_FORMAT: pretty
DEBUG: "true"
SKIP_DNS_VERIFICATION: "true"
TEST_MODE: "false"
# Lower rate limits for development
RATE_LIMIT_PER_MINUTE: 1000
RATE_LIMIT_PER_HOUR: 10000
RATE_LIMIT_PER_DAY: 100000
volumes:
# Mount source for hot reload
- ./packages/api/src:/app/packages/api/src:ro
- ./packages/shared/src:/app/packages/shared/src:ro
ports:
- "3000:3000"
- "9229:9229" # Node.js debugger port
command: ["bun", "run", "--watch", "packages/api/src/index.ts"]
networks:
- opensend-dev
labels:
- "com.opensend.service=api"
- "com.opensend.environment=development"
# ===========================================================================
# MailForge Background Worker (Development)
# ===========================================================================
worker:
build:
context: .
dockerfile: packages/worker/Dockerfile
target: builder
container_name: opensend-worker-dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
mailhog:
condition: service_healthy
environment:
DATABASE_URL: postgres://opensend:opensend@postgres:5432/opensend
REDIS_URL: redis://redis:6379
# Use MailHog instead of real SMTP
SMTP_HOST: mailhog
SMTP_PORT: 1025
WORKER_CONCURRENCY: 5
MAX_RETRIES: 3
RETRY_DELAY_MS: 1000
POLL_INTERVAL_MS: 2000
NODE_ENV: development
LOG_LEVEL: debug
volumes:
- ./packages/worker/src:/app/packages/worker/src:ro
- ./packages/shared/src:/app/packages/shared/src:ro
command: ["node", "--watch", "packages/worker/src/index.ts"]
networks:
- opensend-dev
labels:
- "com.opensend.service=worker"
- "com.opensend.environment=development"
# ===========================================================================
# Haraka SMTP Server (Development - for testing inbound)
# ===========================================================================
smtp:
build:
context: haraka
dockerfile: Dockerfile
container_name: opensend-smtp-dev
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
HARAKA_HOSTNAME: mail.localhost
DKIM_SELECTOR: opensend
MAILFORGE_API_URL: http://api:3000
DATABASE_URL: postgres://opensend:opensend@postgres:5432/opensend
NODE_ENV: development
HARAKA_LOG_LEVEL: debug
ports:
- "2525:25" # Non-privileged port for development
- "2587:587" # Submission port
volumes:
- ./haraka/config:/app/config:ro
- ./haraka/plugins:/app/plugins:ro
- ./keys:/app/keys:ro
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "25"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
networks:
- opensend-dev
labels:
- "com.opensend.service=smtp"
- "com.opensend.environment=development"
# ===========================================================================
# MCP Server (Development)
# ===========================================================================
mcp-server:
build:
context: .
dockerfile: packages/mcp-server/Dockerfile
target: builder
container_name: opensend-mcp-dev
restart: unless-stopped
depends_on:
api:
condition: service_healthy
environment:
MAILFORGE_API_URL: http://api:3000
MAILFORGE_API_KEY: mf_dev_test_key
MCP_PORT: 3001
MCP_HOST: 0.0.0.0
NODE_ENV: development
LOG_LEVEL: debug
volumes:
- ./packages/mcp-server/src:/app/packages/mcp-server/src:ro
- ./packages/shared/src:/app/packages/shared/src:ro
ports:
- "3001:3001"
networks:
- opensend-dev
labels:
- "com.opensend.service=mcp"
- "com.opensend.environment=development"
# ===========================================================================
# pgAdmin (Optional - Database GUI)
# ===========================================================================
pgadmin:
image: dpage/pgadmin4:latest
container_name: opensend-pgadmin
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
environment:
PGADMIN_DEFAULT_EMAIL: admin@opensend.dev
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: "False"
ports:
- "5050:80"
volumes:
- pgadmin-data:/var/lib/pgadmin
networks:
- opensend-dev
profiles:
- tools # Only start with: docker compose --profile tools up
labels:
- "com.opensend.service=pgadmin"
- "com.opensend.description=Database UI at http://localhost:5050"
# ===========================================================================
# Redis Commander (Optional - Redis GUI)
# ===========================================================================
redis-commander:
image: rediscommander/redis-commander:latest
container_name: opensend-redis-commander
restart: unless-stopped
depends_on:
redis:
condition: service_healthy
environment:
REDIS_HOSTS: local:redis:6379
ports:
- "8081:8081"
networks:
- opensend-dev
profiles:
- tools
labels:
- "com.opensend.service=redis-commander"
- "com.opensend.description=Redis UI at http://localhost:8081"
# =============================================================================
# Networks
# =============================================================================
networks:
opensend-dev:
driver: bridge
# =============================================================================
# Volumes
# =============================================================================
volumes:
pgdata-dev:
driver: local
pgadmin-data:
driver: local