Commit 68c462bd by John Jarvis

variable naming, using www-data as web user

parent a4d8458f
...@@ -15,9 +15,9 @@ WSGIRestrictEmbedded On ...@@ -15,9 +15,9 @@ WSGIRestrictEmbedded On
SetEnv SERVICE_VARIANT lms SetEnv SERVICE_VARIANT lms
WSGIScriptAlias / {{edx_platform_code_dir}}/lms/wsgi_apache_lms.py WSGIScriptAlias / {{edxapp_code_dir}}/lms/wsgi_apache_lms.py
<Directory {{edx_platform_code_dir}}/lms> <Directory {{edxapp_code_dir}}/lms>
<Files wsgi_apache_lms.py> <Files wsgi_apache_lms.py>
Order deny,allow Order deny,allow
Allow from all Allow from all
...@@ -39,7 +39,7 @@ WSGIRestrictEmbedded On ...@@ -39,7 +39,7 @@ WSGIRestrictEmbedded On
require valid-user require valid-user
</Location> </Location>
WSGIDaemonProcess lms user=www-data group=adm processes=1 python-path={{edx_platform_code_dir}}:{{venv_dir}}/lib/python2.7/site-packages display-name=%{GROUP} WSGIDaemonProcess lms user=www-data group=adm processes=1 python-path={{edxapp_code_dir}}:{{venv_dir}}/lib/python2.7/site-packages display-name=%{GROUP}
WSGIProcessGroup lms WSGIProcessGroup lms
WSGIApplicationGroup %{GLOBAL} WSGIApplicationGroup %{GLOBAL}
......
...@@ -15,3 +15,7 @@ common_debian_pkgs: ...@@ -15,3 +15,7 @@ common_debian_pkgs:
common_pip_pkgs: common_pip_pkgs:
- virtualenv - virtualenv
- virtualenvwrapper - virtualenvwrapper
common_web_user: www-data
common_web_group: www-data
common_log_user: syslog
--- ---
- name: common | Add user www-data - name: common | Add user www-data
# This is the default user for nginx # This is the default user for nginx
user: name=www-data user: name="{{ common_web_user }}"
- name: common | Create common directories - name: common | Create common directories
file: > file: >
......
...@@ -96,8 +96,12 @@ edxapp_data_dir: "{{ data_dir }}/edxapp" ...@@ -96,8 +96,12 @@ edxapp_data_dir: "{{ data_dir }}/edxapp"
edxapp_app_dir: "{{ app_dir }}/edxapp" edxapp_app_dir: "{{ app_dir }}/edxapp"
edxapp_log_dir: "{{ log_dir }}/edxapp" edxapp_log_dir: "{{ log_dir }}/edxapp"
edxapp_venvs_dir: "{{ app_dir }}/venvs" edxapp_venvs_dir: "{{ app_dir }}/venvs"
edxapp_venv_dir: "{{ edxapp_venvs_dir }}/edxapp"
edxapp_rbenvs_dir: "{{ app_dir }}/rbenvs" edxapp_rbenvs_dir: "{{ app_dir }}/rbenvs"
edxapp_rbenv_dir: "{{ edxapp_rbenvs_dir }}/edxapp"
edxapp_user: edxapp edxapp_user: edxapp
edxapp_rbenv_root: "{{ edxapp_rbenv_dir }}/.rbenv"
edxapp_gem_root: "{{ edxapp_rbenv_dir }}/.gem"
edxapp_generic_auth_config: &edxapp_generic_auth edxapp_generic_auth_config: &edxapp_generic_auth
AWS_ACCESS_KEY_ID: $EDXAPP_AWS_ACCESS_KEY_ID AWS_ACCESS_KEY_ID: $EDXAPP_AWS_ACCESS_KEY_ID
...@@ -242,7 +246,7 @@ lms_preview_env_config: ...@@ -242,7 +246,7 @@ lms_preview_env_config:
# install dir for the edx-platform repo # install dir for the edx-platform repo
edx_platform_code_dir: "{{ app_dir }}/edx-platform" edxapp_code_dir: "{{ app_dir }}/edx-platform"
# gunicorn ports/hosts, these shouldn't need to be overridden # gunicorn ports/hosts, these shouldn't need to be overridden
...@@ -285,16 +289,16 @@ edx_platform_repo: "https://{{ GIT_MIRROR }}/edx/edx-platform.git" ...@@ -285,16 +289,16 @@ edx_platform_repo: "https://{{ GIT_MIRROR }}/edx/edx-platform.git"
# `edx_platform_commit` can be anything that git recognizes as a commit # `edx_platform_commit` can be anything that git recognizes as a commit
# reference, including a tag, a branch name, or a commit hash # reference, including a tag, a branch name, or a commit hash
edx_platform_commit: 'release' edx_platform_commit: 'release'
local_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/local.txt" local_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/local.txt"
pre_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/pre.txt" pre_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/pre.txt"
post_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/post.txt" post_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/post.txt"
base_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/base.txt" base_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/base.txt"
github_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/github.txt" github_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/github.txt"
repo_requirements_file: "{{ edx_platform_code_dir }}/requirements/edx/repo.txt" repo_requirements_file: "{{ edxapp_code_dir }}/requirements/edx/repo.txt"
sandbox_base_requirements: "{{ edx_platform_code_dir }}/requirements/edx-sandbox/base.txt" sandbox_base_requirements: "{{ edxapp_code_dir }}/requirements/edx-sandbox/base.txt"
sandbox_local_requirements: "{{ edx_platform_code_dir }}/requirements/edx-sandbox/local.txt" sandbox_local_requirements: "{{ edxapp_code_dir }}/requirements/edx-sandbox/local.txt"
sandbox_post_requirements: "{{ edx_platform_code_dir }}/requirements/edx-sandbox/post.txt" sandbox_post_requirements: "{{ edxapp_code_dir }}/requirements/edx-sandbox/post.txt"
#do we want to install the sandbox requirements into the regular virtual env #do we want to install the sandbox requirements into the regular virtual env
install_sandbox_reqs_into_regular_venv: true install_sandbox_reqs_into_regular_venv: true
...@@ -339,9 +343,9 @@ deploy_environment: ...@@ -339,9 +343,9 @@ deploy_environment:
LANG: "en_US.UTF-8" LANG: "en_US.UTF-8"
NO_PREREQ_INSTALL: 1 NO_PREREQ_INSTALL: 1
SKIP_WS_MIGRATIONS: 1 SKIP_WS_MIGRATIONS: 1
RBENV_ROOT: "{{ rbenv_root }}" RBENV_ROOT: "{{ edxapp_rbenv_root }}"
GEM_HOME: "{{ gem_home }}" GEM_HOME: "{{ edxapp_gem_root }}"
PATH: "{{ venv_dir }}/bin:{{ edx_platform_code_dir }}/bin:{{ rbenv_root }}/bin:{{ rbenv_root }}/shims:{{ gem_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" PATH: "{{ edxapp_venv_dir }}/bin:{{ edxapp_code_dir }}/bin:{{ edxapp_rbenv_root }}/bin:{{ edxapp_rbenv_root }}/shims:{{ edxapp_gem_home }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Worker Settings # Worker Settings
worker_django_settings_module: 'aws' worker_django_settings_module: 'aws'
--- ---
dependencies: dependencies:
- role: rbenv - role: rbenv
rbenv_user: root rbenv_user: "{{ edxapp_user }}"
rbenv_user_home: "{{ edxapp_rbenvs_dir}}/edxapp" rbenv_user_home: "{{ edxapp_rbenv_dir }}"
rbenv_ruby_version: "{{ edxapp_ruby_version }}" rbenv_ruby_version: "{{ edxapp_ruby_version }}"
...@@ -25,83 +25,50 @@ ...@@ -25,83 +25,50 @@
# Do A Checkout # Do A Checkout
- name: edxapp | checkout edx-platform repo into {{edx_platform_code_dir}} - name: edxapp | checkout edx-platform repo into {{edxapp_code_dir}}
git: dest={{edx_platform_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_commit}} git: dest={{edxapp_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_commit}}
register: edx_platform_checkout register: edx_platform_checkout
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
- name: git clean after checking out edx-platform - name: git clean after checking out edx-platform
shell: cd {{edx_platform_code_dir}} && git clean -xdf shell: cd {{edxapp_code_dir}} && git clean -xdf
when: edx_platform_checkout.changed when: edx_platform_checkout.changed
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Do Post Checkout Tasks.
- name: create platform code dir
file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data mode=755
tags:
- lms
- cms
- install
- deploy
- name: checkout theme - name: checkout theme
git: dest={{app_dir}}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}} git: dest={{app_dir}}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
when: edxapp_theme_name != '' when: edxapp_theme_name != ''
sudo_user: "{{ edxapp_user }}"
tags: tags:
- cms
- lms-preview
- lms
- update
- deploy
# 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 platform code dir and contents
file: path={{edx_platform_code_dir}} state=directory owner=www-data group=www-data recurse=yes
# Post Checkout tasks will get run as handlers when the {{ edx_platform_code_dir }} is ready.
# Look at the handlers/main.yml in this role for a description of the tasks stated below.
when: edx_platform_checkout.changed
tags:
- lms
- cms
- install
- deploy - deploy
# Ruby plays that need to be run after platform updates. # Ruby plays that need to be run after platform updates.
- name: gem | gem install bundler - name: edxapp | gem install bundler
shell: > shell: >
RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ rbenv_root }}/shims/gem install bundle RBENV_ROOT={{ edxapp_rbenv_root }} GEM_HOME={{ edxapp_gem_root }} {{ edxapp_rbenv_root }}/shims/gem install bundle
chdir={{ edx_platform_code_dir }} chdir={{ edxapp_code_dir }}
sudo_user: "{{ edxapp_user }}"
tags: tags:
- ruby
- deploy - deploy
- install
- name: bundle | bundle install - name: edxapp | bundle install
shell: > shell: >
RBENV_ROOT={{ rbenv_root }} GEM_HOME={{ gem_home }} {{ gem_home }}/bin/bundle install --binstubs RBENV_ROOT={{ edxapp_rbenv_root }} GEM_HOME={{ edxapp_gem_root }} {{ edxapp_gem_root }}/bin/bundle install --binstubs
chdir={{ edx_platform_code_dir }} chdir={{ edxapp_code_dir }}
sudo_user: "{{ edxapp_user }}"
tags: tags:
- ruby
- deploy - deploy
- install
# Node play that need to be run after platform updates. # Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies - name: Install edx-platform npm dependencies
shell: npm install chdir={{ edx_platform_code_dir }} shell: npm install chdir={{ edxapp_code_dir }}
sudo_user: "{{ edxapp_user }}"
tags: tags:
- npm
- update
- deploy - deploy
# Python plays that need to be run after platform updates. # Python plays that need to be run after platform updates.
...@@ -120,113 +87,92 @@ ...@@ -120,113 +87,92 @@
- "{{ sandbox_base_requirements }}" - "{{ sandbox_base_requirements }}"
- "{{ sandbox_local_requirements }}" - "{{ sandbox_local_requirements }}"
- "{{ sandbox_post_requirements }}" - "{{ sandbox_post_requirements }}"
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Install the python pre requirements into {{ venv_dir }} # Install the python pre requirements into {{ edxapp_venv_dir }}
- name : install python pre-requirements - name : install python pre-requirements
pip: > pip: >
requirements="{{pre_requirements_file}}" requirements="{{pre_requirements_file}}"
virtualenv="{{venv_dir}}" virtualenv="{{edxapp_venv_dir}}"
state=present state=present
extra_args="-i {{ PYPI_MIRROR_URL }}" extra_args="-i {{ PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Install the python modules into {{ venv_dir }} # Install the python modules into {{ edxapp_venv_dir }}
- name : install python base-requirements - name : install python base-requirements
# Need to use shell rather than pip so that we can maintain the context of our current working directory; some # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
# requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
# installs everything into that virtual environment. # installs everything into that virtual environment.
shell: cd {{ edx_platform_code_dir }} && {{ venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ base_requirements_file }} shell: cd {{ edxapp_code_dir }} && {{ edxapp_venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ base_requirements_file }}
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Install the python post requirements into {{ venv_dir }} # Install the python post requirements into {{ edxapp_venv_dir }}
- name : install python post-requirements - name : install python post-requirements
pip: > pip: >
requirements="{{post_requirements_file}}" requirements="{{post_requirements_file}}"
virtualenv="{{venv_dir}}" virtualenv="{{edxapp_venv_dir}}"
state=present state=present
extra_args="-i {{ PYPI_MIRROR_URL }}" extra_args="-i {{ PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Install the final python modules into {{ venv_dir }} # Install the final python modules into {{ edxapp_venv_dir }}
- name : install python post-post requirements - name : install python post-post requirements
# Need to use shell rather than pip so that we can maintain the context of our current working directory; some # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
# requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
# installs everything into that virtual environment. # installs everything into that virtual environment.
shell: cd {{ edx_platform_code_dir }} && {{ venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }} shell: cd {{ edxapp_code_dir }} && {{ edxapp_venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }}
with_items: with_items:
- "{{ repo_requirements_file }}" - "{{ repo_requirements_file }}"
- "{{ github_requirements_file }}" - "{{ github_requirements_file }}"
- "{{ local_requirements_file }}" - "{{ local_requirements_file }}"
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
# Install the sandbox python modules into {{ venv_dir }} # Install the sandbox python modules into {{ edxapp_venv_dir }}
- name : install sandbox requirements into regular venv - name : install sandbox requirements into regular venv
# Need to use shell rather than pip so that we can maintain the context of our current working directory; some # Need to use shell rather than pip so that we can maintain the context of our current working directory; some
# requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly # requirements are pathed relative to the edx-platform repo. Using the pip from inside the virtual environment implicitly
# installs everything into that virtual environment. # installs everything into that virtual environment.
shell: cd {{ edx_platform_code_dir }} && {{ venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }} shell: cd {{ edxapp_code_dir }} && {{ edxapp_venv_dir }}/bin/pip install -i {{ PYPI_MIRROR_URL }} --exists-action w --use-mirrors -r {{ item }}
with_items: with_items:
- "{{ sandbox_base_requirements }}" - "{{ sandbox_base_requirements }}"
- "{{ sandbox_local_requirements }}" - "{{ sandbox_local_requirements }}"
- "{{ sandbox_post_requirements }}" - "{{ sandbox_post_requirements }}"
when: install_sandbox_reqs_into_regular_venv when: install_sandbox_reqs_into_regular_venv
sudo_user: "{{ edxapp_user }}"
tags: tags:
- lms
- cms
- install
- deploy - deploy
- name: changing group ownership to www-data for everything in the venv (workaround)
shell: chgrp -R www-data {{ venv_dir }}
# Gather lms assets using rake if possible # Gather lms assets using rake if possible
- name: gather lms static assets with rake - name: gather lms static assets with rake
shell: executable=/bin/bash chdir={{ edx_platform_code_dir }} SERVICE_VARIANT={{ lms_variant }} rake lms:gather_assets:aws shell: executable=/bin/bash chdir={{ edxapp_code_dir }} SERVICE_VARIANT={{ lms_variant }} rake lms:gather_assets:aws
notify: notify:
- restart edxapp - restart edxapp
sudo: yes sudo_user: "{{ edxapp_user }}"
sudo_user: www-data
when: celery_worker is not defined when: celery_worker is not defined
environment: "{{ deploy_environment }}" environment: "{{ deploy_environment }}"
tags: tags:
- lms
- lms-preview
- deploy - deploy
# Gather cms assets using rake if possible # Gather cms assets using rake if possible
- name: gather cms static assets with rake - name: gather cms static assets with rake
shell: executable=/bin/bash chdir={{ edx_platform_code_dir }} SERVICE_VARIANT={{ cms_variant }} rake cms:gather_assets:aws shell: executable=/bin/bash chdir={{ edxapp_code_dir }} SERVICE_VARIANT={{ cms_variant }} rake cms:gather_assets:aws
notify: notify:
- restart edxapp - restart edxapp
sudo: yes sudo_user: "{{ edxapp_user }}"
sudo_user: www-data
when: celery_worker is not defined when: celery_worker is not defined
environment: "{{ deploy_environment }}" environment: "{{ deploy_environment }}"
tags: tags:
- cms
- deploy - deploy
...@@ -235,42 +181,27 @@ ...@@ -235,42 +181,27 @@
# not sure if this fix will ever get merged # not sure if this fix will ever get merged
# We should never do this in production # We should never do this in production
- name: openid workaround - NOT FOR PRODUCTION - name: openid workaround - NOT FOR PRODUCTION
shell: sed -i -e 's/claimed_id = models.TextField(max_length=2047, unique=True/claimed_id = models.TextField(max_length=2047/' /opt/edx/lib/python2.7/site-packages/django_openid_auth/models.py shell: sed -i -e 's/claimed_id = models.TextField(max_length=2047, unique=True/claimed_id = models.TextField(max_length=2047/' {{ edxapp_venv_dir }}/lib/python2.7/site-packages/django_openid_auth/models.py
when: openid_workaround is defined when: openid_workaround is defined
tags: tags:
- deploy - deploy
- lms
- lms-preview
- cms
- syncdb
- name: syncdb and migrate - name: syncdb and migrate
shell: sudo -u www-data SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath=/opt/wwc/edx-platform shell: sudo -u {{ edxapp_user }} SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
tags: tags:
- deploy - deploy
- lms
- lms-preview
- cms
- syncdb
- name: db migrate - name: db migrate
shell: sudo -u www-data SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py migrate --noinput --settings=lms.envs.aws --pythonpath=/opt/wwc/edx-platform shell: sudo -u {{ edxapp_user }} SERVICE_VARIANT=lms /opt/edx/bin/django-admin.py migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when: migrate_only is defined and migrate_only|lower == "yes" when: migrate_only is defined and migrate_only|lower == "yes"
tags: tags:
- deploy - deploy
- lms
- lms-preview
- cms
- migrate
- name: restart edxapp - name: restart edxapp
service: name=edxapp state=restarted service: name=edxapp state=restarted
when: celery_worker is not defined when: celery_worker is not defined
tags: tags:
- lms
- lms-preview
- cms
- deploy - deploy
- name: restart workers - name: restart workers
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
file: > file: >
path="{{ item }}" path="{{ item }}"
state=directory state=directory
owner=root owner="{{ edxapp_user }}"
group="{{ edxapp_user }}" group="{{ common_web_group }}"
with_items: with_items:
- "{{ edxapp_app_dir }}" - "{{ edxapp_app_dir }}"
- "{{ edxapp_venvs_dir }}" - "{{ edxapp_venvs_dir }}"
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
file: > file: >
path="{{ edxapp_log_dir }}" path="{{ edxapp_log_dir }}"
state=directory state=directory
owner=syslog owner="{{ common_log_user }}"
notify: common | restart logrotate notify: common | restart logrotate
- name: edxapp | create edxapp data dirs - name: edxapp | create edxapp data dirs
file: > file: >
path="{{ item }}" path="{{ item }}"
state=directory state=directory
owner="{{ edxapp_user }}" owner="{{ common_web_user }}"
with_items: with_items:
- "{{ edxapp_data_dir }}/staticfiles" - "{{ edxapp_data_dir }}/staticfiles"
- "{{ edxapp_data_dir }}/data" - "{{ edxapp_data_dir }}/data"
......
...@@ -10,7 +10,7 @@ respawn limit 3 30 ...@@ -10,7 +10,7 @@ respawn limit 3 30
env PID=/var/tmp/cms.pid env PID=/var/tmp/cms.pid
#env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini #env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini
#env NEWRELIC={{venv_dir}}/bin/newrelic-admin #env NEWRELIC={{edxapp_venv_dir}}/bin/newrelic-admin
{% if ansible_processor|length > 0 %} {% if ansible_processor|length > 0 %}
env WORKERS={{ ansible_processor|length * worker_core_mult.cms }} env WORKERS={{ ansible_processor|length * worker_core_mult.cms }}
{% else %} {% else %}
...@@ -22,7 +22,7 @@ env LANG=en_US.UTF-8 ...@@ -22,7 +22,7 @@ env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=cms.envs.aws env DJANGO_SETTINGS_MODULE=cms.envs.aws
env SERVICE_VARIANT="cms" env SERVICE_VARIANT="cms"
chdir {{edx_platform_code_dir}} chdir {{edxapp_code_dir}}
setuid www-data setuid www-data
exec {{venv_dir}}/bin/gunicorn_django -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edx_platform_code_dir}} --settings=cms.envs.aws exec {{edxapp_venv_dir}}/bin/gunicorn_django -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edxapp_code_dir}} --settings=cms.envs.aws
...@@ -10,15 +10,15 @@ respawn ...@@ -10,15 +10,15 @@ respawn
instance edx.${SERVICE_VARIANT}.core.${QUEUE} instance edx.${SERVICE_VARIANT}.core.${QUEUE}
#env NEW_RELIC_CONFIG_FILE=/opt/wwc/newrelic.ini #env NEW_RELIC_CONFIG_FILE=/opt/wwc/newrelic.ini
#env NEWRELIC={{venv_dir}}/bin/newrelic-admin #env NEWRELIC={{edxapp_venv_dir}}/bin/newrelic-admin
env CONCURRENCY=${CONCURRENCY} env CONCURRENCY=${CONCURRENCY}
env LOGLEVEL=info env LOGLEVEL=info
env DJANGO_SETTINGS_MODULE={{worker_django_settings_module}} env DJANGO_SETTINGS_MODULE={{worker_django_settings_module}}
env PYTHONPATH={{edx_platform_code_dir}} env PYTHONPATH={{edxapp_code_dir}}
env SERVICE_VARIANT=${SERVICE_VARIANT} env SERVICE_VARIANT=${SERVICE_VARIANT}
setuid www-data setuid www-data
chdir {{edx_platform_code_dir}} chdir {{edxapp_code_dir}}
exec {{venv_dir}}/bin/python {{edx_platform_code_dir}}/manage.py $SERVICE_VARIANT --settings=$DJANGO_SETTINGS_MODULE celery worker --loglevel=$LOGLEVEL --queues=edx.${SERVICE_VARIANT}.core.${QUEUE} --hostname=edx.${SERVICE_VARIANT}.core.${QUEUE}.`hostname` --concurrency=$CONCURRENCY exec {{edxapp_venv_dir}}/bin/python {{edxapp_code_dir}}/manage.py $SERVICE_VARIANT --settings=$DJANGO_SETTINGS_MODULE celery worker --loglevel=$LOGLEVEL --queues=edx.${SERVICE_VARIANT}.core.${QUEUE} --hostname=edx.${SERVICE_VARIANT}.core.${QUEUE}.`hostname` --concurrency=$CONCURRENCY
...@@ -10,15 +10,15 @@ respawn ...@@ -10,15 +10,15 @@ respawn
instance edx.${SERVICE_VARIANT}.core.${QUEUE} instance edx.${SERVICE_VARIANT}.core.${QUEUE}
#env NEW_RELIC_CONFIG_FILE=/opt/wwc/newrelic.ini #env NEW_RELIC_CONFIG_FILE=/opt/wwc/newrelic.ini
#env NEWRELIC={{venv_dir}}/bin/newrelic-admin #env NEWRELIC={{edxapp_venv_dir}}/bin/newrelic-admin
env CONCURRENCY=${CONCURRENCY} env CONCURRENCY=${CONCURRENCY}
env LOGLEVEL=info env LOGLEVEL=info
env DJANGO_SETTINGS_MODULE={{worker_django_settings_module}} env DJANGO_SETTINGS_MODULE={{worker_django_settings_module}}
env PYTHONPATH={{edx_platform_code_dir}} env PYTHONPATH={{edxapp_code_dir}}
env SERVICE_VARIANT=${SERVICE_VARIANT} env SERVICE_VARIANT=${SERVICE_VARIANT}
setuid www-data setuid www-data
chdir {{edx_platform_code_dir}} chdir {{edxapp_code_dir}}
exec {{venv_dir}}/bin/python {{edx_platform_code_dir}}/manage.py lms --service-variant=$SERVICE_VARIANT --settings=$DJANGO_SETTINGS_MODULE celery worker --loglevel=$LOGLEVEL --queues=edx.${SERVICE_VARIANT}.core.${QUEUE} --hostname=edx.${SERVICE_VARIANT}.core.${QUEUE}.`hostname` --concurrency=$CONCURRENCY exec {{edxapp_venv_dir}}/bin/python {{edxapp_code_dir}}/manage.py lms --service-variant=$SERVICE_VARIANT --settings=$DJANGO_SETTINGS_MODULE celery worker --loglevel=$LOGLEVEL --queues=edx.${SERVICE_VARIANT}.core.${QUEUE} --hostname=edx.${SERVICE_VARIANT}.core.${QUEUE}.`hostname` --concurrency=$CONCURRENCY
...@@ -11,7 +11,7 @@ respawn limit 3 30 ...@@ -11,7 +11,7 @@ respawn limit 3 30
env PID=/var/tmp/lms.pid env PID=/var/tmp/lms.pid
#env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini #env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini
#env NEWRELIC={{venv_dir}}/bin/newrelic-admin #env NEWRELIC={{edxapp_venv_dir}}/bin/newrelic-admin
{% if ansible_processor|length > 0 %} {% if ansible_processor|length > 0 %}
env WORKERS={{ ansible_processor|length * worker_core_mult.lms_preview }} env WORKERS={{ ansible_processor|length * worker_core_mult.lms_preview }}
{% else %} {% else %}
...@@ -23,10 +23,10 @@ env LANG=en_US.UTF-8 ...@@ -23,10 +23,10 @@ env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE=lms.envs.aws env DJANGO_SETTINGS_MODULE=lms.envs.aws
env SERVICE_VARIANT="lms-preview" env SERVICE_VARIANT="lms-preview"
chdir {{edx_platform_code_dir}} chdir {{edxapp_code_dir}}
setuid www-data setuid www-data
exec {{venv_dir}}/bin/gunicorn --preload -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edx_platform_code_dir}} lms.wsgi exec {{edxapp_venv_dir}}/bin/gunicorn --preload -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edxapp_code_dir}} lms.wsgi
post-start script post-start script
while true while true
......
...@@ -8,7 +8,7 @@ respawn limit 3 30 ...@@ -8,7 +8,7 @@ respawn limit 3 30
env PID=/var/tmp/lms.pid env PID=/var/tmp/lms.pid
#env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini #env NEW_RELIC_CONFIG_FILE={{app_dir}}/newrelic.ini
#env NEWRELIC={{venv_dir}}/bin/newrelic-admin #env NEWRELIC={{edxapp_venv_dir}}/bin/newrelic-admin
{% if ansible_processor|length > 0 %} {% if ansible_processor|length > 0 %}
env WORKERS={{ ansible_processor|length * worker_core_mult.lms }} env WORKERS={{ ansible_processor|length * worker_core_mult.lms }}
{% else %} {% else %}
...@@ -20,10 +20,10 @@ env LANG=en_US.UTF-8 ...@@ -20,10 +20,10 @@ env LANG=en_US.UTF-8
env DJANGO_SETTINGS_MODULE={{ edxapp_lms_env }} env DJANGO_SETTINGS_MODULE={{ edxapp_lms_env }}
env SERVICE_VARIANT="lms" env SERVICE_VARIANT="lms"
chdir {{edx_platform_code_dir}} chdir {{edxapp_code_dir}}
setuid www-data setuid www-data
exec {{venv_dir}}/bin/gunicorn --preload -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edx_platform_code_dir}} lms.wsgi exec {{edxapp_venv_dir}}/bin/gunicorn --preload -b $ADDRESS:$PORT -w $WORKERS --timeout=300 --pythonpath={{edxapp_code_dir}} lms.wsgi
post-start script post-start script
while true while true
......
export RBENV_ROOT="{{ rbenv_root }}"
export GEM_HOME="{{ gem_home }}"
export PATH="{{ gem_home }}/bin:$PATH"
eval "$(rbenv init -)"
--- ---
rbenv_version: 'v0.4.0' rbenv_version: 'v0.4.0'
rbenv_bundler_version: '1.3.2' rbenv_bundler_version: '1.3.2'
\ No newline at end of file rbenv_root: "{{ rbenv_user_home }}/.rbenv"
--- ---
# rbenv # rbenv
# #
# Dependencies: # Dependencies:
# #
# * common # * common
# #
# Example play: # Example play:
# #
# roles: # roles:
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# rbenv_ruby_version: "{{ forum_ruby_version }}" # rbenv_ruby_version: "{{ forum_ruby_version }}"
# #
# Parameters: # Parameters:
# #
# * rbenv_user # * rbenv_user
# * rbenv_user_home # * rbenv_user_home
# * rbenv_ruby_version # * rbenv_ruby_version
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
# workaround for the case where the parent # workaround for the case where the parent
# directory doesn't exist # directory doesn't exist
file: > file: >
path={{ rbenv_user_home }} path={{ rbenv_user_home }}
state=directory state=directory
- name: rbenv | create rbenv user {{ rbenv_user }} - name: rbenv | create rbenv user {{ rbenv_user }}
user: > user: >
name={{ rbenv_user }} name={{ rbenv_user }}
state=present state=present
shell=/bin/bash shell=/bin/bash
home={{ rbenv_user_home }} home={{ rbenv_user_home }}
createhome=yes createhome=yes
tags: tags:
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
# workaround for the case where the parent # workaround for the case where the parent
# directory doesn't exist # directory doesn't exist
file: > file: >
path={{ rbenv_user_home }} path={{ rbenv_user_home }}
owner={{ rbenv_user }} owner={{ rbenv_user }}
group={{ rbenv_user }} group={{ rbenv_user }}
state=directory state=directory
...@@ -80,10 +80,10 @@ ...@@ -80,10 +80,10 @@
- name: rbenv | update rbenv repo - name: rbenv | update rbenv repo
git: > git: >
repo=https://github.com/sstephenson/rbenv.git repo=https://github.com/sstephenson/rbenv.git
dest={{ rbenv_user_home }}/.rbenv dest={{ rbenv_user_home }}/.rbenv
version={{ rbenv_version }} version={{ rbenv_version }}
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
- name: rbenv | ensure .bashrc exists - name: rbenv | ensure .bashrc exists
shell: touch {{ rbenv_user_home }}/.bashrc shell: touch {{ rbenv_user_home }}/.bashrc
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
...@@ -99,17 +99,17 @@ ...@@ -99,17 +99,17 @@
- name: rbenv | drop a bash_profile - name: rbenv | drop a bash_profile
copy: > copy: >
src=../../common/files/bash_profile src=../../common/files/bash_profile
dest={{ rbenv_user_home }}/.bash_profile dest={{ rbenv_user_home }}/.bash_profile
owner={{ rbenv_user }} owner={{ rbenv_user }}
group={{ rbenv_user }} group={{ rbenv_user }}
- name: rbenv | ensure ruby_env exists - name: rbenv | ensure ruby_env exists
template: > template: >
src=ruby_env.j2 src=ruby_env.j2
dest={{ rbenv_user_home }}/ruby_env dest={{ rbenv_user_home }}/ruby_env
owner={{ rbenv_user }} owner={{ rbenv_user }}
group={{ rbenv_user }} group={{ rbenv_user }}
tags: tags:
- ruby - ruby
...@@ -118,14 +118,14 @@ ...@@ -118,14 +118,14 @@
- name: rebenv | add source of ruby_env to .bashrc - name: rebenv | add source of ruby_env to .bashrc
lineinfile: lineinfile:
dest="{{ rbenv_user_home }}/.bashrc" dest="{{ rbenv_user_home }}/.bashrc"
regexp='. {{ rbenv_user_home }}/ruby_env' regexp='. {{ rbenv_user_home }}/ruby_env'
line='. {{ rbenv_user_home }}/ruby_env' line='. {{ rbenv_user_home }}/ruby_env'
- name: rbenv | drop a bash_profile - name: rbenv | drop a bash_profile
copy: > copy: >
src=../../common/files/bash_profile src=../../common/files/bash_profile
dest={{ rbenv_user_home }}/.bash_profile dest={{ rbenv_user_home }}/.bash_profile
owner={{ rbenv_user }} owner={{ rbenv_user }}
group={{ rbenv_user }} group={{ rbenv_user }}
- name: rbenv | check ruby-build installed - name: rbenv | check ruby-build installed
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
- name: rbenv | create temporary directory - name: rbenv | create temporary directory
command: mktemp -d command: mktemp -d
register: tempdir register: tempdir
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers) when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)
tags: tags:
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
git: repo=https://github.com/sstephenson/ruby-build.git dest={{ tempdir.stdout }}/ruby-build git: repo=https://github.com/sstephenson/ruby-build.git dest={{ tempdir.stdout }}/ruby-build
when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers) when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
- install - install
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
shell: "{{ rbenv_user_home }}/.rbenv/bin/rbenv versions | grep {{ rbenv_ruby_version }}" shell: "{{ rbenv_user_home }}/.rbenv/bin/rbenv versions | grep {{ rbenv_ruby_version }}"
register: ruby_installed register: ruby_installed
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
ignore_errors: yes ignore_errors: yes
tags: tags:
- ruby - ruby
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
shell: "{{ rbenv_user_home }}/.rbenv/bin/rbenv install {{ rbenv_ruby_version }} creates={{rbenv_user_home}}/.rbenv/versions/{{rbenv_ruby_version}}" shell: "{{ rbenv_user_home }}/.rbenv/bin/rbenv install {{ rbenv_ruby_version }} creates={{rbenv_user_home}}/.rbenv/versions/{{rbenv_ruby_version}}"
when: ruby_installed|failed when: ruby_installed|failed
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
- install - install
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
- name: rbenv | install bundler - name: rbenv | install bundler
shell: "{{ rbenv_user_home }}/.rbenv/shims/gem install bundler -v {{ rbenv_bundler_version }}" shell: "{{ rbenv_user_home }}/.rbenv/shims/gem install bundler -v {{ rbenv_bundler_version }}"
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
- install - install
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
- name: rbenv | rehash - name: rbenv | rehash
shell: "{{rbenv_user_home}}/.rbenv/bin/rbenv rehash" shell: "{{rbenv_user_home}}/.rbenv/bin/rbenv rehash"
sudo: true sudo: true
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags: tags:
- ruby - ruby
- install - install
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