Commit 031004ee by Bilal

added supervisor handling

parent bc37a64c
......@@ -20,16 +20,15 @@ harstorage_user: '{{ harstorage_role_name }}'
harstorage_home: '{{ COMMON_APP_DIR }}/{{ harstorage_role_name }}'
harstorage_code_dir: '{{ harstorage_home }}/{{ harstorage_role_name }}'
harstorage_venv_dir: '{{ harstorage_home }}/venvs/{{ harstorage_role_name }}'
harstorage_etc: 'edx/etc/harstorage'
harstorage_log: '/edx/var/log/harstorage/harstorage.log'
harstorage_etc: '/edx/etc/harstorage'
# Source Code
HARSTORAGE_REPOS:
- PROTOCOL: https
DOMAIN: github.com
PATH: pavel-paulau
PATH: edx
REPO: harstorage
VERSION: master
VERSION: e0d/update-requirements
DESTINATION: '{{ harstorage_code_dir }}'
#
......@@ -38,13 +37,11 @@ HARSTORAGE_REPOS:
harstorage_debian_pkgs:
- lib32stdc++6
- python-cairo
- python-rsvg
harstorage_python_pkgs:
- { name: "pylons", version: "1.0"}
- { name: "webob", version: "1.2"}
- { name: "pymongo", version: "2.8"}
- { name: "pylons", version: "1.0.2"}
- { name: "webob", version: "1.5.1"}
- { name: "pymongo", version: "3.2.1"}
- { name: "PasteScript", version: "1.7.5"}
harstorage_redhat_pkgs: []
......
......@@ -52,7 +52,7 @@
- name: create harstorage config directory
file:
path: "{{ harstorage_venv_dir }}/{{ harstorage_etc }}"
path: "{{ harstorage_etc }}"
state: directory
mode: 0755
tags:
......@@ -61,8 +61,8 @@
- name: setup the harstorage production.ini file
template:
src: './{{ harstorage_etc }}/production.ini.j2'
dest: '{{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini'
src: '.{{ harstorage_etc }}/production.ini.j2'
dest: '{{ harstorage_etc }}/production.ini'
owner: '{{ harstorage_user }}'
group: '{{ harstorage_user }}'
mode: 0644
......@@ -70,15 +70,6 @@
- install
- install:configuration
- name: clone harstorage
git: >
repo=https://github.com/edx/harstorage.git
dest={{ harstorage_code_dir }}
sudo_user: "{{ harstorage_user }}"
tags:
- install
- install:code
- name: install harstorage
command: >
{{ harstorage_venv_dir }}/bin/python ./setup.py install
......@@ -89,14 +80,37 @@
- install:code
- name: apply config
command: "{{ harstorage_venv_dir }}/bin/paster setup-app {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini"
command: "{{ harstorage_venv_dir }}/bin/paster setup-app {{ harstorage_etc }}/production.ini"
args:
chdir: "{{ harstorage_code_dir }}"
tags:
- install
- install:configuration
- name: run harstorage
command: "{{ harstorage_venv_dir }}/bin/paster serve --daemon {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini --log-file {{ harstorage_log }}"
args:
creates: "{{ harstorage_log }}"
- name: write supervisor wrapper script
template:
src: edx/app/harstorage/harstorage.sh.j2
dest: "{{ harstorage_home }}/{{ harstorage_role_name }}.sh"
mode: 0650
owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}"
- name: write supervisord config
template:
src: edx/app/supervisor/conf.d.available/harstorage.conf.j2
dest: "{{ supervisor_available_dir }}/{{ harstorage_role_name }}.conf"
owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}"
mode: 0644
- name: enable supervisor script
file:
src: "{{ supervisor_available_dir }}/{{ harstorage_role_name }}.conf"
dest: "{{ supervisor_cfg_dir }}/{{ harstorage_role_name }}.conf"
state: link
force: yes
when: not disable_edx_services
- name: update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
when: not disable_edx_services
#!/usr/bin/env bash
# {{ ansible_managed }}
{{ harstorage_venv_dir }}/bin/paster serve {{ harstorage_etc }}/production.ini
#
# {{ ansible_managed }}
#
[program:{{ harstorage_role_name }}]
command={{ harstorage_home }}/{{ harstorage_role_name }}.sh
user={{ common_web_user }}
directory={{ harstorage_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
......@@ -15,7 +15,7 @@ port = {{ harstorage_port }}
use = egg:harstorage
full_stack = true
static_files = true
temp_store = %(here)s/data
temp_store = {{ COMMON_DATA_DIR }}/{{ harstorage_user }}
bin_store = %(here)s
ps_enabled = true
static_version = {{ harstorage_version }}
......
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