diff --git a/CHANGELOG.md b/CHANGELOG.md index 37eb26226cc..12962f37c89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. Add any new changes to the top (right below this line). + - 2021-10-19 + - Role: edxapp + - Added a new task to create all required MongoDB indexes by using ensure_indexes lms command + - Role: forum + - Added a new task to rebuild MongoDB indexes + - 2021-07-19 - Role: edx_django_service - Allows writing extra requirements to an 'extra.txt' requirements file in the service's requirements directory. diff --git a/playbooks/roles/edxapp/tasks/deploy.yml b/playbooks/roles/edxapp/tasks/deploy.yml index e51271a6fd6..089f5ce2b53 100644 --- a/playbooks/roles/edxapp/tasks/deploy.yml +++ b/playbooks/roles/edxapp/tasks/deploy.yml @@ -519,3 +519,7 @@ tags: - manage - manage:db + +- name: Create required MongoDB indexes + shell: ". {{ edxapp_app_dir }}/edxapp_env && {{ edxapp_venv_bin }}/python {{ edxapp_code_dir }}/manage.py lms ensure_indexes" + become_user: "{{ edxapp_user }}" diff --git a/playbooks/roles/forum/tasks/deploy.yml b/playbooks/roles/forum/tasks/deploy.yml index c310acdfb8b..b895f55d26b 100644 --- a/playbooks/roles/forum/tasks/deploy.yml +++ b/playbooks/roles/forum/tasks/deploy.yml @@ -84,6 +84,13 @@ - migrate - migrate:db +- name: rebuild MongoDB indexes + shell: + cmd: bundle exec rake db:init + chdir: "{{ forum_code_dir }}" + become_user: "{{ forum_user }}" + environment: "{{ forum_base_env }}" + # call supervisorctl update. this reloads # the supervisorctl config and restarts # the services if any of the configurations