Skip to content

Commit

Permalink
Merge pull request openedx-unsupported#1756 from mitodl/bdero/fix-edx…
Browse files Browse the repository at this point in the history
…app-restart

Fix edxapp not restarting
  • Loading branch information
carsongee committed Jan 28, 2015
2 parents 51b2a59 + 8268bc6 commit 040ff0f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 156 deletions.
20 changes: 0 additions & 20 deletions playbooks/roles/edxapp/handlers/main.yml

This file was deleted.

97 changes: 20 additions & 77 deletions playbooks/roles/edxapp/tasks/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
- name: setup the edxapp env
notify:
- "restart edxapp"
- "restart edxapp_workers"
template: >
src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
owner={{ edxapp_user }} group={{ common_web_user }}
Expand All @@ -11,9 +8,6 @@
file: >
path="{{ EDXAPP_CFG_DIR }}" state=directory
owner="{{ edxapp_user }}" group="{{ common_web_group }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
# Optional auth for git
- name: create ssh script for git (not authenticated)
Expand Down Expand Up @@ -59,16 +53,10 @@
environment:
GIT_SSH: "{{ edxapp_git_ssh }}"
register: edxapp_platform_checkout
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: git clean after checking out edx-platform
shell: cd {{ edxapp_code_dir }} && git clean -xdf
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: checkout theme
git: >
Expand All @@ -81,9 +69,6 @@
environment:
GIT_SSH: "{{ edxapp_git_ssh }}"
register: edxapp_theme_checkout
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: create checksum for requirements, package.json and Gemfile
shell: >
Expand All @@ -105,9 +90,6 @@
command: |
/bin/sed -i -e 's/github\.com/{{ COMMON_GIT_MIRROR }}/g' {{ " ".join(edxapp_all_req_files) }}
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Ruby plays that need to be run after platform updates.
- name: gem install bundler
Expand All @@ -117,9 +99,6 @@
executable=/bin/bash
environment: "{{ edxapp_environment }}"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: bundle install
shell: >
Expand All @@ -128,9 +107,6 @@
executable=/bin/bash
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Set the npm registry
# This needs to be done as root since npm is weird about
Expand All @@ -140,27 +116,18 @@
npm config set registry '{{ COMMON_NPM_MIRROR_URL }}'
creates="{{ edxapp_app_dir }}/.npmrc"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Set the npm registry permissions
- name: Set the npm registry permissions
file:
path="{{ edxapp_app_dir }}/.npmrc"
owner=edxapp group=edxapp
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Node play that need to be run after platform updates.
- name: Install edx-platform npm dependencies
shell: npm install chdir={{ edxapp_code_dir }}
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"


# Install the python pre requirements into {{ edxapp_venv_dir }}
Expand All @@ -172,9 +139,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python modules into {{ edxapp_venv_dir }}
Expand All @@ -187,9 +151,6 @@
chdir={{ edxapp_code_dir }}
environment: "{{ edxapp_environment }}"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python post requirements into {{ edxapp_venv_dir }}
Expand All @@ -201,9 +162,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python paver requirements into {{ edxapp_venv_dir }}
Expand All @@ -215,9 +173,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
when: not inst.stat.exists or new.stat.md5 != inst.stat.md5

# Install the python custom requirements into {{ edxapp_venv_dir }}
Expand All @@ -234,9 +189,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ edxapp_user }}"
environment: "{{ edxapp_environment }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
when: custom_requirements.stat.exists and new.stat.md5 != inst.stat.md5

# Install the final python modules into {{ edxapp_venv_dir }}
Expand All @@ -251,9 +203,6 @@
- "{{ github_requirements_file }}"
- "{{ local_requirements_file }}"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Private requriements require a ssh key to install, use the same key as the private key for edx-platform
# If EDXAPP_INSTALL_PRIVATE_REQUIREMENTS is set to true EDXAPP_USE_GIT_IDENTITY must also be true
Expand All @@ -270,9 +219,6 @@
environment:
GIT_SSH: "{{ edxapp_git_ssh }}"
when: EDXAPP_INSTALL_PRIVATE_REQUIREMENTS
notify:
- "restart edxapp"
- "restart edxapp_workers"

# Install any custom extra requirements if defined in EDXAPP_EXTRA_REQUIREMENTS.
- name: install python extra requirements
Expand All @@ -284,9 +230,6 @@
state=present
with_items: EDXAPP_EXTRA_REQUIREMENTS
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# If using CAS and you have a function for mapping attributes, install
# the module here. The next few tasks set up the python code sandbox
Expand All @@ -298,7 +241,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors"
sudo_user: "{{ edxapp_user }}"
when: EDXAPP_CAS_ATTRIBUTE_PACKAGE|length > 0
notify: "restart edxapp"

