-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
115 lines (110 loc) · 3.08 KB
/
docker-compose.yml
File metadata and controls
115 lines (110 loc) · 3.08 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
# Load Testing Infrastructure for Replane
#
# Includes:
# - Replane + Postgres
# - Prometheus for metrics storage
# - Grafana for visualization
#
# Usage:
# Start infrastructure:
# docker compose up -d
#
# Run k6 tests (from repo root, requires k6 installed locally):
# pnpm bench
#
# View results:
# http://localhost:3001 (Grafana)
# http://localhost:9090 (Prometheus)
services:
# ===========================================
# Replane Services
# ===========================================
postgres:
image: postgres:17
environment:
POSTGRES_USER: replane
POSTGRES_PASSWORD: replane
POSTGRES_DB: replane
command:
- "postgres"
- "-c"
- "shared_buffers=256MB"
- "-c"
- "work_mem=16MB"
- "-c"
- "maintenance_work_mem=128MB"
- "-c"
- "max_connections=200"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U replane"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- replane-data-k6:/var/lib/postgresql/data
replane:
build:
context: ..
depends_on:
postgres:
condition: service_healthy
# replane shouldn't crash during the test
restart: no
ports:
- "8091:8080"
environment:
DATABASE_URL: postgres://replane:replane@postgres:5432/replane
BASE_URL: http://localhost:8091
SECRET_KEY: test-secret-key
SUPERUSER_API_KEY: ${REPLANE_SUPERADMIN_API_KEY}
PROMETHEUS_METRICS_ENABLED: "true"
DATABASE_MAX_CONNECTIONS: 100
LOG_LEVEL: info
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:8080/api/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
# ===========================================
# Metrics & Visualization
# ===========================================
prometheus:
image: prom/prometheus:v2.47.0
ports:
- "9090:9090"
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
# don't store data between runs
# - prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-remote-write-receiver'
- '--web.enable-lifecycle'
- '--enable-feature=native-histograms'
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 3
grafana:
image: grafana/grafana:10.2.0
ports:
- "3001:3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
GF_INSTALL_PLUGINS: grafana-k6-app
volumes:
- ./grafana/provisioning:/etc/grafana/provisioning:ro
- ./dashboards:/var/lib/grafana/dashboards:ro
- grafana-data:/var/lib/grafana
depends_on:
prometheus:
condition: service_healthy
volumes:
replane-data-k6:
prometheus-data:
grafana-data: