ora2.yml 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# Deploy a specific version of edx-ora2 and re-run migrations
# edx-ora2 is already included in the requirements for edx-platform,
# but we need to override that version when deploying to
# the continuous integration server for testing ora2 changes.

- name: Update edx-ora2
  hosts: all
  sudo: True
  gather_facts: True
  vars:
    - edxapp_venv_dir: "/edx/app/edxapp/venvs/edxapp"
    - edxapp_code_dir: "/edx/app/edxapp/edx-platform"
    - edxapp_deploy_path: "{{ edxapp_venv_dir }}/bin:{{ edxapp_code_dir }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    - edxapp_user: "edxapp"
    - edxapp_mysql_user: "migrate"
    - edxapp_mysql_password: "password"
    - supervisorctl_path: "/edx/bin/supervisorctl"
    - ora2_version: "master"
    - ora2_pip_req: "git+https://github.com/edx/edx-ora2.git@{{ ora2_version }}#egg=edx-ora2"

  tasks:
    - name: install edx-ora2
      shell: >
        {{ edxapp_venv_dir }}/bin/pip install -e {{ ora2_pip_req }}
        chdir={{ edxapp_code_dir }}
      environment:
        PATH: "{{ edxapp_deploy_path }}"
      sudo_user: "{{ edxapp_user }}"
      notify:
        - "restart edxapp"
31
        - "restart workers"
32 33
      tags:
        - deploy
34

35
    - name: migrate
36
      shell: >
37
        {{ edxapp_venv_dir }}/bin/python manage.py lms migrate --settings=aws
38 39 40 41 42 43
        chdir={{ edxapp_code_dir }}
      environment:
        DB_MIGRATION_USER: "{{ edxapp_mysql_user }}"
        DB_MIGRATION_PASS: "{{ edxapp_mysql_password }}"
      notify:
        - "restart edxapp"
44
        - "restart workers"
45 46
      tags:
        - deploy
47 48 49

  handlers:
    - name: restart edxapp
50 51 52 53
      shell: "{{ supervisorctl_path }} restart edxapp:"

    - name: restart workers
      shell: "{{ supervisorctl_path }} restart edxapp_worker:"