# Install the sandbox python modules into {{ edxapp_venv_dir }}
- name : install sandbox requirements into regular venv
Expand All @@ -314,9 +256,6 @@
- "{{ sandbox_post_requirements }}"
sudo_user: "{{ edxapp_user }}"
when: "not EDXAPP_PYTHON_SANDBOX and (not inst.stat.exists or new.stat.md5 != inst.stat.md5)"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# The next few tasks set up the python code sandbox

Expand All @@ -336,9 +275,6 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w --use-mirrors"
sudo_user: "{{ edxapp_sandbox_user }}"
when: EDXAPP_PYTHON_SANDBOX
notify:
- "restart edxapp"
- "restart edxapp_workers"
tags:
- edxapp-sandbox

Expand All @@ -353,9 +289,6 @@
when: EDXAPP_PYTHON_SANDBOX
register: sandbox_install_output
changed_when: sandbox_install_output.stdout is defined and 'installed' in sandbox_install_output.stdout
notify:
- "restart edxapp"
- "restart edxapp_workers"
tags:
- edxapp-sandbox

Expand All @@ -368,23 +301,16 @@
- name: compiling all py files in the edx-platform repo
shell: "{{ edxapp_venv_bin }}/python -m compileall -x .git/.* {{ edxapp_code_dir }}"
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# alternative would be to give {{ common_web_user }} read access
# to the virtualenv but that permission change will require
# root access.
- name: give other read permissions to the virtualenv
command: chmod -R o+r "{{ edxapp_venv_dir }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: create checksum for installed requirements
shell: cp /var/tmp/edxapp.req.new /var/tmp/edxapp.req.installed
sudo_user: "{{ edxapp_user }}"
notify: "restart edxapp"


# https://code.launchpad.net/~wligtenberg/django-openid-auth/mysql_fix/+merge/22726
Expand All @@ -394,9 +320,6 @@
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
sudo_user: "{{ edxapp_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"

# The next few tasks install xml courses.

Expand Down Expand Up @@ -506,3 +429,23 @@
when: COMMON_TAG_EC2_INSTANCE

- set_fact: edxapp_installed=true

- name: restart edxapp
supervisorctl_local: >
state=restarted
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
name="edxapp:{{ item }}"
when: edxapp_installed is defined and celery_worker is not defined and not disable_edx_services
sudo_user: "{{ supervisor_service_user }}"
with_items: service_variants_enabled

- name: restart edxapp_workers
supervisorctl_local: >
name="edxapp_worker:{{ item.service_variant }}_{{ item.queue }}_{{ item.concurrency }}"
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
when: edxapp_installed is defined and celery_worker is defined and not disable_edx_services
with_items: edxapp_workers
sudo_user: "{{ common_web_user }}"
18 changes: 0 additions & 18 deletions playbooks/roles/edxapp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
user: >
name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}"
createhome=no shell=/bin/false
notify:
- "restart edxapp"
- "restart edxapp_workers"
- name: create edxapp user dirs
file: >
path="{{ item }}" state=directory
owner="{{ edxapp_user }}" group="{{ common_web_group }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
with_items:
- "{{ edxapp_app_dir }}"
# needed for the ansible 1.5 git module
Expand Down Expand Up @@ -44,18 +38,12 @@
file: >
path="{{ edxapp_log_dir }}" state=directory
owner="{{ common_log_user }}" group="{{ common_log_user }}"
notify:
- "restart edxapp"
- "restart edxapp_workers"
- name: create web-writable edxapp data dirs
file: >
path="{{ item }}" state=directory
owner="{{ common_web_user }}" group="{{ edxapp_user }}"
mode="0775"
notify:
- "restart edxapp"
- "restart edxapp_workers"
with_items:
- "{{ edxapp_course_data_dir }}"
- "{{ edxapp_upload_dir }}"
Expand All @@ -66,9 +54,6 @@

- name: install system packages on which LMS and CMS rely
apt: pkg={{','.join(edxapp_debian_pkgs)}} state=present update_cache=yes
notify:
- "restart edxapp"
- "restart edxapp_workers"

- name: set up edxapp .npmrc
template:
Expand All @@ -77,9 +62,6 @@
mode=0600

- name: create log directories for service variants
notify:
- "restart edxapp"
- "restart edxapp_workers"
file: >
path={{ edxapp_log_dir }}/{{ item }} state=directory
owner={{ common_log_user }} group={{ common_log_user }}
Expand Down
Loading

0 comments on commit 040ff0f

Please sign in to comment.