virtualMachineedx

Migrate Open edX

NOTE: Before proceeding to migrate the Bitnami edX stack, ensure that you have performed a complete backup.


Migrate edX

Log in to your edX instance and follow the steps below:

  • Create a directory where to store all the data:

    $ mkdir edx-migrate-data
    
  • Dump databases required by edX:

    • MySQL:

      $ /opt/bitnami/mysql/bin/mysqldump -u root -p --databases bitnami_edxapp bitnami_edxapp_csmh bitnami_xqueue --add-drop-database > edx-upgrade-data/bitnami_edx_mysql.sql
      
    • MongoDB:

      $ /opt/bitnami/mongodb/bin/mongodump --authenticationDatabase admin -h localhost -u root -d bitnami_edxapp --out edx-upgrade-data/bitnami_edx_mongodb
      $ /opt/bitnami/mongodb/bin/mongodump --authenticationDatabase admin -h localhost -u root -d bitnami_cs_comments_service --out edx-upgrade-data/bitnami_edx_mongodb
      
  • Copy edX Platform configuration and data files (which contain uploads, courses, etc.). The commands below also clear the assets to reduce the size of the directory:

    $ cp /opt/bitnami/apps/edx/conf/*.json edx-migrate-data
    $ cp -R /opt/bitnami/apps/edx/var edx-migrate-data
    $ rm -rf edx-upgrade-data/var/staticfiles/*
    
  • Copy edX XQueue configuration files:

    $ cp /opt/bitnami/apps/edx/conf/*.json edx-migrate-data
    
  • Copy edX Forum configuration files:

    $ cp /opt/bitnami/apps/forum/conf/httpd-forum.conf edx-migrate-data
    
  • Compress the generated files:

    $ tar czf edx-migrate-data.tar.gz edx-migrate-data
    
  • Copy edx-migrate-data.tar.gz over to the new edX instance.

Next, log in to the new edX instance and navigate to the directory where you copied edx-migrate-data.tar.gz. Then, proceed with the following steps:

  • Extract the compressed file:

    $ tar xzf edx-migrate-data.tar.gz
    
  • Migrate databases:

    • MySQL:

      $ /opt/bitnami/mysql/bin/mysql -u root -p < edx-upgrade-data/bitnami_edx_mysql.sql
      
    • MongoDB:

      $ /opt/bitnami/mongodb/bin/mongorestore --authenticationDatabase admin -h localhost -u root --drop -d bitnami_edxapp edx-upgrade-data/bitnami_edx_mongodb/bitnami_edxapp
      $ /opt/bitnami/mongodb/bin/mongorestore --authenticationDatabase admin -h localhost -u root --drop -d bitnami_cs_comments_service edx-upgrade-data/bitnami_edx_mongodb/bitnami_cs_comments_service
      
  • Migrate edX Platform data:

    • Replace the edX Platform data directory with the one copied from your previous edX installation:

      $ sudo rm -rf /opt/bitnami/apps/edx/var
      $ sudo cp -R edx-migrate-data/var /opt/bitnami/apps/edx/var
      $ sudo chown -R daemon:daemon /opt/bitnami/apps/edx/var
      
    • (Optional) Review edX Platform configuration for custom changes in the previous installation (e.g. themes, SMTP configuration, etc.):

      • LMS configuration files: /opt/bitnami/apps/edx/conf/lms.auth.json and /opt/bitnami/apps/edx/conf/lms.env.json.
      • CMS configuration files: /opt/bitnami/apps/edx/conf/cms.auth.json and /opt/bitnami/apps/edx/conf/cms.env.json.
    • Run edX Platform migrations:

      $ sudo /opt/bitnami/apps/edx/bin/edxapp-migrate-lms
      $ sudo /opt/bitnami/apps/edx/bin/edxapp-migrate-cms
      
    • Update assets for edX Platform:

      $ sudo /opt/bitnami/apps/edx/bin/edxapp-update-assets-lms
      $ sudo /opt/bitnami/apps/edx/bin/edxapp-update-assets-cms
      
  • Migrate edX XQueue data:

    • (Optional) Review XQueue configuration for custom changes in your previous installation: /opt/bitnami/apps/xqueue/conf/xqueue.yml.

      NOTE: Since edX Hawthorn, a couple of major changes have happened: The XQueue configuration files xqueue.auth.json and xqueue.env.json have been merged into xqueue.yml, and it does not use RabbitMQ anymore.

    • Run edX XQueue migrations:

      $ sudo /opt/bitnami/apps/xqueue/bin/django-admin.xqueue migrate --noinput
      
  • Restart Apache, edX Celery Workers and XQueue:

    $ sudo /opt/bitnami/ctlscript.sh restart apache
    $ sudo /opt/bitnami/ctlscript.sh restart edx
    $ sudo /opt/bitnami/ctlscript.sh restart xqueue
    

Your Bitnami edX stack should now be fully migrated. Confirm that the migration was successful by logging into edX and verifying the integrity of your data.

Last modification August 8, 2019