Back up the portal

Edge for Private Cloud v4.18.05

This section describes how to back up and restore an on-premises installation of Apigee Developer Services portal (or simply, the portal) using the Postgres pg_dump and pg_restore commands.

Before you back up

Before you can back up the portal, you must know the name of the portal's database.

The PG_NAME property in the portal installation config file specifies the name of the portal's database. The example configuration file in the portal installation instructions uses the name "devportal". If you are unsure of the database name, check the config file, or use the following psql command to show the list of databases:

psql -h localhost -d apigee -U postgres -l

Where -U specifies the Postgres username used by the portal to access the database. This is the value of the DRUPAL_PG_USER property in the portal installation config file. You will be prompted for the database password.

This command displays the following list of databases:

    Name     | Owner  | Encoding |   Collate   |    Ctype    |  Access privileges  
-------------+--------+----------+-------------+-------------+---------------------
 apigee      | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/apigee         +
             |        |          |             |             | apigee=CTc/apigee  +
             |        |          |             |             | postgres=CTc/apigee
 devportal   | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 newportaldb | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres    | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0   | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/apigee          +
             |        |          |             |             | apigee=CTc/apigee
 template1   | apigee | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/apigee          +
             |        |          |             |             | apigee=CTc/apigee

Back up the portal

To backup the portal:

  1. Change to the Drupal directory, /opt/apigee/apigee-drupal by default:
    cd /opt/apigee/apigee-drupal
  2. Back up your Drupal database instance with the pg_dump command:
    pg_dump --dbname=portal_db --host=host_IP_address --username=drupaladmin
      --password --format=c > /tmp/portal.bak

    Where:

    • portal_db is the database name. This is the PG_NAME property in the portal installation configuration file. If you are unsure of the database name, see Before you back up.
    • host_IP_address is the IP address of the portal node.
    • drupaladmin is the Postgres username used by the portal to access the database. You defined this with the DRUPAL_PG_USER property in the portal installation configuration file.

    When pg_dump prompts you for the Postgres user password, use the password that you specified with the DRUPAL_PG_PASS property in the portal installation configuration file.

    The pg_dump command creates a copy of the database.

  3. Make a backup of your entire Drupal web root directory. The default webroot location is /opt/apigee/apigee-drupal/wwwroot.
  4. Make a backup of the public files. By default, these files are located in /opt/apigee/apigee-drupal/wwwroot/sites/default/files. If that is the correct location, they will be backed up in Step 3. You must explicitly back them up if you moved them from the default location.
  5. Make a backup of the private files in /opt/apigee/data/apigee-drupal-devportal/private.

    If you are unsure of the location of this directory, use the drush status command to determine the location of the private file system.

Restore the portal

After you have backed up the portal, you can restore from your backup using the pg_restore command.

To restore from the backup to an existing database, use the following command:

pg_restore --clean --dbname=portal_db --host=localhost --username=apigee < /tmp/portal.bak

To restore from the backup and create a new database, use the following command:

pg_restore --clean --create --dbname=portal_db --host=localhost --username=apigee < /tmp/portal.bak

You can also restore the backup files to the Drupal web root directory and the private files.