-
-
Notifications
You must be signed in to change notification settings - Fork 300
/
docker-compose-load-testing.yml
55 lines (49 loc) · 1.53 KB
/
docker-compose-load-testing.yml
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
# Do not run this file alone. Instead, run the following from the project root:
# docker compose -f docker-compose.yml -f ./load_testing/docker-compose-load-testing.yml up -d
version: '2.4'
services:
web:
command: sh -c 'python manage.py migrate && daphne -b 0.0.0.0 -p 3334 config.routing:application'
# Optimize performance for load testing
environment:
DEBUG: False
DATABASE_URL: postgres://postgres:postgres@%2fvar%2frun%2fpostgresql/postgres
# DATABASE_URL: sqlite:////tmp/db/db.sqlite3
# DATABASE_URL: postgres://postgres:postgres@db:5432/postgres
volumes:
- postgres_socket:/var/run/postgresql
- /tmp/db
locust:
image: locustio/locust
ports:
- "8089:8089"
volumes:
- ./load_testing:/load_testing
- ./backend:/backend
command: locust -f /load_testing/locustfile.py -H http://web:3334 -u 100 -r 1
depends_on:
- web
locust_ml:
image: locustio/locust
ports:
- "8099:8089"
volumes:
- ./load_testing:/load_testing
- ./backend:/backend
command: locust -f /load_testing/locustfile_ml_api.py -H http://ml_api:3333 -u 1 -r 1
depends_on:
- web
db:
image: postgres:10-alpine
restart: unless-stopped
shm_size: 512MB
command: -c max_connections=500
expose:
- 5432
environment:
POSTGRES_PASSWORD: postgres
volumes:
- postgres_socket:/var/run/postgresql
- /var/lib/postgresql/data/ # Anonyumous volume gets removed on `docker compose down -v`
volumes:
postgres_socket: