forked from locustio/locust
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker_start.sh
More file actions
25 lines (19 loc) · 761 Bytes
/
docker_start.sh
File metadata and controls
25 lines (19 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env sh
if [ -z "${TARGET_URL}" ]; then
echo "ERROR: TARGET_URL not configured" >&2
exit 1
fi
LOCUST_MODE="${LOCUST_MODE:=standalone}"
_LOCUST_OPTS="-f ${LOCUSTFILE_PATH:-/locustfile.py} -H ${TARGET_URL}"
if [ "${LOCUST_MODE}" = "master" ]; then
_LOCUST_OPTS="${_LOCUST_OPTS} --master"
elif [ "${LOCUST_MODE}" = "worker" ]; then
if [ -z "${LOCUST_MASTER_HOST}" ]; then
echo "ERROR: MASTER_HOST is empty. Worker mode requires a master" >&2
exit 1
fi
_LOCUST_OPTS="${_LOCUST_OPTS} --worker --master-host=${LOCUST_MASTER_HOST} --master-port=${LOCUST_MASTER_PORT:-5557}"
fi
echo "Starting Locust in ${LOCUST_MODE} mode..."
echo "$ locust ${LOCUST_OPTS} ${_LOCUST_OPTS}"
exec locust ${LOCUST_OPTS} ${_LOCUST_OPTS}