Repository navigation
Expand file tree
/
Copy pathload-test.yml
More file actions
84 lines (80 loc) · 2.77 KB
/
Copy pathload-test.yml
File metadata and controls
84 lines (80 loc) · 2.77 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
# Multi-replica load test.
#
# N catapulte replicas share Postgres (storage) and NATS (queue) and deliver to
# Mailpit; k6 drives POST /emails over the compose network, where Docker's
# round-robin DNS spreads connections across the replicas (so catapulte
# publishes no host port — that's what lets the service scale cleanly).
#
# Replica count is set by `deploy.replicas` on the catapulte service below — NOT
# a CLI `--scale`, because `docker compose run` resets a CLI scale back to the
# file default and would silently drop you to 1 replica mid-test.
#
# docker compose -f compose/load-test.yml up -d --build # 3 replicas
# docker compose -f compose/load-test.yml --profile loadgen run --rm \
# -e K6_MODE=fixed -e MAILPIT_URL=http://mailpit:8025 k6 # submit + verify delivery
# docker compose -f compose/load-test.yml down -v
#
# To change the replica count, edit deploy.replicas (re-run `up -d` to apply).
services:
catapulte:
build:
context: ..
environment:
- "CATAPULTE_HTTP_ADDRESS=0.0.0.0:3000"
- "CATAPULTE_STORAGE_BACKEND=postgres"
- "CATAPULTE_POSTGRES_URL=postgres://catapulte:catapulte@postgres:5432/catapulte"
- "CATAPULTE_QUEUE_BACKEND=nats"
- "CATAPULTE_QUEUE_URL=nats://nats:4222"
- "CATAPULTE_SENDERS=mailpit"
- "CATAPULTE_SENDER_MAILPIT_HOST=mailpit"
- "CATAPULTE_SENDER_MAILPIT_PORT=1025"
- "CATAPULTE_SENDER_MAILPIT_TLS=none"
- "CATAPULTE_ATTACHMENT_FS_ROOT=/data/attachments"
healthcheck:
test: ["CMD", "catapulte", "healthcheck"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
depends_on:
postgres:
condition: service_healthy
nats:
condition: service_started
mailpit:
condition: service_started
# Intrinsic replica count (survives `docker compose run`). No published
# port: replicas share the `catapulte` service name and k6 reaches them via
# the compose network's round-robin DNS.
deploy:
replicas: 3
postgres:
image: postgres:16-alpine
environment:
- "POSTGRES_USER=catapulte"
- "POSTGRES_PASSWORD=catapulte"
- "POSTGRES_DB=catapulte"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U catapulte"]
interval: 3s
timeout: 5s
retries: 10
nats:
image: nats:2.10-alpine
command: ["-js"]
mailpit:
image: axllent/mailpit
environment:
# Keep every message (default caps at 500) so delivered count is exact.
- "MP_MAX_MESSAGES=0"
ports:
- "8025:8025" # web UI + API (host-side delivery count)
k6:
image: grafana/k6:latest
profiles: ["loadgen"]
volumes:
- ./k6:/scripts:ro
command: ["run", "/scripts/load.js"]
depends_on:
catapulte:
condition: service_healthy