openedx-vlead / port-labs-to-openedx

3 stars 8 forks source link

Ability to manage the platform - perform backups, restore from a backup, update to a newer version of Open edX. #6

Closed travula closed 8 years ago

travula commented 8 years ago

Open edX platform has both CMS and LMS features. It uses mysql and nosql (mongodb) databases for saving the course content and student activity.

These databases are backed up and a new platform is restored form the backup.

Note: The Open edX platform software version running on the machine from which backup is made is same as the version running on the machine which is restored from backup.

sivashankerN commented 8 years ago

Please go through the document https://github.com/vlead/port-labs-to-openedx/blob/develop/src/backup.org

sivashankerN commented 8 years ago

Need to work on

  1. Database level backup
  2. File level backup If these files are backing up along with the databases.
sivashankerN commented 8 years ago
  1. Database level Backup

    Open edX platfom uses two databases

    1. Mysql (LMS)
    2. MogoDB (CMS)
sivashankerN commented 8 years ago

Database level backup This is the way to take backup of edX platform

Take backup of MySql database using following command (LMS)

mysqldump -u root -p --all-databases > ./backup.sql

Take backup of MongoDB database using following command (CMS)

mongodump -o ./mongo-backup

Also documented in https://github.com/vlead/port-labs-to-openedx/blob/develop/src/platform-install-configure/backup.org#taking-backup-of-lms-machine

sivashankerN commented 8 years ago

Restore the databases in the new edx-plaform from the backups taken above. Steps to restore

  1. Launch a new VM, install Open edX-platform and Configure it appropriately. Refer https://github.com/vlead/port-labs-to-openedx/blob/develop/src/platform-install-configure/index.org
  2. Copy the taken backups in above steps into newly created platform.
  3. Run the following commands to restore them

Restore MongoDB database

mongorestore -drop ./mongo-backup

Restore Mysql database

mysql -u root -p < ./backup.sql

Steps are documented in https://github.com/vlead/port-labs-to-openedx/blob/develop/src/platform-install-configure/backup.org#restoring-the-database

sivashankerN commented 8 years ago

Successfully restored .Tested the newly created platform after restoring databases. Everything is working fine

Now, need to work on file level backup and restoring them...

sivashankerN commented 8 years ago

Explored how to take backup of files uploaded by Students/Superusers. https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/named-release-birch/building_course/course_files.html

sivashankerN commented 8 years ago

As per google group's suggestions, File level backup is taken care by databases(MySql and MongoDB) backup. Means, Uploaded files(assets) are storing/saving in the form of metadata and bytes into the databases. So all those assets are stored in MongoDB using GridFS. If you connect to your mongo instance and use the edxapp database, you'll see the fs.files and fs.chunks collections. The asset file metadata is stored in fs.files and the actual bytes are in fs.chunks.

Reference: https://groups.google.com/forum/#!topic/edx-code/Zdx8T6YY3IU

sivashankerN commented 8 years ago

So, I tried their suggestions. It worked Performed following step

  1. Uploaded some files into Studio as staff user
  2. Taken backup of MySql and MongoDB databases
  3. Restored them in a new platform Verified that all uploaded files are updated in new platform.
sivashankerN commented 8 years ago

Complete documentation is at https://github.com/vlead/port-labs-to-openedx/blob/develop/src/platform-install-configure/backup.org