Measure load-test and generate lighthouse analysis on your web application project.
1.8K
$ docker pull superelectron/loadtest-lighthouse:latest
$ docker run superelectron/loadtest-lighthouse:latest
/commerce
/scripts/ci
/code
code-quality.py
requirements.txt
test_script.py
README.md
docker-compose.yml
Dockerfile
/wwwroot
/some-project-files
docker-compose.yml
gitlab-ci.yml
Makefile
make_env filemake_env file.make_env can be empty, but it suggested to add in this:EXPORTS = exports.sh
VERSION = $$(date +%Y-%m-%d)
COMPANY_REPOSITORY = gitlab-registry-name
exports.sh file$ docker images
$ docker ps
docker images lines up with that of docker ps?$ docker exec -it <containerID> /bin/bash
bash-4.4# ls
bin code dev etc home lib media mnt opt proc root run sbin srv sys tmp usr var
/code.LOADTIME_THRESHOLD: integer seconds for maximum loading time of web page
POST_URL: path appended to URL (e.g. website.com/posts; /posts is POST URL)
AUTH_HEADER: HTTP authorization header
PAYLOAD_PATH: "/path/to/payload/file.json"
CI_ROOT: "/path/to/code-quality.py"
$ export LOADTIME_THRESHOLD=5
$ export POST_URL="api/cart/add-a-line/add"
$ export AUTH_HEADER="670306112c4a192a57afb8eb3959da58d98f5001e48952c7ac0fc9fddd0d5327"
$ export PAYLOAD_PATH="/code/add-a-line.json"
$ export CI_ROOT="/"
$ export HOST_ADDRESS="https//:www.your-url.com"
$ cd code
$ python -m code-quality
$ python -m test_script
Noteworthy Points
tail -f /dev/null is used in Dockerfile to keep container running. This can also be added into gitlab-ci under scripts so that you can debug the pipeline.Example:
$ docker run -t git.company-name.com:xxxx/commerce/loadtest-lighthouse
$ docker push git.company-name.com:xxxx/commerce/loadtest-lighthouse
$ docker ps from your command line.code-quality:
stage: post
allow_failure: true
image: [name of your gitlab-ci container registry name]
tags:
- Deploy # use a runner that can connect with the external world!
variables:
LOADTIME_THRESHOLD: 5
HOST_ADDRESS: "https//:www.your-url.com"
POST_URL: "url/to/post" # appends to HOST_ADDRESS
AUTH_HEADER: "some-auth-password"
PAYLOAD_PATH: "path/to/payload.json"
CI_ROOT: "/builds/gitlab-ci-project-root"
script:
- echo $LOADTIME_THRESHOLD
- echo "posting data to ---> $HOST_ADDRESS/$POST_URL"
- echo $PAYLOAD_PATH
- cd $CI_SCRIPTS
- python -m code-quality
artifacts:
untracked: false
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
- $CI_ROOT/lighthouse-reports.csv
keep tail -f /dev/null and when it hits that click debug
check to see if code-quality is setup: this will not pass if it isn't setup OR you may have a runner which cannot reach the external world!
if this fails, change your gitlab-ci setup to have something either than tags: runner3.
You can test the runner by trying curl www.google.ca after you open the debug terminal.
Content type
Image
Digest
Size
202 MB
Last updated
almost 7 years ago
docker pull superelectron/loadtest-lighthouse