Skip to content

Commit

Permalink
dockerize and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-wedensday committed Mar 20, 2024
1 parent cf8122e commit 8d97137
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
17 changes: 16 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,22 @@ services:
- /:/host:ro
networks:
- fast-api-network

locust-master:
image: locustio/locust
ports:
- "8089:8089" # Expose Locust's web interface on port 8089
volumes:
- ./loadtests:/mnt/locust # Mount the loadtests directory into the container
command: -f /mnt/locust --master -H http://app:"${SERVER_PORT}" # Start Locust in master mode, pointing to your FastAPI application
networks:
- fast-api-network
locust-worker:
image: locustio/locust
volumes:
- ./loadtests:/mnt/locust # Mount the loadtests directory into the container
command: -f /mnt/locust --worker --master-host locust-master
networks:
- fast-api-network
networks:
fast-api-network:
driver: bridge
Expand Down
8 changes: 8 additions & 0 deletions locust.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
locustfile = ./loadtests
headless = true
master = false
expect-workers = 5
host = http://0.0.0.0:8000
users = 100
spawn-rate = 10
run-time = 10m
2 changes: 1 addition & 1 deletion scripts/load_tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo "Running load tests"
echo
locust -f loadtests --headless --users 10 --spawn-rate 1 -t 2m -H http://0.0.0.0:8000
locust

0 comments on commit 8d97137

Please sign in to comment.