Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
98 lines (92 loc) · 2.99 KB
/
Copy pathdocker-compose.yml
File metadata and controls
98 lines (92 loc) · 2.99 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
name: slimybug
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: slimybug
POSTGRES_PASSWORD: slimybug
POSTGRES_DB: slimybug
volumes:
- ./services/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U slimybug -d slimybug"]
interval: 2s
timeout: 3s
retries: 20
toxiproxy:
image: ghcr.io/shopify/toxiproxy:2.9.0
ports:
- "8474:8474" # Toxiproxy control API
depends_on:
postgres:
condition: service_healthy
# The toxiproxy image is a bare Go binary with no shell/wget/curl, so it
# can't run a self-check command; toxiproxy-init polls it externally instead.
toxiproxy-init:
image: curlimages/curl:8.9.1
depends_on:
toxiproxy:
condition: service_started
restart: "no"
entrypoint: >
sh -c "
until curl -s -o /dev/null http://toxiproxy:8474/version; do sleep 1; done;
curl -s -X POST http://toxiproxy:8474/proxies
-H 'Content-Type: application/json'
-d '{\"name\":\"postgres\",\"listen\":\"0.0.0.0:5433\",\"upstream\":\"postgres:5432\"}'
|| true"
service-a:
build: ./services/service-a
environment:
SERVICE_B_URL: http://service-b:8000/work
HTTP_TIMEOUT: "2.0"
RETRY_POLICY: "${RETRY_POLICY:-none}"
RETRY_BACKOFF_MIN_MS: "50"
RETRY_BACKOFF_MAX_MS: "100"
BREAKER_ENABLED: "${BREAKER_ENABLED:-false}"
BREAKER_WINDOW_SIZE: "${BREAKER_WINDOW_SIZE:-20}"
ports:
- "8000:8000"
depends_on:
service-b:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz')"]
interval: 2s
timeout: 3s
retries: 20
service-b:
build: ./services/service-b
environment:
DB_HOST: toxiproxy
DB_PORT: "5433"
DB_USER: slimybug
DB_PASSWORD: slimybug
DB_NAME: slimybug
POOL_MIN_SIZE: "5"
POOL_MAX_SIZE: "${POOL_MAX_SIZE:-10}"
POOL_ACQUIRE_TIMEOUT: "2.0"
QUERY_TIMEOUT: "2.0"
ENABLE_ARRIVAL_TRACE: "${ENABLE_ARRIVAL_TRACE:-false}"
ADMISSION_CONTROL_ENABLED: "${ADMISSION_CONTROL_ENABLED:-false}"
ADMISSION_CONTROL_MODE: "${ADMISSION_CONTROL_MODE:-instantaneous}"
ADMISSION_EWMA_HALF_LIFE_S: "${ADMISSION_EWMA_HALF_LIFE_S:-2.0}"
ADMISSION_U_LOW: "${ADMISSION_U_LOW:-0.8}"
ADMISSION_GRACE_MS: "${ADMISSION_GRACE_MS:-20.0}"
ENABLE_ADMISSION_DECISION_TRACE: "${ENABLE_ADMISSION_DECISION_TRACE:-false}"
ports:
- "8001:8000"
depends_on:
toxiproxy-init:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz')"]
interval: 2s
timeout: 3s
retries: 20
loadgen:
build: ./services/loadgen
profiles: ["loadgen"]
depends_on:
service-a:
condition: service_healthy