Backing up and restoring the Developer Portal

You can back up individual Developer Portal sites, or all of the sites and Developer Portal configuration settings. You can then restore backed up sites and portal configurations. You can also take snapshots of your Developer Portal servers.

About this task

You can use the backup_site command to back up all of the information that is needed to restore a single Developer Portal site. Or use the backup_devportal command to back up all of your Developer Portal sites and all of the cluster configuration that was set with other commands, such as set_apim_host. For more information, see backup_site and backup_devportal.

You can also take a snapshot of your Developer Portal server by using the tools that are provided by your virtualization environment. Snapshots are useful when you want to preserve the state of a server, so you can return to the same state if needed. For example, for short-term scenarios such as taking a checkpoint immediately before you apply a fix pack upgrade. You can then delete the snapshot after a few days when the changes are confirmed as successful.
Note:
  • Snapshots are not the same as backups. A snapshot is a change log of the original virtual disk, and is not portable. Therefore, do not rely on it as your only backup process. The virtual machine runs on the most current snapshot, not the original vmdk disk files. For optimum recovery readiness, you should take both snapshots and backups of your Developer Portal configuration.
  • Site and Developer Portal backup files don't store details of the users, applications, and subscriptions. This information is stored by the Management server. Backups contain Portal configuration and customization data. If a non-PDUR site hasn't been customized in any way, then it can be restored by re-creating the site in the API Manager UI; for more information see Restoring a Portal site by re-creating in the Troubleshooting the Developer Portal guide.
  • Backup files are intended for recovery on the same API Connect deployment on which they were taken. Extra steps might be needed if you're attempting to restore a backup file on a different API Connect deployment. For example, updating IP addresses and hostnames, restoring Portal sites to different UUIDs (restore_site -i), and so on.

Procedure

Backing up individual Developer Portal sites
  1. Log in to the Developer Portal CLI.
  2. To list all of the sites in your Developer Portal, enter the following command:
    list_sites
    Your sites are listed in the console, each ending in the site URL.
  3. To back up one of the listed sites, enter the following command:
    backup_site -u my.url.com
    where my.url.com is the URL of the site you want to back up.
    The console lists the filepath where the backup has been created, as follows:
    Backup created: backup_file_absolute_path
    where backup_file_absolute_path is the location of the backup file that has been created.
    Important: Copy the backup file to a remote server so that you can restore the Developer Portal site if there is a catastrophic failure.
Restoring individual Developer Portal sites
  1. To list all of the backup files for an individual Developer Portal site, enter the following command:
    ls -ltr /var/aegir/backups/your_site*
    Note: These backup files are listed with the newest at the end of the list.
  2. To restore a target site, select an appropriate backup file, then enter the following command:
    restore_site backup_file_absolute_path
    where backup_file_absolute_path is the location of the backup file you created for the site you want to restore.
To overwrite any existing sites, run the following command:
-f
To specify a new URL to restore the site to, run the following command:
-u
To specify a new UUID to restore the site to, run the following command:
-i
By using -u and -i, you can create a copy of the site at a new URL and UUID, but the UUID must match the UUID that is used by the API Manager. For more information, see Cloning a site into the same cluster.
Backing up your whole Developer Portal
  1. To back up your whole Developer Portal, enter the following command:
    backup_devportal
    The console lists the filepath where the backup has been created, as follows:
    Backup created: backup_file_absolute_path
    where backup_file_absolute_path is the location of the backup file that has been created.
    Important: Copy the backup file to a remote server so that you can restore the whole Developer Portal if there is a catastrophic failure.
Restoring your whole Developer Portal
  1. To list all of the backup files for the whole Developer Portal, enter the following command:
    ls -ltr /home/admin/backups
    Note: These backup files are listed with the most recent files listed at the end:
  2. To restore your whole Developer Portal, enter the following command:
    restore_devportal backup_file_absolute_path
    where backup_file_absolute_path is the location of the backup file that you created for your portal. If you want to restore the node specific configuration, you must include the option -n in the command. See restore_devportal for more options.
Taking a snapshot of a single Developer Portal server
While it is possible to take snapshots with the database running, to ensure data integrity it is recommended that you quiesce the database before you take the snapshot.
  1. Stop the database for your Developer Portal server by using the following command:
    stop_db
  2. Take a snapshot of your server by using the tools that are provided by your virtualization environment.
  3. Start the database for your Developer Portal server by using the following command:
    start_db
Taking a rolling snapshot of a Developer Portal cluster with zero downtime
To avoid the risk of database reclustering issues on restoration, when you take a snapshot of a Developer Portal cluster, the database of each server should be stopped before the snapshot is taken, and then restarted again after. In this way, you can achieve a rolling snapshot of your cluster with zero downtime. If you must restore all the snapshots at the same time, then the cluster will automatically bootstrap itself with the data from the last server that was snapshot.
  1. Stop the database for one of your Developer Portal servers by using the following command:
    stop_db
    Note: If your cluster uses a load balancer, you must stop the load balancer from directing any requests to the server before stopping the database on that server.
  2. Take a snapshot of your server by using the tools that are provided by your virtualization environment.
  3. Start the database for your Developer Portal server by using the following command:
    start_db
    If your cluster uses a load balancer, you can resume directing requests to the restarted database server.
  4. Repeat Steps 1 to 3 for each server in your cluster.
Taking a snapshot of a Developer Portal cluster with downtime
If the databases on all the cluster members are stopped at the same time, the databases will attempt to auto-recover, unless you stop the cron processes first. In this instance, use the following instructions to take snapshots of your Developer Portal cluster:
  1. Stop the cron processes by using the following command on each cluster member server:
    sudo service cron stop
  2. Stop the databases on all cluster member servers by using the following command on any single server:
    bootstrap_cluster -t
  3. Take a snapshot of each server by using the tools that are provided by your virtualization environment.
  4. Bootstrap the database cluster by using the following command on any single cluster member:
    bootstrap_cluster -b
    This command bootstraps the databases by using the most up-to-date stopped cluster member as the master replica.
  5. Start the cron processes again by using the following command on each cluster member:
    sudo service cron start
  6. Wait for all the cluster members to restart. You can check on the current state of the databases on all cluster members that are reachable by running bootstrap_cluster -s.
Note: If you need to restore a snapshot of a single Developer Portal server in a cluster, you must run start_db on its database so the server rejoins the cluster.

You can manage the number of Developer Portal backups that are kept on the file system by setting the variable SITE_BACKUPS_DAYS_WORTH_TO_KEEP in the config.ini file.