Developer Services Portal v. 4.17.09
This document describes the backup and restore tasks in an on-premises installation of the portal using the Postgres pg_dump and pg_restore commands.
Before you backup
You use the PG_NAME property in the portal installation config file to specify the name of its database. The install instructions for the portal specify to name the database 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 as specified by 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:
- Change to the Drupal directory, /opt/apigee/apigee-drupal by default:
> cd /opt/apigee/apigee-drupal - Back up your Drupal database instance. The pg_dump command creates a copy of the
database:
pg_dump --dbname=devportal --host=192.168.56.101 --username=drupaladmin --password --format=c > /tmp/portal.bak
where:- dbname specifies the database name as specified by the PG_NAME property in the portal installation configuration file.
- host specifies the IP address of the portal node.
- username specifies the Postgres username used by the portal to access the data base as specified by the DRUPAL_PG_USER property in the portal installation configuration file.
- You are prompted for the Postgres user password as defined by the DRUPAL_PG_PASS property in the portal installation configuration file.
- Make a backup of your entire Drupal web root directory. The default webroot location is /opt/apigee/apigee-drupal/wwwroot.
- 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 only have to explicitly back them up if you moved them from the default location.
- 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
To restore from the backup to an existing database, use the command:
pg_restore --clean --dbname=devportal --host=localhost --username=apigee < /tmp/portal.bak
To restore from the backup and create a new database, use the command:
pg_restore --clean --create --dbname=devportal --host=localhost --username=apigee < /tmp/portal.bak
You can also restore the backup files to the Drupal web root directory and the private files.