nativeInstalleredx

Migrate Open edX

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

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:

      $ installdir/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:

      $ installdir/mongodb/bin/mongodump --authenticationDatabase admin -h localhost -u root -d bitnami_edxapp --out edx-upgrade-data/bitnami_edx_mongodb
      $ installdir/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 installdir/apps/edx/conf/*.json edx-migrate-data
    $ cp -R installdir/apps/edx/var edx-migrate-data
    $ rm -rf edx-upgrade-data/var/staticfiles/*
    
  • Copy edX XQueue configuration files:

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

    $ cp installdir/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:

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

      $ installdir/mongodb/bin/mongorestore --authenticationDatabase admin -h localhost -u root --drop -d bitnami_edxapp edx-upgrade-data/bitnami_edx_mongodb/bitnami_edxapp
      $ installdir/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 installdir/apps/edx/var
      $ sudo cp -R edx-migrate-data/var installdir/apps/edx/var
      $ sudo chown -R daemon:daemon installdir/apps/edx/var
      
    • (Optional) Review edX Platform configuration for custom changes in the previous installation (e.g. themes, SMTP configuration, etc.):

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

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

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

    • (Optional) Review XQueue configuration for custom changes in your previous installation: installdir/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 installdir/apps/xqueue/bin/django-admin.xqueue migrate --noinput
      
  • Restart Apache, edX Celery Workers and XQueue:

    $ sudo installdir/ctlscript.sh restart apache
    $ sudo installdir/ctlscript.sh restart edx
    $ sudo installdir/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