Commit bde390b9 by John Jarvis

adding the xqueue role

parent cfa65e31
#!/bin/sh
exec /usr/bin/ssh -o StrictHostKeyChecking=no -i /etc/git-identity "$@"
---
- name: invoke all deploy handlers
shell: echo "running deploy handlers"
notify:
- install python pre-requirements
- install python post-requirements
- syncdb and migrate
- stop xqueue
- start xqueue
tags:
- xqueue
- deploy
# Install the python pre requirements into {{ venv_dir }}
- name : install python pre-requirements
pip: requirements="{{xqueue.pre_requirements_file}}" virtualenv="{{venv_dir}}" state=present
tags:
- xqueue
# Install the python post requirements into {{ venv_dir }}
- name : install python post-requirements
pip: requirements="{{xqueue.post_requirements_file}}" virtualenv="{{venv_dir}}" state=present
tags:
- xqueue
- name: 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
when: migrate_db is defined
tags:
- xqueue
- syncdb
- name: stop xqueue
service: name=xqueue state=stopped
tags:
- xqueue
- deploy
- name: start xqueue
service: name=xqueue state=started
tags:
- xqueue
- deploy
# Stop xqueue service.
- name: stop xqueue service
service: name=xqueue state=stopped
tags:
- xqueue
# Do A Checkout
- name: git checkout xqueue repo into $app_base_dir
git: dest={{xqueue_code_dir}} repo={{xqueue.source_repo}} version={{xqueue.version}}
tags:
- xqueue
# Do Post Checkout Tasks.
- name: create xqueue code dir
file: path={{xqueue_code_dir}} state=directory owner=www-data group=www-data mode=755
tags:
- xqueue
# TODO: Check git.py _run_if_changed() to see if the logic there to skip running certain
# portions of the deploy needs to be incorporated here.
- name: sets permissions on xqueue code dir and contents
file: path={{xqueue_code_dir}} state=directory owner=www-data group=www-data recurse=yes
# 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.
tags:
- xqueue
# want deploy handlers to always run when deploy tag is specified, so move into a no op task
- name: run deploy handlers
shell: echo "running deploy handlers"
notify:
- invoke all deploy handlers
tags:
- xqueue
# requires:
# - group_vars/all
# - common/tasks/main.yml
# - nginx/tasks/main.yml
---
- name: 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 $app_base_dir
- name: install git and its recommends
apt: pkg=git state=present install_recommends=yes
tags:
- xqueue
- name: install a bunch of system packages on which LMS and CMS rely
apt: pkg={{item}} state=present
with_items: xqueue.debian_pkgs
tags:
- xqueue
- name: create xqueue application config
template: src=xqueue.env.json.j2 dest=$app_base_dir/env.json mode=640 owner=www-data group=adm
tags:
- xqueue
- name: create xqueue auth file
template: src=xqueue.auth.json.j2 dest=$app_base_dir/auth.json mode=640 owner=www-data group=adm
tags:
- xqueue
- name: creating xqueue upstart script
sudo: True
template: src=xqueue.conf.j2 dest=/etc/init/xqueue.conf owner=root group=root
tags:
- xqueue
- include: deploy.yml
{{ xqueue.auth_config | to_nice_json }}
#/etc/init/xqueue.conf
description "xqueue server"
author "edX <info@edx.org>"
respawn
respawn limit 3 30
env PID=/var/tmp/xqueue.pid
env WORKERS={{ ansible_processor_cores * 2 }}
env PORT={{ xqueue.gunicorn_port }}
env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=xqueue.aws_settings
env SERVICE_VARIANT="xqueue"
chdir {{ xqueue_code_dir }}
setuid www-data
exec {{ venv_dir }}/bin/gunicorn --preload -b 127.0.0.1:$PORT -w $WORKERS --timeout=300 --pythonpath={{ xqueue_code_dir }} xqueue.wsgi
{{ xqueue.env_config | to_nice_json }}
# variables common to the xqueue role, automatically loaded
# when the role is included
---
xqueue_code_dir: "{{ app_base_dir }}/xqueue"
xqueue:
# Default nginx listen port
# These should be overrided if you want
# to serve all content on port 80
code_dir: "{{ app_base_dir }}/xqueue"
nginx_port: 18040
gunicorn_port: 8040
auth_config: {}
env_config: {}
source_repo: git://github.com/edx/xqueue.git
version: 'HEAD'
pre_requirements_file: "{{ xqueue_code_dir }}/pre-requirements.txt"
post_requirements_file: "{{ xqueue_code_dir }}/requirements.txt"
# These packages are required for the xqueue server,
# copied from the LMS role for now since there is a lot
# of overlap
debian_pkgs:
- apparmor-utils
- aspell
- build-essential
- curl
- dvipng
- fabric
- facter
- g++
- gcc
- gfortran
- ghostscript
- git
- github-cli
- graphviz
- graphviz-dev
- gunicorn
- inoticoming
- ipython
- libcrypt-ssleay-perl
- libcurl4-openssl-dev
- libdigest-sha-perl
- libfreetype6-dev
- libgeos-dev
- libgraphviz-dev
- libjpeg8-dev
- liblapack-dev
- liblwp-protocol-https-perl
- libmysqlclient-dev
- libnet-amazon-ec2-perl
- libpng12-dev
- libreadline-dev
- libreadline6-dev
- libssl-dev
- libswitch-perl
- libwww-perl
- libxml++2.6-dev
- libxml2-dev
- libxml2-utils
- libxslt1-dev
- maven2
- mongodb
- mongodb-clients
- mysql-client
- npm
- ntp
- openjdk-7-jdk
- openjdk-7-jre
- pep8
- perl
- pkg-config
- postfix
- pylint
- python-boto
- python-coverage-test-runner
- python-django-nose
- python-jenkins
- python-nose
- python-nosexcover
- python-numpy
- python-pip
- python-scipy
- rake
- reprepro
- rsyslog
- rubygems
- sqlite3
- super
- vagrant
- yui-compressor
- zip
- zlib1g-dev
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