Commit 031004ee by Bilal

added supervisor handling

parent bc37a64c
...@@ -20,16 +20,15 @@ harstorage_user: '{{ harstorage_role_name }}' ...@@ -20,16 +20,15 @@ harstorage_user: '{{ harstorage_role_name }}'
harstorage_home: '{{ COMMON_APP_DIR }}/{{ harstorage_role_name }}' harstorage_home: '{{ COMMON_APP_DIR }}/{{ harstorage_role_name }}'
harstorage_code_dir: '{{ harstorage_home }}/{{ harstorage_role_name }}' harstorage_code_dir: '{{ harstorage_home }}/{{ harstorage_role_name }}'
harstorage_venv_dir: '{{ harstorage_home }}/venvs/{{ harstorage_role_name }}' harstorage_venv_dir: '{{ harstorage_home }}/venvs/{{ harstorage_role_name }}'
harstorage_etc: 'edx/etc/harstorage' harstorage_etc: '/edx/etc/harstorage'
harstorage_log: '/edx/var/log/harstorage/harstorage.log'
# Source Code # Source Code
HARSTORAGE_REPOS: HARSTORAGE_REPOS:
- PROTOCOL: https - PROTOCOL: https
DOMAIN: github.com DOMAIN: github.com
PATH: pavel-paulau PATH: edx
REPO: harstorage REPO: harstorage
VERSION: master VERSION: e0d/update-requirements
DESTINATION: '{{ harstorage_code_dir }}' DESTINATION: '{{ harstorage_code_dir }}'
# #
...@@ -38,13 +37,11 @@ HARSTORAGE_REPOS: ...@@ -38,13 +37,11 @@ HARSTORAGE_REPOS:
harstorage_debian_pkgs: harstorage_debian_pkgs:
- lib32stdc++6 - lib32stdc++6
- python-cairo
- python-rsvg
harstorage_python_pkgs: harstorage_python_pkgs:
- { name: "pylons", version: "1.0"} - { name: "pylons", version: "1.0.2"}
- { name: "webob", version: "1.2"} - { name: "webob", version: "1.5.1"}
- { name: "pymongo", version: "2.8"} - { name: "pymongo", version: "3.2.1"}
- { name: "PasteScript", version: "1.7.5"} - { name: "PasteScript", version: "1.7.5"}
harstorage_redhat_pkgs: [] harstorage_redhat_pkgs: []
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
- name: create harstorage config directory - name: create harstorage config directory
file: file:
path: "{{ harstorage_venv_dir }}/{{ harstorage_etc }}" path: "{{ harstorage_etc }}"
state: directory state: directory
mode: 0755 mode: 0755
tags: tags:
...@@ -61,8 +61,8 @@ ...@@ -61,8 +61,8 @@
- name: setup the harstorage production.ini file - name: setup the harstorage production.ini file
template: template:
src: './{{ harstorage_etc }}/production.ini.j2' src: '.{{ harstorage_etc }}/production.ini.j2'
dest: '{{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini' dest: '{{ harstorage_etc }}/production.ini'
owner: '{{ harstorage_user }}' owner: '{{ harstorage_user }}'
group: '{{ harstorage_user }}' group: '{{ harstorage_user }}'
mode: 0644 mode: 0644
...@@ -70,15 +70,6 @@ ...@@ -70,15 +70,6 @@
- install - install
- install:configuration - 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 - name: install harstorage
command: > command: >
{{ harstorage_venv_dir }}/bin/python ./setup.py install {{ harstorage_venv_dir }}/bin/python ./setup.py install
...@@ -89,14 +80,37 @@ ...@@ -89,14 +80,37 @@
- install:code - install:code
- name: apply config - 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: args:
chdir: "{{ harstorage_code_dir }}" chdir: "{{ harstorage_code_dir }}"
tags: tags:
- install - install
- install:configuration - install:configuration
- name: run harstorage - name: write supervisor wrapper script
command: "{{ harstorage_venv_dir }}/bin/paster serve --daemon {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini --log-file {{ harstorage_log }}" template:
args: src: edx/app/harstorage/harstorage.sh.j2
creates: "{{ harstorage_log }}" 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 }} ...@@ -15,7 +15,7 @@ port = {{ harstorage_port }}
use = egg:harstorage use = egg:harstorage
full_stack = true full_stack = true
static_files = true static_files = true
temp_store = %(here)s/data temp_store = {{ COMMON_DATA_DIR }}/{{ harstorage_user }}
bin_store = %(here)s bin_store = %(here)s
ps_enabled = true ps_enabled = true
static_version = {{ harstorage_version }} 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