Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication in UI #11

Merged
merged 53 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
5b3d919
Updated docs and config.
alfredeen Jan 10, 2024
8af2e1a
Small change to instructions.
alfredeen Jan 12, 2024
7dc91f1
Refactored into using abstract base user types. These are implemented…
alfredeen Jan 12, 2024
0b74393
Added an app viewer user
alfredeen Jan 12, 2024
8f96c6f
Work on login to Serve as test user.
alfredeen Jan 16, 2024
a180aeb
Completed authentication methods. Work on user type power user..
alfredeen Jan 16, 2024
991cbe1
Created non-locust module for opening user apps which created k8s pod…
alfredeen Jan 18, 2024
16c6066
More settings and configuration to customize the user app behaviour
alfredeen Jan 18, 2024
82e8720
Better handling of switching between test environments.
alfredeen Jan 19, 2024
8286b6a
Added task to register new user account.
alfredeen Jan 19, 2024
0855d6a
Began test plan classroom. Implemented power user create and delete u…
alfredeen Jan 22, 2024
0075962
Finished test plan classroom.
alfredeen Jan 22, 2024
3aad2da
Small change to readme to make configuration URL into a link.
alfredeen Feb 1, 2024
b4b3c42
Added config files for pre-commit and flake8.
alfredeen Feb 1, 2024
db19a75
Added github workflow pre-commit
alfredeen Feb 1, 2024
0ec1f15
Update source/tests-dev/appviewer_requestshtml.py
alfredeen Feb 1, 2024
01cc795
Update source/tests-dev/appviewer_requestshtml.py
alfredeen Feb 1, 2024
0d82d4c
Update source/tests-dev/appviewer_requestshtml.py
alfredeen Feb 1, 2024
b955402
Update source/tests-dev/authenticated.py
alfredeen Feb 1, 2024
12b8fc9
Moved code check config files up to root level.
alfredeen Feb 1, 2024
359a383
Reformatted with code linters and checkers
alfredeen Feb 1, 2024
36c5c7f
Reformatted imports with isort
alfredeen Feb 1, 2024
b67f157
Reformatted and code changes for the mypy type checker.
alfredeen Feb 1, 2024
626027c
Fixed end of line rules
alfredeen Feb 1, 2024
046cdad
Introduced the standard logging library. Converted most prints to log…
alfredeen Feb 1, 2024
c176ef8
Update source/tests/base_user_types.py
alfredeen Feb 2, 2024
b29ce3f
Update source/tests/base_user_types.py
alfredeen Feb 2, 2024
14e0035
Clearer setup instructions
alfredeen Feb 2, 2024
e1c10eb
Formatting
alfredeen Feb 2, 2024
ab83dc1
Formatting
alfredeen Feb 2, 2024
cc88b22
Updated test logic so sync with changes to Serve.
alfredeen Apr 17, 2024
2a1694a
Added Dockerfile and a start script.
alfredeen Apr 18, 2024
1961106
Added a CI github action
alfredeen Apr 18, 2024
af783a2
Pinned version of the Locust base image.
alfredeen Apr 18, 2024
e2ddd2c
Building source directory
alfredeen Apr 18, 2024
336342d
Adding a publish action
alfredeen Apr 19, 2024
c23bf74
Fixed formatting
alfredeen Apr 19, 2024
be975ee
Fixed formatting
alfredeen Apr 19, 2024
10e620d
Fixed formatting
alfredeen Apr 19, 2024
e75b8e1
Merge branch 'main' into develop
alfredeen Apr 19, 2024
bba9531
Fixed package name
alfredeen Apr 19, 2024
0a503bd
Merge branch 'develop' of https://github.com/ScilifelabDataCentre/ser…
alfredeen Apr 19, 2024
1d940bb
Merge branch 'main' into develop
alfredeen Apr 19, 2024
d778864
Fixed publish context
alfredeen Apr 19, 2024
c47dd19
Adjusted permissions in image
alfredeen Apr 19, 2024
b277ebc
Set start-script to locust
alfredeen Apr 19, 2024
6209559
Added k8s manifests
alfredeen Apr 19, 2024
f62ce3e
Added more k8s manifests
alfredeen Apr 22, 2024
85fd979
Creating resources in namespace locust. Added a cert manager for TLS.
alfredeen Apr 24, 2024
0d7ef4b
Added an ArgoCD application manifest file to create the ArgoCD app.
alfredeen Apr 24, 2024
f3f927f
Removed the ingress class name from the ingress.
alfredeen Apr 24, 2024
0b16b97
Fixed formatting
alfredeen Apr 25, 2024
4f4af04
Added basic auth to Locust web UI
alfredeen Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_NAME: scilifelabdatacentre/serve-load-testing
#IMAGE_NAME: ${{ github.repository }}

jobs:

Expand Down Expand Up @@ -55,7 +56,7 @@ jobs:
uses: docker/build-push-action@v3
with:
file: ./source/Dockerfile
context: .
context: ./source
push: true
build-args: version=${{ github.ref_name }}
tags: |
Expand Down
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
16 changes: 16 additions & 0 deletions argocd/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: serve-locust
spec:
destination:
namespace: locust
server: 'https://kubernetes.default.svc'
project: default
source:
repoURL: https://github.com/ScilifelabDataCentre/serve-load-testing
path: manifests
targetRevision: develop
syncPolicy:
syncOptions:
- CreateNamespace=true
22 changes: 22 additions & 0 deletions manifests/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: locust-deployment
namespace: locust
spec:
replicas: 1
selector:
matchLabels:
app: locust
template:
metadata:
labels:
app: locust
annotations:
statefulset.kubernetes.io/pod-name: locust
spec:
containers:
- name: locust
image: ghcr.io/scilifelabdatacentre/serve-load-testing:main-20240419-1108
ports:
- containerPort: 8089
28 changes: 28 additions & 0 deletions manifests/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: locust-ingress
namespace: locust
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
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: locust-service
port:
number: 80 #8089
#ingressClassName: nginx
tls:
- hosts:
- locust.serve-dev.scilifelab.se
secretName: locust-tls
4 changes: 4 additions & 0 deletions manifests/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: locust
13 changes: 13 additions & 0 deletions manifests/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: locust-service
namespace: locust
spec:
selector:
app: locust
ports:
- protocol: TCP
port: 80 #8089
targetPort: 8089
type: ClusterIP #NodePort
11 changes: 6 additions & 5 deletions source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ WORKDIR /home/locust
# TODO: pip install requirements without locust

# Copy the Locust files into the container
COPY locust-ui.conf locust.conf
COPY tests/ tests
COPY start-script.sh start-script.sh
COPY --chown=locust:locust locust-ui.conf locust.conf
COPY --chown=locust:locust tests/ tests
COPY --chown=locust:locust start-script.sh start-script.sh

# Expose the Locust web UI port
EXPOSE 8089
RUN chmod ug+x start-script.sh

EXPOSE 8089 5557
2 changes: 1 addition & 1 deletion source/start-script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

/home/locust/locust
locust
Loading