Commit a2e95ade by Carson Gee

Merge pull request #1349 from edx/cg/xqwatcher_fixes

Several fixes to xqwatcher role
parents 3e309126 f1a67e8e
...@@ -19,6 +19,7 @@ XQWATCHER_COURSES: ...@@ -19,6 +19,7 @@ XQWATCHER_COURSES:
- COURSE: "exampleX-101x" - COURSE: "exampleX-101x"
GIT_REPO: "git@github.com:foo/graders-exampleX-101x.git" GIT_REPO: "git@github.com:foo/graders-exampleX-101x.git"
GIT_REF: "master" GIT_REF: "master"
PYTHON_REQUIREMENTS: []
QUEUE_NAME: "exampleX-101x" QUEUE_NAME: "exampleX-101x"
QUEUE_CONFIG: QUEUE_CONFIG:
SERVER: "https://xqueue.example.com" SERVER: "https://xqueue.example.com"
...@@ -35,6 +36,7 @@ XQWATCHER_COURSES: ...@@ -35,6 +36,7 @@ XQWATCHER_COURSES:
- COURSE: "exampleX-202x" - COURSE: "exampleX-202x"
GIT_REPO: "git@github.com:foo/graders-exampleX-202x.git" GIT_REPO: "git@github.com:foo/graders-exampleX-202x.git"
GIT_REF: "master" GIT_REF: "master"
PYTHON_REQUIREMENTS: []
QUEUE_NAME: "exampleX-202x" QUEUE_NAME: "exampleX-202x"
QUEUE_CONFIG: QUEUE_CONFIG:
SERVER: "https://xqueue.example.com" SERVER: "https://xqueue.example.com"
...@@ -68,12 +70,11 @@ xqwatcher_user: "xqwatcher" ...@@ -68,12 +70,11 @@ xqwatcher_user: "xqwatcher"
xqwatcher_module: "xqueue_watcher" xqwatcher_module: "xqueue_watcher"
xqwatcher_app_dir: "{{ COMMON_APP_DIR }}/{{ xqwatcher_service_name }}" xqwatcher_app_dir: "{{ COMMON_APP_DIR }}/{{ xqwatcher_service_name }}"
xqwatcher_home: "{{ COMMON_APP_DIR }}/{{ xqwatcher_service_name }}" xqwatcher_app_data: "{{ xqwatcher_app_dir }}/data"
xqwatcher_venv_base: "{{ xqwatcher_home }}/venvs" xqwatcher_venv_base: "{{ xqwatcher_app_dir }}/venvs"
xqwatcher_venv_dir: "{{ xqwatcher_venv_base }}/{{ xqwatcher_service_name }}" xqwatcher_venv_dir: "{{ xqwatcher_venv_base }}/{{ xqwatcher_service_name }}"
xqwatcher_code_dir: "{{ xqwatcher_app_dir }}/src" xqwatcher_code_dir: "{{ xqwatcher_app_dir }}/src"
xqwatcher_conf_dir: "{{ xqwatcher_home }}" xqwatcher_conf_dir: "{{ xqwatcher_app_dir }}"
xqwatcher_data_dir: "{{ xqwatcher_home }}/data"
xqwatcher_source_repo: "git@{{ COMMON_GIT_MIRROR }}:edx/xqueue-watcher.git" xqwatcher_source_repo: "git@{{ COMMON_GIT_MIRROR }}:edx/xqueue-watcher.git"
xqwatcher_git_ssh_opts: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ xqwatcher_git_identity }}" xqwatcher_git_ssh_opts: "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ xqwatcher_git_identity }}"
...@@ -87,6 +88,7 @@ xqwatcher_log_dir: "{{ COMMON_LOG_DIR }}/{{ xqwatcher_service_name }}" ...@@ -87,6 +88,7 @@ xqwatcher_log_dir: "{{ COMMON_LOG_DIR }}/{{ xqwatcher_service_name }}"
# supervisor related config # supervisor related config
# #
xqwatcher_supervisor_app_dir: "{{ xqwatcher_app_dir }}/supervisor" xqwatcher_supervisor_app_dir: "{{ xqwatcher_app_dir }}/supervisor"
xqwatcher_supervisor_http_port: 9003
xqwatcher_supervisor_data_dir: "{{ COMMON_DATA_DIR }}/{{ xqwatcher_service_name }}" xqwatcher_supervisor_data_dir: "{{ COMMON_DATA_DIR }}/{{ xqwatcher_service_name }}"
xqwatcher_supervisor_log_dir: "{{ xqwatcher_log_dir }}" xqwatcher_supervisor_log_dir: "{{ xqwatcher_log_dir }}"
xqwatcher_supervisor_venv_dir: "{{ xqwatcher_venv_base }}/supervisor" xqwatcher_supervisor_venv_dir: "{{ xqwatcher_venv_base }}/supervisor"
......
...@@ -24,4 +24,4 @@ dependencies: ...@@ -24,4 +24,4 @@ dependencies:
supervisor_service_user: "{{ xqwatcher_supervisor_user }}" supervisor_service_user: "{{ xqwatcher_supervisor_user }}"
supervisor_available_dir: "{{ xqwatcher_supervisor_available_dir }}" supervisor_available_dir: "{{ xqwatcher_supervisor_available_dir }}"
supervisor_service: "supervisor.xqwatcher" supervisor_service: "supervisor.xqwatcher"
supervisor_http_bind_port: '9003' supervisor_http_bind_port: "{{ xqwatcher_supervisor_http_port }}"
...@@ -44,13 +44,13 @@ ...@@ -44,13 +44,13 @@
- name: write out requirements.txt - name: write out requirements.txt
template: > template: >
src=edx/app/xqwatcher/data/requirements.txt.j2 src=edx/app/xqwatcher/data/requirements.txt.j2
dest={{ xqwatcher_data_dir }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt dest={{ xqwatcher_app_data }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt
mode=0440 owner=root group=root mode=0440 owner=root group=root
with_items: XQWATCHER_COURSES with_items: XQWATCHER_COURSES
- name : install course specific python requirements - name : install course specific python requirements
pip: > pip: >
requirements="{{ xqwatcher_data_dir }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt" requirements="{{ xqwatcher_app_data }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt"
virtualenv="{{ xqwatcher_venv_base }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}" virtualenv="{{ xqwatcher_venv_base }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
state=present state=present
extra_args="{{ XQWATCHER_PIP_EXTRA_ARGS }}" extra_args="{{ XQWATCHER_PIP_EXTRA_ARGS }}"
...@@ -74,9 +74,10 @@ ...@@ -74,9 +74,10 @@
# environment where untrusted users can submit code # environment where untrusted users can submit code
- name: put code jail into aa-complain - name: put code jail into aa-complain
command: /usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}" command: /usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
when: CODE_JAIL_COMPLAIN when: CODE_JAIL_COMPLAIN|bool
with_items: XQWATCHER_COURSES with_items: XQWATCHER_COURSES
- name: put code sandbox into aa-enforce - name: put code sandbox into aa-enforce
command: /usr/sbin/aa-enforce "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}" command: /usr/sbin/aa-enforce "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
when: CODE_JAIL_COMPAIN is not defined | not CODE_JAIL_COMPLAIN when: not CODE_JAIL_COMPLAIN|bool
\ No newline at end of file with_items: XQWATCHER_COURSES
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- name: checkout grader code - name: checkout grader code
git: > git: >
dest={{ xqwatcher_data_dir }}/{{ item.COURSE }} repo={{ item.GIT_REPO }} dest={{ xqwatcher_app_data }}/{{ item.COURSE }} repo={{ item.GIT_REPO }}
version={{ item.GIT_REF }} version={{ item.GIT_REF }}
ssh_opts="{{ xqwatcher_git_ssh_opts }}" ssh_opts="{{ xqwatcher_git_ssh_opts }}"
with_items: XQWATCHER_COURSES with_items: XQWATCHER_COURSES
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
# - COURSE: "exampleX-101x" # - COURSE: "exampleX-101x"
# GIT_REPO: "git@github.com:foo/graders-exampleX-101x.git" # GIT_REPO: "git@github.com:foo/graders-exampleX-101x.git"
# GIT_REF: "master" # GIT_REF: "master"
# PYTHON_REQUIREMENTS: []
# QUEUE_NAME: "exampleX-101x" # QUEUE_NAME: "exampleX-101x"
# QUEUE_CONFIG: # QUEUE_CONFIG:
# SERVER: "https://xqueue.example.com" # SERVER: "https://xqueue.example.com"
...@@ -64,6 +65,7 @@ ...@@ -64,6 +65,7 @@
# - COURSE: "exampleX-202x" # - COURSE: "exampleX-202x"
# GIT_REPO: "git@github.com:foo/graders-exampleX-202x.git" # GIT_REPO: "git@github.com:foo/graders-exampleX-202x.git"
# GIT_REF: "master" # GIT_REF: "master"
# PYTHON_REQUIREMENTS: []
# QUEUE_NAME: "exampleX-202x" # QUEUE_NAME: "exampleX-202x"
# QUEUE_CONFIG: # QUEUE_CONFIG:
# SERVER: "https://xqueue.example.com" # SERVER: "https://xqueue.example.com"
...@@ -84,8 +86,6 @@ ...@@ -84,8 +86,6 @@
# -----END RSA PRIVATE KEY----- # -----END RSA PRIVATE KEY-----
# #
- include: code_jail.yml CODE_JAIL_COMPLAIN=false
- name: create conf dir - name: create conf dir
file: > file: >
path="{{ xqwatcher_conf_dir }}" path="{{ xqwatcher_conf_dir }}"
...@@ -100,4 +100,13 @@ ...@@ -100,4 +100,13 @@
owner="{{ xqwatcher_user }}" owner="{{ xqwatcher_user }}"
group="{{ xqwatcher_user }}" group="{{ xqwatcher_user }}"
- name: create app data dir
file: >
path="{{ xqwatcher_app_data }}"
state=directory
owner="{{ xqwatcher_user }}"
group="{{ xqwatcher_user }}"
- include: code_jail.yml CODE_JAIL_COMPLAIN=false
- include: deploy.yml tags=deploy - include: deploy.yml tags=deploy
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% set executable = xqwatcher_venv_dir + '/bin/python' %} {% set executable = xqwatcher_venv_dir + '/bin/python' %}
{% endif %} {% endif %}
[program:xqwatcher_service_name] [program:{{ xqwatcher_service_name }}]
command={{ executable }} -m {{ xqwatcher_module }} -d {{ xqwatcher_conf_dir }} command={{ executable }} -m {{ xqwatcher_module }} -d {{ xqwatcher_conf_dir }}
process_name=%(program_name)s process_name=%(program_name)s
user={{ xqwatcher_user }} user={{ xqwatcher_user }}
......
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