Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
4c69ad56
Commit
4c69ad56
authored
Mar 06, 2017
by
Troy Sankey
Committed by
GitHub
Mar 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3726 from edx/pwnage101/update-locust-role
sync the locust role with edx-load-tests
parents
2cda75a6
42457e57
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
79 deletions
+68
-79
playbooks/roles/locust/defaults/main.yml
+3
-11
playbooks/roles/locust/meta/main.yml
+0
-1
playbooks/roles/locust/tasks/main.yml
+49
-47
playbooks/roles/locust/templates/edx/app/supervisor/conf.d.available/locust.conf.j2
+0
-20
playbooks/roles/locust/templates/etc/motd.tail.locust.j2
+14
-0
playbooks/roles/locust/templates/locust_home/bash_aliases.j2
+2
-0
No files found.
playbooks/roles/locust/defaults/main.yml
View file @
4c69ad56
...
...
@@ -17,21 +17,13 @@
locust_service_name
:
"
locust"
locust_home
:
"
{{
COMMON_APP_DIR
}}/{{
locust_service_name
}}"
locust_user
:
"
locust"
locust_code_dir
:
"
{{
locust_home
}}/load-tests"
locust_requirements_base
:
"
{{
locust_code_dir
}}"
locust_requirements
:
-
"
requirements.txt"
locust_run_dir
:
"
{{
locust_code_dir
}}/{{
LOCUST_LOADTEST_DIR
}}"
locust_code_dir
:
"
{{
locust_home
}}/edx-load-tests"
locust_requirements_base
:
"
{{
locust_code_dir
}}/requirements"
LOCUST_GIT_IDENTITY
:
!!null
LOCUST_LOADTEST_REPO
:
'
load-tests'
LOCUST_LOADTEST_REPO
:
'
edx-
load-tests'
LOCUST_LOADTEST_REPO_VERSION
:
'
master'
LOCUST_LOADTEST_DIR
:
'
locust/lms'
LOCUST_MASTER
:
!!null
LOCUST_TARGET_HOST
:
'
http://localhost/'
LOCUST_SERVICE_CONFIG
:
'
'
...
...
playbooks/roles/locust/meta/main.yml
View file @
4c69ad56
...
...
@@ -12,7 +12,6 @@
#
dependencies
:
-
common
-
supervisor
-
role
:
edx_service
edx_service_name
:
"
{{
locust_service_name
}}"
edx_service_config
:
"
{{
LOCUST_SERVICE_CONFIG
}}"
...
...
playbooks/roles/locust/tasks/main.yml
View file @
4c69ad56
...
...
@@ -10,73 +10,75 @@
#
#
# Tasks for role locust
#
#
# Overview:
# - Expects a load-tests repo that declares locust.io as a requirement
# - Installs load-tests repo using standard edx service roles
# - configures locust with defaults in supervisor
# - Expects an edx-load-tests repo that declares locust.io as a requirement
# - Installs edx-load-tests repo using standard edx service roles
# - Makes the locust user suitable for running an interactive shell
# - Adds a MOTD message for self-help resources related to loadtesting
#
# Dependencies:
# - edx-service role
# - load tests repo with locust tests in it.
#
#
# Example play:
#
# # To run: ansible-playbook locust.yml -i "locust
master.sandbox.edx.org," -e "LOCUST_LOADTEST_DIR='locust/lms'" -e "LOCUST_TARGET_HOST='https://courses-loadtest.edx.org'
" -e "@/Users/derf/workspace/sandbox-secure/ansible/vars/developer-sandbox.yml"
# # To run: ansible-playbook locust.yml -i "locust
driver.sandbox.edx.org,
" -e "@/Users/derf/workspace/sandbox-secure/ansible/vars/developer-sandbox.yml"
# - name: Deploy Locust
# hosts: all
#
sudo
: True
#
become
: True
# gather_facts: True
# roles:
# - locust
-
name
:
Install system packages
apt
:
pkg
:
"
{{
item
}}"
state
:
"
present"
update_cache
:
true
cache_valid_time
:
3600
with_items
:
"
{{
locust_debian_pkgs
}}"
-
name
:
Install application requirements
-
name
:
Install base requirements used by all load tests
pip
:
requirements
:
"
{{
locust_requirements_base
}}/
{{
item
}}
"
requirements
:
"
{{
locust_requirements_base
}}/
base.txt
"
virtualenv
:
"
{{
locust_home
}}/venvs/{{
locust_service_name
}}"
state
:
present
become_user
:
"
{{
locust_user
}}"
with_items
:
"
{{
locust_requirements
}}"
-
name
:
Write supervisord config
template
:
src
:
"
edx/app/supervisor/conf.d.available/locust.conf.j2"
dest
:
"
{{
supervisor_available_dir
}}/{{
locust_service_name
}}.conf"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
common_web_user
}}"
mode
:
"
0644"
-
name
:
Enable supervisor script
file
:
src
:
"
{{
supervisor_available_dir
}}/{{
locust_service_name
}}.conf"
dest
:
"
{{
supervisor_cfg_dir
}}/{{
locust_service_name
}}.conf"
state
:
link
force
:
yes
when
:
not disable_edx_services
-
name
:
Update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
when
:
not disable_edx_services
-
name
:
Restart the applicaton
supervisorctl
:
name
:
"
{{
locust_service_name
}}"
state
:
restarted
supervisorctl_path
:
"
{{
supervisor_ctl
}}"
config
:
"
{{
supervisor_cfg
}}"
when
:
not disable_edx_services
become_user
:
"
{{
supervisor_service_user
}}"
# Specifically, we are concerned about allowing as many open connections as
# possible, to simulate more locust clients.
-
name
:
Increase file descriptor limit of the system (Session Logout and Login would be required)
lineinfile
:
dest
:
"
{{
ulimit_conf_file
}}"
line
:
"
{{
item.domain
}}
{{
item.type
}}
{{
item.item
}}
{{
item.value
}}"
with_items
:
"
{{
ulimit_config
}}"
-
name
:
Configure locust user with an interactive shell
user
:
name
:
"
{{
locust_user
}}"
shell
:
/bin/bash
# This is a hack because we're not using .bash_aliases for its stated purpose.
# As of this writing, the script will activate a preinstalled virtualenv and
# change to the edx-load-tests directory.
-
name
:
Hack .bash_aliases to make it more convenient to start loadtests
template
:
src
:
locust_home/bash_aliases.j2
dest
:
"
{{
locust_home
}}/.bash_aliases"
owner
:
"
{{
locust_user
}}"
group
:
root
mode
:
'
644'
-
name
:
Setup a loadtest-specific MOTD
template
:
src
:
etc/motd.tail.locust.j2
dest
:
/etc/motd.tail.locust
owner
:
root
group
:
root
mode
:
'
644'
# the directory /etc/update-motd.d is a xenial-ism only
when
:
ansible_distribution_release == 'xenial'
-
name
:
Add motd.tail.locust to update-motd.d
copy
:
dest
:
"
/etc/update-motd.d/76-motd-tail-locust"
content
:
"
#!/bin/sh
\n
echo
\n
cat
/etc/motd.tail.locust
\n
"
force
:
true
owner
:
root
group
:
root
mode
:
"
0755"
# the directory /etc/update-motd.d is a xenial-ism only
when
:
ansible_distribution_release == 'xenial'
playbooks/roles/locust/templates/edx/app/supervisor/conf.d.available/locust.conf.j2
deleted
100644 → 0
View file @
2cda75a6
#
# {{ ansible_managed }}
#
[program:{{ locust_service_name }}]
{% set locust_venv_bin = locust_home + "/venvs/" + locust_service_name + "/bin" %}
{% set executable = locust_venv_bin + '/locust' %}
{% if LOCUST_MASTER %}
{% set locust_extra_args = '--slave --master-host ' + LOCUST_MASTER %}
{% else %}
{% set locust_extra_args = '' %}
{% endif %}
command={{ executable }} --host {{ LOCUST_TARGET_HOST }} {{ locust_extra_args }}
user={{ common_web_user }}
directory={{ locust_run_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)-stderr.log
killasgroup=true
stopasgroup=true
playbooks/roles/locust/templates/etc/motd.tail.locust.j2
0 → 100644
View file @
4c69ad56
*******************************************************************
* Message regarding loadtests *
* *
* Start your loadtesting journey by switching to the locust user: *
* *
* sudo su locust *
* *
* Please consult the loadtest environment queue before running *
* load tests against our shared loadtest environment: *
* https://openedx.atlassian.net/wiki/x/B4M3AQ *
* *
* For troubleshooting or other help, see our documentation: *
* https://openedx.atlassian.net/wiki/x/-QEsAQ *
*******************************************************************
playbooks/roles/locust/templates/locust_home/bash_aliases.j2
0 → 100644
View file @
4c69ad56
cd {{ locust_code_dir }}
source {{ locust_home }}/venvs/{{ locust_service_name }}/bin/activate
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment