-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yaml
More file actions
436 lines (424 loc) · 13.1 KB
/
Copy pathdocker-compose.dev.yaml
File metadata and controls
436 lines (424 loc) · 13.1 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# =============================================================================
# Notetify — development stack
# -----------------------------------------------------------------------------
# Brings up the full local environment: Postgres, Redis, the Laravel API,
# the React client, the Hocuspocus collab hand-off (run separately), plus
# dev-only observability and storage tooling (Mailpit, Seq, RustFS,
# Pulse).
#
# Bring up: docker compose -f docker-compose.dev.yaml up --build
# Tear down: docker compose -f docker-compose.dev.yaml down
#
# All resource limits are conservative dev defaults — bump them if a service
# starts OOM-killing on your machine. They're applied via `deploy.resources`
# which Docker Compose v2 honours even outside of swarm.
# =============================================================================
services:
# ---------------------------------------------------------------------------
# db — Postgres
# Primary datastore. Holds users, notes (incl. content JSONB + ydoc_state
# BYTEA), tags, sessions. Source of truth for everything except live CRDT
# state in Hocuspocus memory.
# Reachable on host: localhost:5432
# ---------------------------------------------------------------------------
db:
image: postgres:18.1-alpine
container_name: notetify-db
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}", "-d", "${POSTGRES_DB:-notetify}"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
user: postgres
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_DATABASE:-notetify}
- POSTGRES_USER=${DB_USERNAME:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-postgres}
expose:
- 5432
ports:
- "5433:5432"
env_file:
- .env
deploy:
resources:
limits:
cpus: "1.5"
memory: 1g
reservations:
cpus: "0.25"
memory: 256m
# ---------------------------------------------------------------------------
# redis — Redis 8
# Multi-purpose: Laravel cache + sessions + queue + Pulse ingest +
# Hocuspocus pub/sub for SSE invalidation.
# Reachable on host: localhost:6379
# ---------------------------------------------------------------------------
redis:
image: redis:8.0.1-alpine
container_name: notetify-redis-cache
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
volumes:
- redis-data:/data
expose:
- 6379
ports:
- "6379:6379"
env_file:
- .env
deploy:
resources:
limits:
cpus: "0.5"
memory: 512m
reservations:
cpus: "0.1"
memory: 64m
# ---------------------------------------------------------------------------
# mailpit — SMTP catcher + web UI
# Catches every outgoing email from Laravel in dev (verification, password
# reset, etc.) so nothing actually leaves the machine.
# Web UI: http://localhost:8025
# SMTP in: mailpit:1025 (used by api MAIL_HOST)
# ---------------------------------------------------------------------------
mailpit:
image: axllent/mailpit:latest
container_name: notetify-mailpit
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8025/livez"]
interval: 15s
timeout: 5s
retries: 5
start_period: 5s
environment:
MP_MAX_MESSAGES: 5000
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
env_file:
- .env
ports:
- "1025:1025" # SMTP
- "8025:8025" # Web UI
deploy:
resources:
limits:
cpus: "0.25"
memory: 128m
reservations:
cpus: "0.05"
memory: 32m
# ---------------------------------------------------------------------------
# seq — structured log store + search UI
# Optional. Receives JSON logs from Laravel (configure via Monolog channel
# pointing at http://seq:5341/api/events/raw). Use for searching across
# api, pulse logs from one UI.
# Web UI: http://localhost:5341
# Ingest: http://seq:5341 (from inside the network)
# ---------------------------------------------------------------------------
seq:
image: datalust/seq:latest
container_name: notetify-seq
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost/health"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
environment:
ACCEPT_EULA: "Y"
SEQ_FIRSTRUN_NOAUTHENTICATION: "true"
env_file:
- .env
volumes:
- seq-data:/data
ports:
- "5341:80" # Web UI + ingest
deploy:
resources:
limits:
cpus: "0.5"
memory: 512m
reservations:
cpus: "0.05"
memory: 64m
# ---------------------------------------------------------------------------
# rustfs — S3-compatible object storage
# Holds note attachments (images, files dropped into the editor). Laravel's
# `rustfs` filesystem disk points here. Note bodies stay in Postgres; only
# binary attachments live here.
# S3 API: http://rustfs:9000 (used by api RUSTFS_ENDPOINT)
# Console: http://localhost:9001 (login: rustfs / rustfs-secret)
# ---------------------------------------------------------------------------
rustfs:
image: rustfs/rustfs:latest
container_name: notetify-rustfs
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9000/minio/health/live"]
interval: 15s
timeout: 5s
retries: 10
start_period: 10s
environment:
RUSTFS_ROOT_USER: rustfs
RUSTFS_ROOT_PASSWORD: rustfs-secret
RUSTFS_VOLUMES: /data
env_file:
- .env
volumes:
- rustfs-data:/data
ports:
- "9000:9000" # S3 API
- "9001:9001" # Console UI
deploy:
resources:
limits:
cpus: "1.0"
memory: 512m
reservations:
cpus: "0.1"
memory: 64m
# ---------------------------------------------------------------------------
# api — Laravel HTTP API (PHP-FPM + nginx in one image)
# Serves /api/*. Owns auth (Sanctum), notes/notebooks/tags CRUD, the collab
# JWT issuer, and the Hocuspocus persistence webhooks. Uses Postgres,
# Redis, RustFS, and Mailpit.
# API: http://localhost:8000
# API: http://localhost:8000/horizon
# Telescope: http://localhost:8000/telescope
# Pulse: http://localhost:8000/pulse
# ---------------------------------------------------------------------------
api:
build:
context: ./api
dockerfile: docker/Dockerfile
target: development
container_name: notetify-api
networks:
- notetify-net
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1/up"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
mailpit:
condition: service_started
rustfs:
condition: service_started
volumes:
- ./api:/app
- api_vendor:/app/vendor
- api_storage:/app/storage
ports:
- "8000:80"
environment:
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-5432}
- DB_DATABASE=${DB_DATABASE:-notetify}
- DB_USERNAME=${DB_USERNAME:-postgres}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- APP_ENV=${APP_ENV:-local}
- APP_DEBUG=${APP_DEBUG:-true}
- MAIL_MAILER=${MAIL_MAILER:-smtp}
- MAIL_HOST=${MAIL_HOST:-mailpit}
- MAIL_PORT=${MAIL_PORT:-1025}
- MAIL_USERNAME=${MAIL_USERNAME:-null}
- MAIL_PASSWORD=${MAIL_PASSWORD:-null}
- MAIL_ENCRYPTION=${MAIL_ENCRYPTION:-null}
- RUSTFS_ENDPOINT=${RUSTFS_ENDPOINT:-http://rustfs:9000}
- RUSTFS_KEY=${RUSTFS_KEY:-rustfs}
- RUSTFS_SECRET=${RUSTFS_SECRET:-rustfs-secret}
- RUSTFS_BUCKET=${RUSTFS_BUCKET:-notetify}
- RUSTFS_REGION=${RUSTFS_REGION:-us-east-1}
- RUSTFS_USE_PATH_STYLE_ENDPOINT=${RUSTFS_USE_PATH_STYLE_ENDPOINT:-true}
- FILESYSTEM_DISK=${FILESYSTEM_DISK:-rustfs}
- CLIENT_URL=${CLIENT_URL:-http://localhost:5173/}
env_file:
- .env
deploy:
resources:
limits:
cpus: "2.0"
memory: 1g
reservations:
cpus: "0.25"
memory: 256m
# ---------------------------------------------------------------------------
# pulse — Pulse aggregator
# Reuses the api image; runs `php artisan pulse:work` to ingest the
# sampled metrics Pulse buffers in Redis and write aggregates to Postgres.
# Dashboard is served by api at /pulse.
# ---------------------------------------------------------------------------
pulse:
image: notetify-api
container_name: notetify-pulse
networks:
- notetify-net
restart: unless-stopped
command: ["php", "artisan", "pulse:work"]
healthcheck:
test: ["CMD-SHELL", "pgrep -f 'pulse:work' > /dev/null"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
depends_on:
api:
condition: service_healthy
volumes:
- ./api:/app
- api_vendor:/app/vendor
- api_storage:/app/storage
environment:
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-5432}
- DB_DATABASE=${DB_DATABASE:-notetify}
- DB_USERNAME=${DB_USERNAME:-postgres}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- APP_ENV=${APP_ENV:-local}
env_file:
- .env
deploy:
resources:
limits:
cpus: "0.5"
memory: 256m
reservations:
cpus: "0.05"
memory: 64m
# ---------------------------------------------------------------------------
# horizon — Laravel Horizon queue worker + supervisor
# Reuses the api image; runs `php artisan horizon` which spawns and
# monitors the queue worker pool defined in config/horizon.php.
# Dashboard is served by api at /horizon.
# ---------------------------------------------------------------------------
horizon:
image: notetify-api
container_name: notetify-horizon
networks:
- notetify-net
restart: unless-stopped
command: ["php", "artisan", "horizon"]
stop_signal: SIGTERM
stop_grace_period: 30s
healthcheck:
test: ["CMD-SHELL", "pgrep -f 'artisan horizon' > /dev/null"]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
depends_on:
api:
condition: service_healthy
volumes:
- ./api:/app
- api_vendor:/app/vendor
- api_storage:/app/storage
environment:
- DB_HOST=${DB_HOST:-db}
- DB_PORT=${DB_PORT:-5432}
- DB_DATABASE=${DB_DATABASE:-notetify}
- DB_USERNAME=${DB_USERNAME:-postgres}
- REDIS_HOST=${REDIS_HOST:-redis}
- REDIS_PORT=${REDIS_PORT:-6379}
- APP_ENV=${APP_ENV:-local}
- QUEUE_CONNECTION=${QUEUE_CONNECTION:-redis}
env_file:
- .env
deploy:
resources:
limits:
cpus: "1.0"
memory: 512m
reservations:
cpus: "0.1"
memory: 128m
# ---------------------------------------------------------------------------
# client — Vite dev server (React + Tiptap)
# The user-facing SPA. Talks to api over HTTP and (later) to the
# Hocuspocus service over WS for collaborative editing.
# App: http://localhost:5173
# ---------------------------------------------------------------------------
client:
build:
context: ./client
dockerfile: docker/Dockerfile
target: development
container_name: notetify-client
networks:
- notetify-net
restart: unless-stopped
command: ["pnpm","dev"]
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://127.0.0.1:5173"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
depends_on:
api:
condition: service_healthy
volumes:
- ./client:/app
- node_modules:/app/node_modules
ports:
- "5173:5173"
environment:
- VITE_BASE_URL=${VITE_BASE_URL:-http://localhost:8000/api/}
- VITE_WS_ORIGIN=${VITE_WS_ORIGIN:-ws://localhost:1234}
- VITE_APP_NAME=${VITE_APP_NAME:-Notetify}
- VITE_CLIENT_URL=${VITE_CLIENT_URL:-http://localhost:5173/}
env_file:
- .env
stdin_open: true
tty: true
deploy:
resources:
limits:
cpus: "1.5"
memory: 1g
reservations:
cpus: "0.25"
memory: 256m
networks:
notetify-net:
driver: bridge
volumes:
redis-data:
db-data:
node_modules:
api_vendor:
api_storage:
rustfs-data:
seq-data: