Skip to content

Commit

Permalink
Added basic auth to Locust web UI
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredeen committed Apr 29, 2024
1 parent 0b16b97 commit 4f4af04
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Locust deployment
locust-auth

# Locust output files
source/reports/*
!source/reports/.gitkeep
Expand Down
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,33 @@ $ chmod +x run_test_plan.sh
$ ./run_test_plan.sh
```


## Use a custom built docker image

cd ./source

docker build -t serve-load-testing .

docker run -p 8089:8089 serve-load-testing

## Deploy to kubernetes

### Using ArgoCD

Create a new ArgoCD app using the application manifest ./argocd/application.yaml

### Using CLI kubectl

Create a deployment named locust-deployment in a new namespace locust:

kubectl apply -f ./manifests --force

### Create a secret for the Locust web UI

Create a secret named locust-ui-secret.
Required apache2-utils

sudo apt install apache2-utils

htpasswd -bc locust-auth locust <pwd>

kubectl -n locust create secret generic locust-ui-secret --from-file=locust-auth
3 changes: 3 additions & 0 deletions manifests/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-issuer"
nginx.ingress.kubernetes.io/auth-type: basic
nginx.ingress.kubernetes.io/auth-secret: locust-ui-secret
nginx.ingress.kubernetes.io/auth-realm: "Protected area"
spec:
rules:
- host: locust.serve-dev.scilifelab.se #localhost
Expand Down

0 comments on commit 4f4af04

Please sign in to comment.