Commit 93b21d05 by Feanil Patel

Merge pull request #234 from antoviaque/sandbox-ora

sandbox-ora: Include xqueue & ORA on the `edx_sandbox` playbook
parents 132dcb26 c14c8454
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
- nginx - nginx
- edxlocal - edxlocal
- edxapp - edxapp
- rabbitmq - { role: 'rabbitmq', rabbitmq_ip: '127.0.0.1' }
- { role: 'edxapp', celery_worker: True } - { role: 'edxapp', celery_worker: True }
- oraclejdk - oraclejdk
- elasticsearch - elasticsearch
...@@ -35,3 +35,13 @@ ...@@ -35,3 +35,13 @@
rbenv_user_home: "{{ forum_home }}" rbenv_user_home: "{{ forum_home }}"
rbenv_ruby_version: "{{ forum_ruby_version }}" rbenv_ruby_version: "{{ forum_ruby_version }}"
- forum - forum
- role: virtualenv
virtualenv_user: "{{ xqueue_user }}"
virtualenv_user_home: "{{ xqueue_user_home }}"
virtualenv_name: "{{ xqueue_user }}"
- { role: "xqueue", update_users: True }
- role: virtualenv
virtualenv_user: "{{ ora_user }}"
virtualenv_user_home: "{{ ora_user_home }}"
virtualenv_name: "{{ ora_user }}"
- role: ora
...@@ -23,7 +23,7 @@ edxapp_generic_auth_config: &edxapp_generic_auth ...@@ -23,7 +23,7 @@ edxapp_generic_auth_config: &edxapp_generic_auth
'basic_auth': [ 'edx', 'edx'] 'basic_auth': [ 'edx', 'edx']
'django_auth': { 'password': 'password', 'django_auth': { 'password': 'password',
'username': 'lms'} 'username': 'lms'}
'url': 'https://localhost:18040' 'url': 'http://localhost:18040'
'CONTENTSTORE': 'CONTENTSTORE':
'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore' 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore'
'OPTIONS': 'OPTIONS':
...@@ -59,7 +59,7 @@ edxapp_generic_auth_config: &edxapp_generic_auth ...@@ -59,7 +59,7 @@ edxapp_generic_auth_config: &edxapp_generic_auth
'PORT': '3306' 'PORT': '3306'
'PEARSON_TEST_PASSWORD': '' 'PEARSON_TEST_PASSWORD': ''
'OPEN_ENDED_GRADING_INTERFACE': 'OPEN_ENDED_GRADING_INTERFACE':
'url': 'http://localhost:18091' 'url': 'http://localhost:18091/'
'password': 'password' 'password': 'password'
'peer_grading': 'peer_grading' 'peer_grading': 'peer_grading'
'staff_grading': 'staff_grading' 'staff_grading': 'staff_grading'
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
# Do Post Checkout Tasks. # Do Post Checkout Tasks.
- name: ora | change permissions on ora code dir - name: ora | change permissions on ora code dir
file: path={{ora_code_dir}} state=directory owner=www-data group=www-data mode=755 recurse=yes file: path={{ora_code_dir}} state=directory owner={{ ora_user }} group={{ ora_user }} mode=755 recurse=yes
notify: notify:
- ora | restart edx-ora - ora | restart edx-ora
- ora | restart edx-ora-celery - ora | restart edx-ora-celery
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
- deploy - deploy
- name: ora | syncdb and migrate - name: ora | syncdb and migrate
shell: sudo -u www-data {{ora_venv_dir}}/bin/django-admin.py syncdb --migrate --noinput --settings=edx_ora.aws --pythonpath={{ora_code_dir}} shell: sudo -u {{ ora_user }} SERVICE_VARIANT=ora {{ora_venv_dir}}/bin/django-admin.py syncdb --migrate --noinput --settings=edx_ora.aws --pythonpath={{ora_code_dir}}
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
notify: notify:
- ora | restart edx-ora - ora | restart edx-ora
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
- deploy - deploy
- name: ora | create users - name: ora | create users
shell: sudo -u www-data {{ora_venv_dir}}/bin/django-admin.py update_users --settings=edx_ora.aws --pythonpath={{ora_code_dir}} shell: sudo -u {{ ora_user }} SERVICE_VARIANT=ora {{ora_venv_dir}}/bin/django-admin.py update_users --settings=edx_ora.aws --pythonpath={{ora_code_dir}}
notify: notify:
- ora | restart edx-ora - ora | restart edx-ora
- ora | restart edx-ora-celery - ora | restart edx-ora-celery
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
# Do Post Checkout Tasks. # Do Post Checkout Tasks.
- name: ora | change permissions on ease code dir - name: ora | change permissions on ease code dir
file: path={{ease_code_dir}} state=directory owner=www-data group=www-data mode=755 recurse=yes file: path={{ease_code_dir}} state=directory owner={{ ora_user }} group={{ ora_user }} mode=755 recurse=yes
tags: tags:
- ease - ease
- deploy - deploy
......
...@@ -3,13 +3,8 @@ ...@@ -3,13 +3,8 @@
# - common/tasks/main.yml # - common/tasks/main.yml
# - nginx/tasks/main.yml # - nginx/tasks/main.yml
--- ---
- name: ora | Change permissions on datadir
file: path={{ora_code_dir}}/../data state=directory owner=www-data group=www-data
tags:
- ora
- name: ora | Create ml_models directory - name: ora | Create ml_models directory
file: path={{ora_code_dir}}/../ml_models state=directory owner=www-data group=www-data file: path={{ora_code_dir}}/../ml_models state=directory owner={{ ora_user }} group={{ ora_user }}
tags: tags:
- ora - ora
...@@ -20,12 +15,12 @@ ...@@ -20,12 +15,12 @@
- ora - ora
- name: ora | create ora application config - name: ora | create ora application config
template: src=ora.env.json.j2 dest={{ora_code_dir}}/../env.json mode=0640 owner=www-data group=adm template: src=ora.env.json.j2 dest={{ora_code_dir}}/../ora.env.json mode=0640 owner={{ ora_user }} group=adm
tags: tags:
- ora - ora
- name: ora | create ora auth file - name: ora | create ora auth file
template: src=ora.auth.json.j2 dest={{ora_code_dir}}/../auth.json mode=0640 owner=www-data group=adm template: src=ora.auth.json.j2 dest={{ora_code_dir}}/../ora.auth.json mode=0640 owner={{ ora_user }} group=adm
tags: tags:
- ora - ora
...@@ -45,16 +40,6 @@ ...@@ -45,16 +40,6 @@
tags: tags:
- ora - ora
- name: ora | create the ora virtual environment
file: path={{ ora_venv_dir }} owner=root group=adm mode=2775 state=directory
tags:
- ora
- name: ora | bootstrap the ora virtual environment
command: /usr/local/bin/virtualenv {{ ora_venv_dir }} --distribute creates={{ora_venv_dir}}/bin/activate
tags:
- ora
# Install nginx site # Install nginx site
- include: ../../nginx/tasks/nginx_site.yml state=link site_name=ora - include: ../../nginx/tasks/nginx_site.yml state=link site_name=ora
......
...@@ -10,8 +10,9 @@ respawn ...@@ -10,8 +10,9 @@ respawn
respawn limit 3 30 respawn limit 3 30
env DJANGO_SETTINGS_MODULE=edx_ora.aws env DJANGO_SETTINGS_MODULE=edx_ora.aws
env SERVICE_VARIANT=ora
chdir {{ ora_code_dir }} chdir {{ ora_code_dir }}
setuid www-data setuid {{ ora_user }}
exec {{ ora_venv_dir }}/bin/python {{ ora_code_dir }}/manage.py celeryd --loglevel=info --settings=edx_ora.aws --pythonpath={{ ora_code_dir}} -B --autoscale=4,1 exec {{ ora_venv_dir }}/bin/python {{ ora_code_dir }}/manage.py celeryd --loglevel=info --settings=edx_ora.aws --pythonpath={{ ora_code_dir}} -B --autoscale=4,1
...@@ -14,11 +14,12 @@ env WORKERS={{ ora_gunicorn_workers }} ...@@ -14,11 +14,12 @@ env WORKERS={{ ora_gunicorn_workers }}
env PORT={{ ora_gunicorn_port }} env PORT={{ ora_gunicorn_port }}
env LANG=en_US.UTF-8 env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=edx_ora.aws env DJANGO_SETTINGS_MODULE=edx_ora.aws
env SERVICE_VARIANT=ora
pre-start script pre-start script
end script end script
chdir {{ ora_code_dir }} chdir {{ ora_code_dir }}
setuid www-data setuid {{ ora_user }}
exec {{ ora_venv_dir}}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=90 --pythonpath={{ ora_code_dir}} edx_ora.wsgi exec {{ ora_venv_dir}}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=90 --pythonpath={{ ora_code_dir}} edx_ora.wsgi
...@@ -4,8 +4,10 @@ ora_code_dir: "{{ app_base_dir }}/edx-ora" ...@@ -4,8 +4,10 @@ ora_code_dir: "{{ app_base_dir }}/edx-ora"
# Default nginx listen port # Default nginx listen port
# These should be overrided if you want # These should be overrided if you want
# to serve all content on port 80 # to serve all content on port 80
ora_venv_dir: "{{ venv_dir }}" ora_user: "edx-ora"
ease_venv_dir: "{{ venv_dir }}" ora_user_home: "/opt/edx-ora"
ora_venv_dir: "{{ ora_user_home }}/virtualenvs/{{ ora_user }}"
ease_venv_dir: "{{ ora_venv_dir }}"
ora_gunicorn_workers: 4 ora_gunicorn_workers: 4
ora_nginx_port: 18091 ora_nginx_port: 18091
ora_gunicorn_port: 8091 ora_gunicorn_port: 8091
......
RABBITMQ_NODE_PORT={{ rabbitmq_port }} RABBITMQ_NODE_PORT={{ rabbitmq_port }}
RABBITMQ_NODE_IP_ADDRESS={{ ansible_default_ipv4.address }} RABBITMQ_NODE_IP_ADDRESS={{ rabbitmq_ip }}
...@@ -14,12 +14,15 @@ rabbitmq_mnesia_folder: "{{rabbitmq_cookie_dir}}/mnesia" ...@@ -14,12 +14,15 @@ rabbitmq_mnesia_folder: "{{rabbitmq_cookie_dir}}/mnesia"
rabbitmq_port: 5672 rabbitmq_port: 5672
rabbitmq_management_port: 15672 rabbitmq_management_port: 15672
rabbitmq_ip: "{{ ansible_default_ipv4.address }}"
rabbitmq_auth_config: rabbitmq_auth_config:
erlang_cookie: "CHANGE ME" erlang_cookie: "CHANGE ME"
admin: admins:
- name: 'admin' - name: 'admin'
password: 'the example admin password' password: 'the example admin password'
- name: 'edx'
password: 'edx'
# If the system is running out of an Amazon Web Services # If the system is running out of an Amazon Web Services
# cloudformation stack, this group name can used to pull out # cloudformation stack, this group name can used to pull out
...@@ -29,4 +32,4 @@ rabbitmq_aws_stack_name: "tag_aws_cloudformation_stack-name_" ...@@ -29,4 +32,4 @@ rabbitmq_aws_stack_name: "tag_aws_cloudformation_stack-name_"
rabbitmq_clustered_hosts: [] rabbitmq_clustered_hosts: []
rabbitmq_plugins: rabbitmq_plugins:
- rabbitmq_management - rabbitmq_management
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
# Do Post Checkout Tasks. # Do Post Checkout Tasks.
- name: xqueue | create xqueue code dir - name: xqueue | create xqueue code dir
file: path={{xqueue_code_dir}} state=directory owner=www-data group=www-data mode=755 file: path={{xqueue_code_dir}} state=directory owner={{ xqueue_user }} group={{ xqueue_user }} mode=755
tags: tags:
- xqueue - xqueue
- deploy - deploy
...@@ -30,29 +30,29 @@ ...@@ -30,29 +30,29 @@
# portions of the deploy needs to be incorporated here. # portions of the deploy needs to be incorporated here.
- name: xqueue | sets permissions on xqueue code dir and contents - name: xqueue | sets permissions on xqueue code dir and contents
file: path={{xqueue_code_dir}} state=directory owner=www-data group=www-data recurse=yes file: path={{xqueue_code_dir}} state=directory owner={{ xqueue_user }} group={{ xqueue_user }} recurse=yes
# Post Checkout tasks will get run as handlers when the {{ xqueue_code_dir }} is ready. # Post Checkout tasks will get run as handlers when the {{ xqueue_code_dir }} is ready.
# Look at the handlers/main.yml in this role for a description of the tasks stated below. # Look at the handlers/main.yml in this role for a description of the tasks stated below.
tags: tags:
- xqueue - xqueue
- deploy - deploy
# Install the python pre requirements into {{ venv_dir }} # Install the python pre requirements into {{ xqueue_venv_dir }}
- name : install python pre-requirements - name : install python pre-requirements
pip: requirements="{{xqueue_pre_requirements_file}}" virtualenv="{{venv_dir}}" state=present pip: requirements="{{xqueue_pre_requirements_file}}" virtualenv="{{xqueue_venv_dir}}" state=present
tags: tags:
- xqueue - xqueue
- deploy - deploy
# Install the python post requirements into {{ venv_dir }} # Install the python post requirements into {{ xqueue_venv_dir }}
- name : install python post-requirements - name : install python post-requirements
pip: requirements="{{xqueue_post_requirements_file}}" virtualenv="{{venv_dir}}" state=present pip: requirements="{{xqueue_post_requirements_file}}" virtualenv="{{xqueue_venv_dir}}" state=present
tags: tags:
- xqueue - xqueue
- deploy - deploy
- name: xqueue | syncdb and migrate - name: xqueue | syncdb and migrate
shell: sudo -u www-data /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue shell: sudo -u {{ xqueue_user }} SERVICE_VARIANT=xqueue {{ xqueue_venv_dir }}/bin/django-admin.py syncdb --migrate --noinput --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
tags: tags:
- xqueue - xqueue
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
- deploy - deploy
- name: xqueue | create users - name: xqueue | create users
shell: sudo -u www-data /opt/edx/bin/django-admin.py update_users --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue shell: sudo -u {{ xqueue_user }} SERVICE_VARIANT=xqueue {{ xqueue_venv_dir }}/bin/django-admin.py update_users --settings=xqueue.aws_settings --pythonpath=/opt/wwc/xqueue
when: update_users is defined when: update_users is defined
tags: tags:
- xqueue - xqueue
......
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
# - common/tasks/main.yml # - common/tasks/main.yml
# - nginx/tasks/main.yml # - nginx/tasks/main.yml
--- ---
- name: xqueue | Change permissions on datadir
file: path={{app_base_dir}}/data state=directory owner=www-data group=www-data
tags:
- xqueue
# Check out xqueue repo to {{xqueue_code_dir}} # Check out xqueue repo to {{xqueue_code_dir}}
- name: xqueue | install git and its recommends - name: xqueue | install git and its recommends
apt: pkg=git state=present install_recommends=yes apt: pkg=git state=present install_recommends=yes
...@@ -30,9 +25,10 @@ ...@@ -30,9 +25,10 @@
login_password={{xqueue_auth_config.DATABASES.default.PASSWORD}} login_password={{xqueue_auth_config.DATABASES.default.PASSWORD}}
state=present state=present
encoding=utf8 encoding=utf8
when: xqueue_create_db is defined and xqueue_create_db|lower == "yes"
- name: xqueue | create xqueue application config - name: xqueue | 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}}/xqueue.env.json mode=0640 owner={{ xqueue_user }} group=adm
notify: notify:
- xqueue | restart xqueue - xqueue | restart xqueue
- xqueue | restart xqueue consumer - xqueue | restart xqueue consumer
...@@ -40,7 +36,7 @@ ...@@ -40,7 +36,7 @@
- xqueue - xqueue
- name: xqueue | create xqueue auth file - name: xqueue | 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}}/xqueue.auth.json mode=0640 owner={{ xqueue_user }} group=adm
notify: notify:
- xqueue | restart xqueue - xqueue | restart xqueue
- xqueue | restart xqueue consumer - xqueue | restart xqueue consumer
......
...@@ -7,7 +7,11 @@ respawn ...@@ -7,7 +7,11 @@ respawn
respawn limit 3 30 respawn limit 3 30
env PID=/var/tmp/xqueue.pid env PID=/var/tmp/xqueue.pid
env WORKERS={{ ansible_processor_cores * 2 }} {% if ansible_processor|length > 0 %}
env WORKERS={{ ansible_processor|length * 2 }}
{% else %}
env WORKERS=2
{% endif %}
env PORT={{ xqueue_gunicorn_port }} env PORT={{ xqueue_gunicorn_port }}
env LANG=en_US.UTF-8 env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=xqueue.aws_settings env DJANGO_SETTINGS_MODULE=xqueue.aws_settings
...@@ -15,6 +19,6 @@ env SERVICE_VARIANT="xqueue" ...@@ -15,6 +19,6 @@ env SERVICE_VARIANT="xqueue"
chdir {{ xqueue_code_dir }} chdir {{ xqueue_code_dir }}
setuid www-data setuid {{ xqueue_user }}
exec {{ venv_dir }}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=300 --pythonpath={{ xqueue_code_dir }} xqueue.wsgi exec {{ xqueue_venv_dir }}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=300 --pythonpath={{ xqueue_code_dir }} xqueue.wsgi
...@@ -11,7 +11,8 @@ respawn limit 3 30 ...@@ -11,7 +11,8 @@ respawn limit 3 30
env LANG=en_US.UTF-8 env LANG=en_US.UTF-8
env WORKERS_PER_QUEUE={{xqueue_env_config.XQUEUE_WORKERS_PER_QUEUE}} env WORKERS_PER_QUEUE={{xqueue_env_config.XQUEUE_WORKERS_PER_QUEUE}}
env SERVICE_VARIANT="xqueue"
chdir {{xqueue_code_dir}} chdir {{xqueue_code_dir}}
setuid www-data setuid {{ xqueue_user }}
exec {{venv_dir}}/bin/django-admin.py run_consumer --pythonpath={{xqueue_code_dir}} --settings=xqueue.aws_settings $WORKERS_PER_QUEUE exec {{xqueue_venv_dir}}/bin/django-admin.py run_consumer --pythonpath={{xqueue_code_dir}} --settings=xqueue.aws_settings $WORKERS_PER_QUEUE
...@@ -10,6 +10,10 @@ xqueue_code_dir: "{{ app_base_dir }}/xqueue" ...@@ -10,6 +10,10 @@ xqueue_code_dir: "{{ app_base_dir }}/xqueue"
xqueue_nginx_port: 18040 xqueue_nginx_port: 18040
xqueue_gunicorn_port: 8040 xqueue_gunicorn_port: 8040
xqueue_user: "xqueue"
xqueue_user_home: "/opt/xqueue"
xqueue_venv_dir: "{{ xqueue_user_home }}/virtualenvs/{{ xqueue_user }}"
xqueue_env_config: xqueue_env_config:
'XQUEUES': 'XQUEUES':
# push queue # push queue
...@@ -35,6 +39,7 @@ xqueue_auth_config: ...@@ -35,6 +39,7 @@ xqueue_auth_config:
'DATABASES': 'DATABASES':
'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'xqueue', 'USER': 'root', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '3306' } 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'xqueue', 'USER': 'root', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '3306' }
xqueue_create_db: 'yes'
xqueue_source_repo: https://github.com/edx/xqueue.git xqueue_source_repo: https://github.com/edx/xqueue.git
xqueue_version: 'HEAD' xqueue_version: 'HEAD'
xqueue_pre_requirements_file: "{{ xqueue_code_dir }}/pre-requirements.txt" xqueue_pre_requirements_file: "{{ xqueue_code_dir }}/pre-requirements.txt"
......
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