diff --git a/docker-image/Dockerfile b/docker-image/Dockerfile index 230756a..5b66ddc 100644 --- a/docker-image/Dockerfile +++ b/docker-image/Dockerfile @@ -13,8 +13,8 @@ # limitations under the License. -# Start with a base Python 3.7.2 image -FROM python:3.7.2 +# Start with a base Python 3.8.2 image +FROM python:3.8.2 # Add the licenses for third party software and libraries ADD licenses /licenses @@ -26,10 +26,10 @@ ADD locust-tasks /locust-tasks RUN pip install -r /locust-tasks/requirements.txt # Expose the required Locust ports -EXPOSE 5557 5558 8089 +EXPOSE 5557 8089 # Set script to be executable RUN chmod 755 /locust-tasks/run.sh # Start Locust using LOCUS_OPTS environment variable -ENTRYPOINT ["/locust-tasks/run.sh"] +ENTRYPOINT ["/locust-tasks/run.sh"] diff --git a/docker-image/locust-tasks/requirements.txt b/docker-image/locust-tasks/requirements.txt index 14c17cf..1f758c1 100644 --- a/docker-image/locust-tasks/requirements.txt +++ b/docker-image/locust-tasks/requirements.txt @@ -2,17 +2,16 @@ certifi==2019.3.9 chardet==3.0.4 Click==7.0 Flask==1.0.2 -gevent==1.4.0 +gevent==1.5a3 greenlet==0.4.15 idna==2.8 itsdangerous==1.1.0 Jinja2==2.10.1 -locustio==0.11.0 +locustio==0.14.5 MarkupSafe==1.1.1 -msgpack==0.6.1 -msgpack-python==0.5.6 +msgpack==1.0.0 pyzmq==18.0.1 requests==2.21.0 six==1.12.0 urllib3==1.24.2 -Werkzeug==0.15.1 +Werkzeug==0.15.5 diff --git a/docker-image/locust-tasks/run.sh b/docker-image/locust-tasks/run.sh index ba5f684..4693cc0 100644 --- a/docker-image/locust-tasks/run.sh +++ b/docker-image/locust-tasks/run.sh @@ -22,9 +22,9 @@ LOCUST_MODE=${LOCUST_MODE:-standalone} if [[ "$LOCUST_MODE" = "master" ]]; then LOCUS_OPTS="$LOCUS_OPTS --master" elif [[ "$LOCUST_MODE" = "worker" ]]; then - LOCUS_OPTS="$LOCUS_OPTS --slave --master-host=$LOCUST_MASTER" + LOCUS_OPTS="$LOCUS_OPTS --slave --master-host=$LOCUST_MASTER_HOST" fi echo "$LOCUST $LOCUS_OPTS" -$LOCUST $LOCUS_OPTS \ No newline at end of file +$LOCUST $LOCUS_OPTS diff --git a/docker-image/locust-tasks/tasks.py b/docker-image/locust-tasks/tasks.py index 6e6fc55..05df230 100644 --- a/docker-image/locust-tasks/tasks.py +++ b/docker-image/locust-tasks/tasks.py @@ -18,7 +18,7 @@ import uuid from datetime import datetime -from locust import HttpLocust, TaskSet, task +from locust import HttpLocust, TaskSet, task, between class MetricsTaskSet(TaskSet): @@ -39,4 +39,5 @@ def post_metrics(self): class MetricsLocust(HttpLocust): - task_set = MetricsTaskSet \ No newline at end of file + task_set = MetricsTaskSet + wait_time = between(5, 10) diff --git a/kubernetes-config/locust-master-controller.yaml b/kubernetes-config/locust-master-controller.yaml index 63466f1..dc9cdf1 100644 --- a/kubernetes-config/locust-master-controller.yaml +++ b/kubernetes-config/locust-master-controller.yaml @@ -44,6 +44,4 @@ spec: - name: loc-master-p1 containerPort: 5557 protocol: TCP - - name: loc-master-p2 - containerPort: 5558 - protocol: TCP + enableServiceLinks: false diff --git a/kubernetes-config/locust-worker-controller.yaml b/kubernetes-config/locust-worker-controller.yaml index 7c1a682..30b4d72 100644 --- a/kubernetes-config/locust-worker-controller.yaml +++ b/kubernetes-config/locust-worker-controller.yaml @@ -34,7 +34,8 @@ spec: env: - name: LOCUST_MODE value: worker - - name: LOCUST_MASTER + - name: LOCUST_MASTER_HOST value: locust-master - name: TARGET_HOST value: https://[TARGET_HOST] + enableServiceLinks: false diff --git a/sample-webapp/.gcloudignore b/sample-webapp/.gcloudignore new file mode 100644 index 0000000..a987f11 --- /dev/null +++ b/sample-webapp/.gcloudignore @@ -0,0 +1,19 @@ +# This file specifies files that are *not* uploaded to Google Cloud Platform +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Python pycache: +__pycache__/ +# Ignored by the build system +/setup.cfg \ No newline at end of file