-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (78 loc) · 1.99 KB
/
docker-compose.yml
File metadata and controls
82 lines (78 loc) · 1.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
services:
# PostgreSQL database for testing relational data operations
postgres:
image: postgres:15-alpine
container_name: api_perf_postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: api_performance
ports:
- "5432:5432"
volumes:
- ./databases/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
- postgres_data:/var/lib/postgresql/data
command: postgres -c max_connections=300
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
# Redis for caching and message queue
redis:
image: redis:7-alpine
container_name: api_perf_redis
ports:
- "6379:6379"
volumes:
- ./databases/redis/redis.conf:/usr/local/etc/redis/redis.conf
- redis_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# API application
api:
build:
context: ./api
dockerfile: Dockerfile
container_name: api_perf_app
ports:
- "8000:8000"
volumes:
- ./api:/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=api_performance
- REDIS_HOST=redis
- REDIS_PORT=6379
- DEBUG=False
- LOG_LEVEL=INFO
# Benchmark runner (optional, can also be run manually)
benchmarks:
build:
context: .
dockerfile: benchmarks/Dockerfile
container_name: api_perf_benchmark
volumes:
- ./benchmarks:/app
- ./api/techniques:/usr/local/lib/python3.10/site-packages/api/techniques
depends_on:
- api
environment:
- API_BASE_URL=http://api:8000
profiles:
- benchmarking
volumes:
postgres_data:
redis_data: