Skip to content

BB-987: Add variables needed for setting up the User Retirement pipeline

This PR adds the required variables to correctly set up the User Retirement pipeline inside our AppServers.

Testing instructions:

  1. Pull this branch on your local Ocim devstack,
  2. Start your devstack and SSH into it (vagrant up && vagrant ssh)
  3. Enter django shell (make shell) and spawn a new OpenEdXInstance using the following settings:
instance = OpenEdXInstance.objects.create(
    name='bb-987-test',
    sub_domain="bb-987-test",
    openedx_release="master",
    configuration_source_repo_url="https://github.com/open-craft/configuration.git",
    configuration_version=giovanni/bb-987,
)
  1. Comment out or put fake OVH credentials on the .env file (we don't want to spawn any instance at this point).
  2. Spawn a new AppServer using Ocim we interface (you might need to hit the button twice due to the load balancer configuration failing)
  3. When the appserver shows up on the list, check that the correct Ansible variables are set:
EDXAPP_RETIREMENT_STATES:
- PENDING
- RETIRING_ENROLLMENTS
- ENROLLMENTS_COMPLETE
- RETIRING_LMS_MISC
- LMS_MISC_COMPLETE
- RETIRING_LMS
- LMS_COMPLETE
- RETIRING_CREDENTIALS
- CREDENTIALS_COMPLETE
- ERRORED
- ABORTED
- COMPLETE
...
RETIREMENT_CREDENTIALS_BASE_BASE_URL: http://localhost:8150
RETIREMENT_ECOMMERCE_BASE_BASE_URL: https://ecommerce.hawthorn-giovanni-test.plebia.net
RETIREMENT_LMS_BASE_URL: https://hawthorn-giovanni-test.plebia.net
RETIREMENT_SERVICE_ENABLE_CRON_JOB: true
RETIREMENT_SERVICE_OAUTH_CLIENT_ID: SOMETHING-HERE
RETIREMENT_SERVICE_OAUTH_CLIENT_SECRET: SOMETHING-ELSE-HERE
RETIREMENT_SERVICE_PIPELINE_CONFIGURATION:
- FUNCTION: retirement_unenroll
  NAME: RETIRING_ENROLLMENTS
  NAME_COMPLETE: ENROLLMENTS_COMPLETE
  SERVICE: LMS
- FUNCTION: retirement_lms_retire_misc
  NAME: RETIRING_LMS_MISC
  NAME_COMPLETE: LMS_MISC_COMPLETE
  SERVICE: LMS
- FUNCTION: retirement_lms_retire
  NAME: RETIRING_LMS
  NAME_COMPLETE: LMS_COMPLETE
  SERVICE: LMS
RETIREMENT_SERVICE_SETUP: true
...
"EDXAPP_FEATURES": {
    ...
    "ENABLE_ACCOUNT_DELETION": true
}

Deployment checking: I have already tested the deployment of the User Retirement pipeline on this Ocim instance.

  1. SSH into https://stage.console.opencraft.com/instance/3360/.
  2. Log in as root user with sudo su root -s /bin/bash
  3. Check if the User Retirement script was correctly set up on /edx/app/retirement_service
  4. Check that the cron job is scheduled to run this task daily at midnight.
  5. Create a user and mark it's account for deletion.
  6. Run the retirement script as root:
/edx/app/retirement_service/retire_users.sh

You might find useful to edit /edx/app/retirement_service/retire_users.sh and change --cool_off_days=5 to --cool_off_days=0 instead of waiting 5 days to check if the user was deleted. 😛

Reviewers:

Merge request reports