Commit ea9806d4 by Feanil Patel

Merge pull request #150 from edx/feanil/ansible_grader_testing

Get end to end grader testing working.
parents cc176620 fd7322c3
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
- hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_edxapp - hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_edxapp
sudo: True sudo: True
vars_files: vars_files:
- "{{ secure_dir }}/vars/edxapp_continuous_integration_vars.yml" - "{{ secure_dir }}/vars/edx_continuous_integration_vars.yml"
- "{{ secure_dir }}/vars/users.yml" - "{{ secure_dir }}/vars/users.yml"
roles: roles:
- common - common
...@@ -12,19 +12,27 @@ ...@@ -12,19 +12,27 @@
- hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_xserver - hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_xserver
sudo: True sudo: True
vars_files: vars_files:
- "{{ secure_dir }}/vars/edxapp_continuous_integration_vars.yml" - "{{ secure_dir }}/vars/edx_continuous_integration_vars.yml"
- "{{ secure_dir }}/vars/users.yml" - "{{ secure_dir }}/vars/users.yml"
roles: roles:
- common - common
- nginx - nginx
- xserver - xserver
- hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_rabbitmq - hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_rabbitmq
serial: 1 serial: 1
sudo: True sudo: True
vars_files: vars_files:
- "{{ secure_dir }}/vars/edxapp_continuous_integration_vars.yml" - "{{ secure_dir }}/vars/edx_continuous_integration_vars.yml"
- "{{ secure_dir }}/vars/users.yml" - "{{ secure_dir }}/vars/users.yml"
roles: roles:
- common - common
- rabbitmq - rabbitmq
- hosts: tag_aws_cloudformation_stack-name_feanilpractice:&tag_group_xqueue
sudo: True
vars_files:
- "{{ secure_dir }}/vars/edx_continuous_integration_vars.yml"
- "{{ secure_dir }}/vars/users.yml"
roles:
- common
- nginx
- xqueue
...@@ -62,3 +62,8 @@ ...@@ -62,3 +62,8 @@
- nginx - nginx
- update - update
# If tasks that notify restart nginx don't change the state of the remote system
# their corresponding notifications don't get run. If nginx has been stopped for
# any reason, this will ensure that it is started up again.
- name: make sure nginx has started
service: name=nginx state=started
...@@ -20,6 +20,16 @@ server { ...@@ -20,6 +20,16 @@ server {
proxy_pass http://lms-xml-backend; proxy_pass http://lms-xml-backend;
} }
location @proxy_to_lms-xml_app {
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://lms-xml-backend;
}
location / { location / {
try_files $uri @proxy_to_lms-xml_app; try_files $uri @proxy_to_lms-xml_app;
} }
......
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
rabbitmq_user: user="guest" state=absent rabbitmq_user: user="guest" state=absent
- name: add admin users - name: add admin users
rabbitmq_user: user='{{item.name}}' password='{{item.password}}' tags="administrator" state=present rabbitmq_user: >
user='{{item.name}}'
password='{{item.password}}'
read_priv='.*'
write_priv='.*'
configure_priv='.*'
tags="administrator"
state=present
with_items: rabbitmq_auth_config.admins with_items: rabbitmq_auth_config.admins
when: "'admins' in rabbitmq_auth_config" when: "'admins' in rabbitmq_auth_config"
...@@ -15,3 +15,6 @@ ...@@ -15,3 +15,6 @@
tags: tags:
- xqueue - xqueue
- deploy - deploy
- name: restart xqueue consumer
service: name=xqueue_consumer state=restarted
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
- xqueue - xqueue
- deploy - deploy
- name: stop xqueue consumer service
service: name=xqueue_consumer state=stopped
tags:
- xqueue
- deploy
# Do A Checkout # Do A Checkout
- name: git checkout xqueue repo into $app_base_dir - name: git checkout xqueue repo into $app_base_dir
git: dest={{xqueue_code_dir}} repo={{xqueue_source_repo}} version={{xqueue_version}} git: dest={{xqueue_code_dir}} repo={{xqueue_source_repo}} version={{xqueue_version}}
...@@ -53,6 +59,14 @@ ...@@ -53,6 +59,14 @@
- syncdb - syncdb
- deploy - deploy
- name: create users
shell: sudo -u www-data /opt/edx/bin/django-admin.py update_users --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue
when: update_users is defined
tags:
- xqueue
- syncdb
- deploy
- name: stop xqueue - name: stop xqueue
service: name=xqueue state=stopped service: name=xqueue state=stopped
tags: tags:
...@@ -64,3 +78,9 @@ ...@@ -64,3 +78,9 @@
tags: tags:
- xqueue - xqueue
- deploy - deploy
- name: start xqueue consumer
service: name=xqueue_consumer state=started
tags:
- xqueue
- deploy
...@@ -8,30 +8,56 @@ ...@@ -8,30 +8,56 @@
tags: tags:
- xqueue - xqueue
- name: create xqueue db
mysql_db: >
name={{xqueue_auth_config.DATABASES.default.NAME}}
login_host={{xqueue_auth_config.DATABASES.default.HOST}}
login_user={{xqueue_auth_config.DATABASES.default.USER}}
login_password={{xqueue_auth_config.DATABASES.default.PASSWORD}}
state=present
encoding=utf8
# Check out xqueue repo to $app_base_dir # Check out xqueue repo to $app_base_dir
- name: install git and its recommends - name: install git and its recommends
apt: pkg=git state=present install_recommends=yes apt: pkg=git state=present install_recommends=yes
tags: tags:
- xqueue - xqueue
- name: install a bunch of system packages on which LMS and CMS rely - name: install a bunch of system packages on which xqueue relies
apt: pkg={{item}} state=present apt: pkg={{','.join(xqueue_debian_pkgs)}} state=present
with_items: xqueue_debian_pkgs notify:
- restart xqueue
- restart xqueue consumer
tags: tags:
- xqueue - xqueue
- name: create xqueue application config - name: create xqueue application config
template: src=xqueue.env.json.j2 dest=$app_base_dir/env.json mode=0640 owner=www-data group=adm template: src=xqueue.env.json.j2 dest=$app_base_dir/env.json mode=0640 owner=www-data group=adm
notify:
- restart xqueue
- restart xqueue consumer
tags: tags:
- xqueue - xqueue
- name: create xqueue auth file - name: create xqueue auth file
template: src=xqueue.auth.json.j2 dest=$app_base_dir/auth.json mode=0640 owner=www-data group=adm template: src=xqueue.auth.json.j2 dest=$app_base_dir/auth.json mode=0640 owner=www-data group=adm
notify:
- restart xqueue
- restart xqueue consumer
tags: tags:
- xqueue - xqueue
- name: creating xqueue upstart script - name: creating xqueue upstart script
template: src=xqueue.conf.j2 dest=/etc/init/xqueue.conf mode=0640 owner=root group=adm template: src=xqueue.conf.j2 dest=/etc/init/xqueue.conf mode=0640 owner=root group=adm
notify:
- restart xqueue
tags:
- xqueue
- name: create xqueue consumer upstart script
template: src=xqueue_consumer.conf.j2 dest=/etc/init/xqueue_consumer.conf mode=0640 owner=root group=adm
notify:
- restart xqueue consumer
tags: tags:
- xqueue - xqueue
......
# gunicorn
description "xqueue server"
author "devops <devops@edx.org>"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 3 30
env LANG=en_US.UTF-8
env WORKERS_PER_QUEUE={{xqueue_env_config.XQUEUE_WORKERS_PER_QUEUE}}
chdir {{xqueue_code_dir}}
setuid www-data
exec {{venv_dir}}/bin/django-admin.py run_consumer --pythonpath={{xqueue_code_dir}} --settings=xqueue.aws_settings $WORKERS_PER_QUEUE
...@@ -116,3 +116,5 @@ xqueue_debian_pkgs: ...@@ -116,3 +116,5 @@ xqueue_debian_pkgs:
- yui-compressor - yui-compressor
- zip - zip
- zlib1g-dev - zlib1g-dev
# Needed to be able to create the xqueue mysqldb.
- python-mysqldb
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
- name: create sandbox python directory - name: create sandbox python directory
file: path={{ xserver_sandbox_venv_dir }} owner=ubuntu group=adm mode=2775 state=directory file: path={{ xserver_sandbox_venv_dir }} owner=ubuntu group=adm mode=2775 state=directory
- name: create sandbox sudoers file
template: src=99-sandbox.j2 dest=/etc/sudoers.d/99-sandbox owner=root group=root mode=0440
- name: create sandbox python - name: create sandbox python
command: /usr/local/bin/virtualenv {{ xserver_sandbox_venv_dir }} --distribute creates={{ xserver_sandbox_venv_dir }}/bin/activate command: /usr/local/bin/virtualenv {{ xserver_sandbox_venv_dir }} --distribute creates={{ xserver_sandbox_venv_dir }}/bin/activate
......
www-data ALL=(sandbox) NOPASSWD:{{xserver_sandbox_venv_dir}}/bin/python
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment