-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from base2Services/feature/locust-slave
Feature/locust slave
- Loading branch information
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: locust-distributed | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- feature/* | ||
paths: | ||
- 'locust-distributed/**' | ||
- .github/workflows/locust-distributed.yaml | ||
|
||
jobs: | ||
build-and-publish-latest: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Repository | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Container Image to GitHub Container Repository | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./locust-distributed | ||
push: true | ||
tags: ghcr.io/base2services/locust-distributed:snapshot_${{env.GITHUB_REF_SLUG}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM locustio/locust:2.23.1 | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/base2Services/build-containers | ||
|
||
USER root | ||
RUN pip install awscli faker | ||
|
||
WORKDIR /locust | ||
|
||
EXPOSE 8089 5557 5558 | ||
|
||
ENTRYPOINT [ "/entrypoint" ] | ||
|
||
CMD [ "locust" ] | ||
|
||
COPY docker-entrypoint.sh /entrypoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
aws s3 cp s3://${LOCUST_S3_PATH} /locust/ --recursive --region ${AWS_REGION} | ||
|
||
LOCUST_MODE=${LOCUST_MODE:-standalone} | ||
LOCUST_MASTER_BIND_PORT=${LOCUST_MASTER_BIND_PORT:-5557} | ||
LOCUST_FILE=${LOCUST_FILE:-locustfile.py} | ||
LOCUST_LOG_LEVEL=${LOCUST_LOG_LEVEL:-INFO} | ||
|
||
LOCUST_OPTS="-f ${LOCUST_FILE}" | ||
|
||
echo "Locust Mode: ${LOCUST_MODE}" | ||
|
||
if [ -z ${HOST_URL+x} ] ; then | ||
echo "No value set for (HOST_URL), falling back to host value in the locust class" | ||
else | ||
echo "(HOST_URL) set to ${HOST_URL}" | ||
LOCUST_OPTS="--host=${HOST_URL} $LOCUST_OPTS" | ||
fi | ||
|
||
case `echo ${LOCUST_MODE} | tr 'a-z' 'A-Z'` in | ||
"MASTER") | ||
LOCUST_OPTS="--master --master-bind-port=${LOCUST_MASTER_BIND_PORT} $LOCUST_OPTS" | ||
;; | ||
|
||
"WORKER") | ||
LOCUST_OPTS="--worker --master-host=${LOCUST_MASTER} --master-port=${LOCUST_MASTER_BIND_PORT} $LOCUST_OPTS" | ||
echo "Options: ${LOCUST_OPTS}" | ||
if [ -z ${LOCUST_MASTER+x} ] ; then | ||
echo "You need to set LOCUST_MASTER." | ||
exit 1 | ||
fi | ||
;; | ||
esac | ||
|
||
exec "$@" ${LOCUST_OPTS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters