Configure Asset compilation to off-server storage
WARNING: YOU SHOULD MAKE A BACKUP OF YOUR YML CONFIGURATION FILES IN /EDX/ETC/ BEFORE ATTEMPTING THIS CONFIGURATION. IF YOU MAKE ANY SYNTAX ERRORS OR ANY OTHER SUCH MISTAKES THEN THE PLATFORM WILL NOT START.
In the tutorial that follows we’ll setup AWS S3 storage for a hypothetical Open edX installation named www.surfschool.edu. We will store all user data in a single AWS S3 bucket of the same name, www.surfschool.edu.
All configuration is done to yml files in /edx/etc.
vim /edx/etc/FILENAME.YML
/edx/etc/lms.yml
- Basic AWS S3 configuration settings
Create your IAM key/secret here: https://console.aws.amazon.com/iam/home?region=us-east-1#/users. Grant “S3 Full Permissions” to your IAM user. You’ll find this in the “Attach existing policies directly” window tab. Also note that the label for this permissions seems to vary depending on your location, so it could be either “AmazonS3FullAccess” or “AmazonS3OutpostsFullAccess” which, to the best of my knowledge are identical.
The Bucket should be created with the Public access or Objects can be public in order to access contents from the bucket.
Credentials for platform-wide Open edX access to your AWS S3 bucket.
AWS_ACCESS_KEY_ID: AKIA123456789AbCdVWU
AWS_SECRET_ACCESS_KEY: OXFH123456789ABCDefSmWcxsvZXb/stuvwImB
Create your AWS S3 bucket here: https://s3.console.aws.amazon.com/s3/.
The name of your AWS S3 bucket.
AWS_STORAGE_BUCKET_NAME: www.surfschool.edu
AWS_S3_CUSTOM_DOMAIN: 's3.amazonaws.com/www.surfschool.edu'
To Redirect User Profile Images
PROFILE_IMAGE_BACKEND: class: storages.backends.s3boto3.S3Boto3Storage options: headers: Cache-Control: max-age-{{ EDXAPP_PROFILE_IMAGE_MAX_AGE }} location: 'www.surfschool.edu/media/profile-images' base_url: /media/profile-images/
/edx/etc/studio.yml
- Basic AWS S3 configuration settings
Credentials for platform-wide Open edX access to your AWS S3 bucket.
AWS_ACCESS_KEY_ID: AKIA123456789AbCdVWU AWS_SECRET_ACCESS_KEY: OXFH123456789ABCDefSmWcxsvZXb/stuvwImB
The name of your AWS S3 bucket.
AWS_STORAGE_BUCKET_NAME: www.surfschool.edu AWS_S3_CUSTOM_DOMAIN: 's3.amazonaws.com/www.surfschool.edu'
To Redirect Grades Downloads
GRADES_DOWNLOAD: BUCKET: 'grades.academiacentral.org' ROOT_PATH: 'www.surfschool.edu/grades' STORAGE_CLASS: storages.backends.s3boto3.S3Boto3Storage STORAGE_KWARGS: location: '/tmp/edx-s3/grades' STORAGE_TYPE: 's3'
Restart the Server
After the configurations, restart the server.
sudo /edx/bin/supervisorctl restart all