Use Swift for Data Storage
To change the default configuration of an Open edX instance to use Swift (the OpenStack Object Store project) for data storage, you update the /edx/app/edx_ansible/server-vars.yml
file.
Before proceeding, review the Guidelines for Updating the Open edX Platform.
You can define all required and optional Swift settings at one time, or you can update settings as needed over time. Each time you update the server-vars.yml
file, you must run the playbook roles and restart the LMS server.
Before you change your data storage configuration, be sure to determine the values that apply to your Swift data storage service, including your credentials and the name of your container. Then, follow these steps.
Define Required Swift Settings
1. Stop the LMS server.
2. Create or edit the /edx/app/edx_ansible/server-vars.yml
file.
Be sure to replace any example values for the settings that follow with values that apply to your instance.
3. Define or verify the following settings.
EDXAPP_SETTINGS: "openstack"
VHOST_NAME: "openstack"
4. To configure Swift, define values for each of the following settings. The EDXAPP_SWIFT_AUTH_VERSION
can be set to either 1 or 2, and defaults to 1 if not specified.
EDXAPP_SWIFT_USERNAME: ""
EDXAPP_SWIFT_KEY: ""
EDXAPP_SWIFT_TENANT_ID: ""
EDXAPP_SWIFT_TENANT_NAME: ""
EDXAPP_SWIFT_AUTH_URL: ""
EDXAPP_SWIFT_AUTH_VERSION:
EDXAPP_SWIFT_REGION_NAME: ""
5. Customize the name of the Swift container that your system's files will be uploaded to by defining the following setting.
EDXAPP_FILE_UPLOAD_STORAGE_BUCKET_NAME: "container_name"
6. To configure storage for grade reports, define the following settings. The name_prefix that you define specifies a common prefix for the files generated by the system.
EDXAPP_GRADE_STORAGE_CLASS: 'swift.storage.SwiftStorage'
EDXAPP_GRADE_STORAGE_KWARGS:
name_prefix: "grades/"
...
ENABLE_GRADE_DOWNLOADS: true
You can continue on to define Swift settings for other features, or complete the following steps to update your instance.
7. Run the following roles.
cd /edx/app/edx_ansible/edx_ansible/playbooks
# Run "openstack" role
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local -e@/edx/app/edx_ansible/server-vars.yml run-role.yml -e 'role=openstack' -e 'edxapp_code_dir=<path to edx-platform directory>'
# Run "edxapp" role
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local -e@/edx/app/edx_ansible/server-vars.yml run-role.yml -e 'role=edxapp' -e 'edx_platform_version=<your branch name>'
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local -e@/edx/app/edx_ansible/server-vars.yml run-role.yml -e 'celery_worker=True' -e 'role=edxapp' -e
'edx_platform_version=<your branch name>
'
8. Restart the LMS server.
9. Repeat this procedure for each instance that has data that you want to store on Swift.
Define Swift Settings for Identity Verification (Proctoring)
To define data storage for files that verify learner identity, follow these steps.
1. Stop the LMS server.
2. Edit the /edx/app/edx_ansible/server-vars.yml
file.
3. Verify that you have defined all of the required Swift settings.
4. Define the following settings.
Be sure to replace any example values for the settings that follow with values that apply to your instance.
EDXAPP_VERIFY_STUDENT:
DAYS_GOOD_FOR: 365
SOFTWARE_SECURE:
STORAGE_CLASS: "swift.storage.SwiftStorage"
STORAGE_KWARGS:
name_prefix: "photos/"
5. Continue on to define Swift settings for other features, or complete steps 7-9 for defining required Swift settings to update your instance.
Note that you only need to run the openstack
role one time. If you are completing these identity verification configuration steps as a separate procedure, you need only run the edxapp
role in step 7.
Define Swift Settings for Temporary URLs
To use temporary URLs for Swift, follow these steps.
1. Stop the LMS server.
2. Edit the /edx/app/edx_ansible/server-vars.yml
file.
3. Verify that you have defined all of the required Swift settings.
4. Define the following settings.
The duration setting is the value, in seconds, for how long a temporary URL remains valid.
SWIFT_USE_TEMP_URLS: true
SWIFT_TEMP_URL_KEY: ""
SWIFT_TEMP_URL_DURATION:
5. Continue on to define Swift settings for other features, or complete steps 7-9 for defining required Swift settings to update your instance.
Note that you only need to run the openstack
role one time. If you are completing these temporary URL configuration steps as a separate procedure, you need only run the edxapp
role in step 7.
Define Swift Settings for XQueue
To define data storage for files for external graders, follow these steps.
1. Stop the LMS server.
2. Edit the /edx/app/edx_ansible/server-vars.yml
file.
3. Verify that you have defined all of the required Swift settings.
4. Define the following settings.
In a basic setup, the values for these variables are the same as for the EDXAPP_SWIFT_* settings.
XQUEUE_SETTINGS: "openstack_settings"
XQUEUE_SWIFT_USERNAME: ""
XQUEUE_SWIFT_KEY: ""
XQUEUE_SWIFT_TENANT_ID: ""
XQUEUE_SWIFT_TENANT_NAME: ""
XQUEUE_SWIFT_AUTH_URL: ""
XQUEUE_SWIFT_AUTH_VERSION:
XQUEUE_SWIFT_REGION_NAME: ""
XQUEUE_UPLOAD_BUCKET: ""
XQUEUE_UPLOAD_PATH_PREFIX: ""
5. Run the following roles (note that it is not necessary to run the openstack role again if it ran at least once before on a given instance).
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local -e@/edx/app/edx_ansible/server-vars.yml run-role.yml -e 'role=openstack' -e 'edxapp_code_dir=<path to edx-platform directory>'
sudo /edx/app/edx_ansible/venvs/edx_ansible/bin/ansible-playbook -i localhost, -c local -e@/edx/app/edx_ansible/server-vars.yml run-role.yml -e 'role=xqueue' # Append more settings here if necessary
6. Restart the LMS server.
7. Repeat this procedure for each instance that has data that you want to store on Swift.
Define Swift Settings for Synchronizing Analytics Logs
To define settings for synchronizing event log files, follow these steps.
1. Stop the LMS server.
2. Edit the /edx/app/edx_ansible/server-vars.yml
file.
3. Verify that you have defined all of the required Swift settings.
4. Define the following settings.
COMMON_OBJECT_STORE_LOG_SYNC: true
...
SWIFT_LOG_SYNC_USERNAME: ""
SWIFT_LOG_SYNC_PASSWORD: ""
SWIFT_LOG_SYNC_TENANT_ID: ""
SWIFT_LOG_SYNC_TENANT_NAME: ""
SWIFT_LOG_SYNC_AUTH_URL: ""
SWIFT_LOG_SYNC_REGION_NAME: ""
Note: If you set COMMON_OBJECT_STORE_LOG_SYNC: true
, you must also define valid values for the SWIFT_LOG_SYNC_*
variables. Otherwise, analytics log synchronization will fail.
5. Continue on to define Swift settings for other features, or complete steps 7-9 for defining required Swift settings to update your instance.