Commit bc37a64c by Bilal Committed by Bilal

complete and operationalize harstorage role (OPS-1372)

parent d8cd85c8
FROM edxops/precise-common
MAINTAINER edxops
USER root
# Fix selinux issue with useradd on 12.04
RUN curl http://salilab.org/~ben/libselinux1_2.1.0-5.1ubuntu1_amd64.deb -o /tmp/libselinux1_2.1.0-5.1ubuntu1_amd64.deb
RUN dpkg -i /tmp/libselinux1_2.1.0-5.1ubuntu1_amd64.deb
RUN apt-get update
ADD . /edx/app/edx_ansible/edx_ansible
COPY docker/build/xqwatcher/ansible_overrides.yml /
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
RUN /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook harstorage.yml \
-i '127.0.0.1,' -c local \
-t "install:base,install:configuration,install:app-requirements,install:code" \
-e@/ansible_overrides.yml
WORKDIR /edx/app/harstorage/harstorage
CMD ["/edx/app/harstorage/venvs/harstorage/bin/paster", "serve", "--daemon", "/edx/app/harstorage/venvs/harstorage/edx/etc/harstorage/production.ini"]
- name: Deploy Harstorage
hosts: all
sudo: True
gather_facts: True
roles:
- docker
- mongo
- harstorage
......@@ -3,5 +3,6 @@
sudo: True
gather_facts: True
roles:
- aws
- mongo
- harstorage
......@@ -21,6 +21,7 @@ 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'
# Source Code
HARSTORAGE_REPOS:
......@@ -39,13 +40,12 @@ harstorage_debian_pkgs:
- lib32stdc++6
- python-cairo
- python-rsvg
- python-setuptools
- python-pastescript
harstorage_python_pkgs:
- { name: "pylons", version: "1.0"}
- { name: "webob", version: "0.9.8"}
- { name: "webob", version: "1.2"}
- { name: "pymongo", version: "2.8"}
- { name: "PasteScript", version: "1.7.5"}
harstorage_redhat_pkgs: []
harstorage_port: "5000"
......
......@@ -25,18 +25,19 @@
apt:
name: "{{ item }}"
state: present
tags:
- install
- install:base
with_items: harstorage_debian_pkgs
- name: download harstorage egg file
get_url:
url: http://harstorage.googlecode.com/files/harstorage-1.0-py2.7.egg
dest: "{{ harstorage_code_dir }}/harstorage-1.0-py2.7.egg"
- name: build virtualenv
command: "virtualenv {{ harstorage_venv_dir }}"
args:
creates: "{{ harstorage_venv_dir }}/bin/pip"
sudo_user: "{{ harstorage_user }}"
tags:
- install
- install:base
- name: install python packages
pip:
......@@ -44,6 +45,9 @@
virtualenv: "{{ harstorage_venv_dir }}"
state: present
version: "{{ item.version }}"
tags:
- install
- install:app-requirements
with_items: harstorage_python_pkgs
- name: create harstorage config directory
......@@ -51,6 +55,9 @@
path: "{{ harstorage_venv_dir }}/{{ harstorage_etc }}"
state: directory
mode: 0755
tags:
- install
- install:configuration
- name: setup the harstorage production.ini file
template:
......@@ -59,14 +66,37 @@
owner: '{{ harstorage_user }}'
group: '{{ harstorage_user }}'
mode: 0644
tags:
- 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
easy_install:
name: "{{ harstorage_code_dir }}/harstorage-1.0-py2.7.egg"
virtualenv: "{{ harstorage_venv_dir }}"
command: >
{{ harstorage_venv_dir }}/bin/python ./setup.py install
args:
chdir: "{{ harstorage_code_dir }}"
tags:
- install
- install:code
- name: apply config
command: "/usr/bin/paster setup-app {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini"
command: "{{ harstorage_venv_dir }}/bin/paster setup-app {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini"
args:
chdir: "{{ harstorage_code_dir }}"
tags:
- install
- install:configuration
- name: run harstorage
command: "/usr/bin/paster serve {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini"
command: "{{ harstorage_venv_dir }}/bin/paster serve --daemon {{ harstorage_venv_dir }}/{{ harstorage_etc }}/production.ini --log-file {{ harstorage_log }}"
args:
creates: "{{ harstorage_log }}"
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