-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstartup-master.yaml
More file actions
38 lines (36 loc) · 1.11 KB
/
startup-master.yaml
File metadata and controls
38 lines (36 loc) · 1.11 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
#cloud-config
runcmd:
- set -x
- apt update
- apt upgrade -y
- groupadd -f locust
- useradd -m locust -g locust || echo "user already exists"
- apt install -y htop emacs-nox wget iftop iotop python3-pip
- pip install locust
- echo '* - nofile 1000000' >> /etc/security/limits.conf
- echo '* - nproc 1000000' >> /etc/security/limits.conf
- echo ${LOCUST_FILE} | base64 -d | tee /home/locust/tasks.py
- chown -R locust:locust /home/locust
- |
cat <<EOF > /lib/systemd/system/locust-master.service
[Unit]
Description=Locust Service
Wants=network-online.target
Requires=network-online.target
After=network-online.target
[Service]
User=locust
Group=locust
Restart=always
ExecStart=/usr/local/bin/locust -f tasks.py --master --web-auth ${LOCUST_USERNAME}:${LOCUST_PASSWORD} ${LOCUST_TAGS}
WorkingDirectory=/home/locust
KillSignal=SIGKILL
SyslogIdentifier=locust
LimitNOFILE=1000000
LimitMEMLOCK=infinity
[Install]
WantedBy=multi-user.target
EOF
- systemctl daemon-reload
- systemctl enable locust-master
- systemctl restart locust-master