Commit e0293ffb by Xavier Antoviaque

supervisor-ora: Move ora from upstart to supervisord

parent 5b627096
...@@ -55,7 +55,7 @@ ORA_USERS: ...@@ -55,7 +55,7 @@ ORA_USERS:
ORA_XQUEUE_URL: "http://localhost:18040" ORA_XQUEUE_URL: "http://localhost:18040"
ORA_DJANGO_USERNAME: "lms" ORA_DJANGO_USER: "lms"
ORA_DJANGO_PASSWORD: "password" ORA_DJANGO_PASSWORD: "password"
ORA_URL: "http://localhost:18060" ORA_URL: "http://localhost:18060"
......
...@@ -13,14 +13,22 @@ ...@@ -13,14 +13,22 @@
# Stop ora service. # Stop ora service.
- name: ora | stop ora service - name: ora | stop ora service
service: name=edx-ora state=stopped supervisorctl: >
name=ora
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=stopped
when: ora_installed.stdout == 'Found' when: ora_installed.stdout == 'Found'
notify: ora | restart ora notify: ora | restart ora
tags: tags:
- deploy - deploy
- name: ora | stop ora_celery service - name: ora | stop ora_celery service
service: name=ora_celery state=stopped supervisorctl: >
name=ora_celery
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=stopped
when: ora_celery_installed.stdout == 'Found' when: ora_celery_installed.stdout == 'Found'
notify: ora | restart ora_celery notify: ora | restart ora_celery
tags: tags:
...@@ -40,15 +48,16 @@ ...@@ -40,15 +48,16 @@
tags: tags:
- deploy - deploy
- name: ora | create ora upstart script - name: ora | create supervisor scripts - ora, ora_celery
template: src=ora.conf.j2 dest=/etc/init/ora.conf template: >
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
with_items: ['ora', 'ora_celery']
tags: tags:
- deploy - deploy
- name: ora | create ora_celery upstart script - name: ora | reload supervisor to allow to start the new services
template: src=ora_celery.conf.j2 dest=/etc/init/ora_celery.conf shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} reload"
tags:
- deploy
# Do A Checkout # Do A Checkout
- name: ora | git checkout ora repo into {{ ora_app_dir }} - name: ora | git checkout ora repo into {{ ora_app_dir }}
......
# /etc/init/edx-ora.conf [program:ora]
description "edX ORA server" command={{ ora_venv_bin }}/gunicorn --preload -b {{ ora_gunicorn_host }}:{{ ora_gunicorn_port }} -w {{ ora_gunicorn_workers }} --timeout=90 --pythonpath={{ ora_code_dir}} edx_ora.wsgi
author "edx <info@edx.org>"
start on runlevel [2345] user={{ common_web_user }}
stop on runlevel [!2345] directory={{ ora_code_dir }}
respawn # TODO: Make LANG a configuration variable
respawn limit 3 30 environment=PID=/var/run/gunicorn/edx-ora.pid,WORKERS={{ ora_gunicorn_workers }},PORT={{ ora_gunicorn_port }},ADDRESS={{ ora_gunicorn_host }},LANG=en_US.UTF-8,DJANGO_SETTINGS_MODULE=edx_ora.aws,SERVICE_VARIANT=ora,NLTK_DATA={{ ora_nltk_data_dir }}
env PID=/var/run/gunicorn/edx-ora.pid stdout_logfile={{ supervisor_log_dir }}/%(program_name)-stdout.log
env WORKERS={{ ora_gunicorn_workers }} stderr_logfile={{ supervisor_log_dir }}/%(program_name)-stderr.log
env PORT={{ ora_gunicorn_port }}
env ADDRESS={{ ora_gunicorn_host }}
env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=edx_ora.aws
env SERVICE_VARIANT=ora
env NLTK_DATA={{ ora_nltk_data_dir }}
pre-start script
end script
chdir {{ ora_code_dir }}
setuid {{ ora_user }}
exec {{ ora_venv_dir}}/bin/gunicorn --preload -b $ADDRESS:$PORT -w $WORKERS --timeout=90 --pythonpath={{ ora_code_dir}} edx_ora.wsgi
#Celery task for edx-ora [program:ora_celery]
description "Celery grading controller" command={{ ora_venv_bin }}/python {{ ora_code_dir }}/manage.py celeryd --loglevel=info --settings=edx_ora.aws --pythonpath={{ ora_code_dir }} -B --autoscale=4,1
author "Vik Paruchuri <vik@edx.org>"
start on runlevel [2345] user={{ common_web_user }}
stop on runlevel [!2345] directory={{ ora_code_dir }}
respawn environment=DJANGO_SETTINGS_MODULE=edx_ora.aws,SERVICE_VARIANT=ora
respawn limit 3 30
env DJANGO_SETTINGS_MODULE=edx_ora.aws stdout_logfile={{ supervisor_log_dir }}/%(program_name)-stdout.log
env SERVICE_VARIANT=ora stderr_logfile={{ supervisor_log_dir }}/%(program_name)-stderr.log
chdir {{ ora_code_dir }}
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
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