Upgrading Sunbird

Contribution Guidelines    Edit | Report


Upgrading to the latest version of Sunbird allows you to avail benefits of new and enhanced features and bugs fixed on the platform as well the latest updated versions of any third party component used by it.

  • From release-1.5:
    • All the services are maintained with same image gold version
    • Cassandra migration is introduced to update cassandra database schema.

Upgrading Sunbird Services

  1. Pull the latest code of project-sunbird/sunbird-devops from the master branch.

  2. It is good practice to take a full backup of all the databases before updating the new schema. Follow steps here to take backup.

  3. Run ./sunbird-install.sh. This will deploy the latest version of sunbird services and also update the latest schema on databases.

Note: Latest images versions of all the services are updated in the master branch. To get the particular hotfix image of any Sunbird service, update the minor version in the sunbird-devops/deploy/deploy-core.sh file. Re-run the sunbird-devops/deploy/deploy-core.sh

Backup and Restore of Sunbird Databases

  1. ssh to the database server on which you want to take backup.

  2. Run git clone https://github.com/project-sunbird/sunbird-devops

  3. cd sunbird-devops/deploy/



  • Take a snapshot of Cassandara database using

    nodetool snapshot -t my_backup

  • Copy the snapshot to your backup directory.

    ./cassandra_backup.py <cassandra_data_path> <snapshot_name> <path_to_backup_directory>

    for example:

    ./cassandra_backup.py  /var/lib/cassandra/data my_backup  cassandra_backup_20180412
  • Above command creates the snapshot of all the keyspaces mentioned below.

     portal         -  Stores the session data
     dialcodes      -  Stores the energized text book details
     sunbirdplugin  -  Stores the custom or plugin data(used by announcment team as an object api internally)
     sunbird	       -  Stores the org,user,course,batch,badgr etc..


  • Copy the Cassandra backup snapshot to the instance where you want to run restore.

  • Restore Cassandra database using command

    ./cassandra_restore.py <cassandra_host_ip_address> <snapshotdir>

    for example:

    ./cassandra_restore.py ./cassandra_bakup_20180412



  • Run the script below to take a full backup of the Postgres database.

  • Above command creates the backup file in the location /tmp/postgresql-backup.

  • Backup of Postgres is done for below databases

      api_manager -	Used by kong
      badger	    -	Used by badger services
      Keycloak    -	Used by Keycloak
      quartz      -	Used by sunbird backend services


  • Copy the backup file from the /tmp/postgresql-backup/<backup_file>

  • Run the below command for restore




  • Run the below script for backup

  • Above command creates the backup file in the location /etc/elasticsearch/backup.

  • Backup of Elasticsearch is done for below databases

      searchindex      - Stores the user, org , course, batch data
      sunbirdplugin    - Stores the plugin related data (object API)
      sunbirddataaudit - Stores the user & org audit history data.


Copy the backup file from the /tmp/elasticsearch-backup/<backup_file> to the instance where you want to run restore.


  ./restore_elasticsearch.sh <path/to/the/restore_file	

Note: Install Python on the Cassandra machine, if you use our scripts to backup or restore the Cassandra database.

Edit | Report