-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
138 lines (131 loc) · 3.41 KB
/
docker-compose.test.yml
File metadata and controls
138 lines (131 loc) · 3.41 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
version: '3.8'
services:
# Postgres database (shared)
postgres:
image: postgres:16
container_name: postgres
environment:
- POSTGRES_USER=batch
- POSTGRES_PASSWORD=testtest
- POSTGRES_DB=batch
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U batch -d batch"]
interval: 10s
timeout: 5s
retries: 5
networks:
- batch-network
# Redis for caching and queuing
redis:
image: redis:7-alpine
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
volumes:
- redis_data:/data
networks:
- batch-network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
batch-api-test:
build:
context: .
dockerfile: Dockerfile
container_name: batch-api-test
ports:
- "8080:8080"
environment:
- PYTHONPATH=/app
- SQLALCHEMY_DATABASE_URI=postgresql+psycopg://batch:testtest@postgres:5432/batch
- REDIS_URL=redis://redis:6379
- MODEL_NAME=openai/gpt-4.1-nano
- OPENAI_API_BASE=https://api.openai.com/v1
- OPENAI_API_KEY=none
- MAX_WORKERS=15
- MAX_CONCURRENT_BATCHES=3
- TESTING=active
- UPLOAD_FOLDER=/tmp/batch_files
- BASIC_AUTH_USERNAME=test
- BASIC_AUTH_PASSWORD=test
- API_KEY=test
volumes:
- database_test_data:/app/src/database
- uploads_data:/tmp/batch_files
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
networks:
- batch-network
worker:
build:
context: .
dockerfile: Dockerfile.worker
# container_name removed to allow scaling
environment:
- PYTHONPATH=/app
- UPLOAD_FOLDER=/tmp/batch_files
- OPENAI_API_BASE=https://api.openai.com/v1
- SQLALCHEMY_DATABASE_URI=postgresql+psycopg://batch:testtest@postgres:5432/batch
- REDIS_URL=redis://redis:6379
- OPENAI_API_KEY=none
- TEST_API_KEY=${TEST_API_KEY}
- MAX_WORKERS=10
- TESTING=active
volumes:
- uploads_data:/tmp/batch_files
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
batch-api-test:
condition: service_healthy
networks:
- batch-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "python -c 'import redis; r=redis.Redis(host=\"redis\", port=6379); r.ping()'"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
tests:
build:
context: .
dockerfile: Dockerfile.test
container_name: batch-api-e2e-tests
working_dir: /app
volumes:
- ./:/app:ro
depends_on:
batch-api-test:
condition: service_healthy
worker:
condition: service_healthy
networks:
- batch-network
environment:
- PYTHONPATH=/app
- BASE_URL=http://batch-api-test:8080/v1
- MODEL_NAME=openai/gpt-4.1-nano
- OPENAI_API_BASE=https://api.openai.com/v1
- TESTING=active
- API_KEY_HEADER=test
command: ["pytest", "testing", "-v", "--color=yes"]
volumes:
database_test_data:
uploads_data:
postgres_data:
redis_data:
networks:
batch-network:
driver: bridge