Restoring Developer Portal on OpenShift and Cloud Pak for Integration
You can restore the Developer Portal subsystem and sites in your OpenShift or Cloud Pak for Integration environment.
About this task
Run commands in the namespace where the Developer Portal is installed.
Important: Backups of the Management and Portal subsystems must be taken at the same
time to ensure that the Portal sites are consistent with Management database. When you perform a
restore, you must complete the restoration of the Management subsystem first, and then immediately
restore the Developer Portal subsystem.
Procedure
- Required: Restore up the Management subsystem as explained in Generating a manual backup of the management subsystem on OpenShift and Cloud Pak for Integration.
-
Choose which backup you want to restore.
-
Run the following command to a get a list of available backups:
oc get portalbackup -n <APIC_namespace>
The response looks like the following example:
NAME ID STATUS TYPE CR TYPE AGE COMMENT p1-bup-gqz8f 20200526.142449 Ready system record 55m p1-bup-jx4vc 20200526.142458 Ready site record 54m p1-bup-st4l2 Ready all create 56m y p1-bup-th2dm Ready all create 4h51m y
Note: You can only restore the Portal subsystem from backups where theCR TYPE
isrecord
. -
Run the following command to view the details of a particular backup,, which is specified using
the <bup-name> from the
NAME
column in the list of backups:oc get portalbackup <bup-name> -n <APIC_namespace> -o yaml
The details of a backup look like the following example:
apiVersion: portal.apiconnect.ibm.com/v1beta1 kind: PortalBackup metadata: creationTimestamp: "2020-10-01T10:00:16Z" generateName: portal-bup- generation: 1 name: portal-bup-g66gv namespace: default resourceVersion: "8940" selfLink: /apis/portal.apiconnect.ibm.com/v1beta1/namespaces/default/portalbackups/portal-bup-g66gv uid: b1d5b295-b966-48f2-b6ef-dfcd1c499741 spec: comment: test comment portalCluster: portal crType: record siteName: installed type: site status: backupId: "" commentLeft: "y" conditions: - lastTransitionTime: "2020-10-01T10:00:18Z" reason: BackupFailed status: "False" type: Error - lastTransitionTime: "2020-10-01T10:01:19Z" message: |- 2020-10-01 10:00:18: CLI task (backup:site) starting. 2020-10-01 10:00:20: Making a backup for site conor.com 2020-10-01 10:00:27: A local backup was succesfully created: /var/aegir/backups/conor.com-20201001.100021.tar.gz 2020-10-01 10:00:30: Attempting to upload backup to remote backup server 2020-10-01 10:00:30: Uploading conor.com-20201001.100021.tar.gz to s3.eu-gb.cloud-object-storage.appdomain.cloud/eu-standard:22:cq-test/ptlcq4/ using objstore 2020-10-01 10:00:33: Site with URL conor.com (conor.com-20201001.100021.tar.gz) successfully uploaded 2020-10-01 10:00:33: All installed sites have been successfully backed up 2020-10-01 10:00:33: CLI task (backup:site) completed successfully. reason: BackupComplete status: "True" type: Ready - lastTransitionTime: "2020-10-01T10:01:19Z" reason: BackupInProgress status: "False" type: Running - lastTransitionTime: "2020-10-01T10:00:18Z" reason: BackupStatusUnknown status: "False" type: Warning fullBackupName: "" id: f8t0ux7z4zfnnjnu message: "" phase: Ready state: ""
-
Run the following command to a get a list of available backups:
-
Create the
PortalRestore
CR (custom resource) as a YAML file with the backup options that you want to use for Developer Portal.You can use portalrestore_cr.yaml in the helper_files directory as an example:apiVersion: portal.apiconnect.ibm.com/v1beta1 kind: PortalRestore metadata: generateName: portal-restore- spec: type: all portalCluster: portal dryRun: true timestamp: now priorityList: - myportal-critical-site.com - myportal-important.com
Add the following restore options as needed. Table 1 indicates which options are needed for each type of restore operation:
Table 1. The options that are needed for each type of Developer Portal restore operation Option Applies to all
Applies to system
Applies to site
type
X X X portalCluster
X X X siteName
X systemName
X timestamp
X dryRun
X priorityList
type
: Indicates the extent of the restore operation; specify one of the following options:all
- Restore the Developer Portal subsystem and all of the sites (supports only remote restores).system
- Restore the Developer Portal subsystem.site
- Restore only a specified Developer Portal site (you will indicate the site with thesiteName
option).
portalCluster
is the name of the portal cluster you want to restore. You can find this with:oc get portal -n <namespace>
siteName
: Indicates which site to restore (used only with thesite
option); specify one of the following options:ID
- Restore the backup specified by the ID. The ID must correspond to a Developer Portal backup oftype: site
andcrType: record
.- site-1234.tgz - Restore the site by using this file name (which must exist on the local file system or remote server).
- myportal.com: find the latest backup for this URL (locally or remotely) and restore it.
all
- Restore all sites that are found on the remote server by using the latest backup.site
- Restore only the site that matches the specified uuid or url.installed
- Restore all installed sites.
systemName
- Restore from a backup that corresponds to the specified system; use one of the following options:ID
- Restore the backup specified by the ID. The ID must correspond to a Developer Portal backup oftype: site
andcrType: record
.- system_backup-1234.tgz - Restore the system from the given file that exists on the pod's local file system or the remote server.
latest
- Restore from latest subsystem backup that is found on either the local file system or the remote server.
timestamp
- Valid arguments are:now
- Restore using the latest backups available.< TIMESTAMP >
- Specified in'YYYYMMDD.HHMMSS'
format to indicate a timestamp to retrieve the backup from. The nearest backup, searching backwards from this timestamp, is used.
Note: From IBM® API Connect Version 10.0.3.0, the timestamp format changed toYYYYMMDD.HHMMSS
. For Version 10.0.2.0 and earlier, the timestamp format isYYYY-MM-DD HH:MM:SS
.dryRun
: Indicates whether an an actual restore operation is run; use one of the following options:true
- Execute a test, or dry run, of the command and return the list of actions that will be taken. These actions can be found in the custom resource.false
- Run a real restore operation, replacing the subsystem files and all sites. Any existing sites are reinstalled.
priorityList
- Restore sites in the sequence in which they are listed. The priority sites are queued for restoring first, followed by any remaining sites present in the backup location. Valid arguments are:myportalsite.com
-
mysecondportalsite.com
customPlatformApiHostname
- If theAPI
hostname of your management subsystem platform has changed since taking the backup you are restoring, then update it to the new platform API hostname of the management subsystem. (Optional)
-
Run the following command to create the restore CR, which triggers the restore operation:
oc create -f portalrestore_cr.yaml -n <APIC_namespace>
-
When the restore operation is finished, verify that the restore was successful cy completing
the following steps:
-
Run the following command to get the name of the most recent restore record:
oc get portalrestore -n <APIC_namespace>
The response looks like the following example:
NAME READY AGE portal-restore-twjrp Ready 28s
-
Run the following command to view information about a specific restore operation, which is
indicated with the
<portal_restore_name>
shown in theNAME
column:oc get portalrestore <portal_restore_name> -n <APIC_namespace> -o yaml
The details of a restore look like the following example:
apiVersion: portal.apiconnect.ibm.com/v1beta1 kind: PortalRestore metadata: creationTimestamp: "2020-11-11T10:14:39Z" generateName: portal-restore- generation: 1 name: portal-restore-8f4c5 namespace: portal resourceVersion: "1497597" selfLink: /apis/portal.apiconnect.ibm.com/v1beta1/namespaces/portal/portalrestores/portal-restore-8f4c5 uid: 5a70b657-d998-4989-b9b6-8480e986311d spec: siteName: "20200526.090209" portalCluster: portal type: site status: backupId: "" commentLeft: "" conditions: - lastTransitionTime: "2020-11-11T10:14:39Z" reason: RestoreFailed status: "False" type: Error - lastTransitionTime: "2020-11-11T10:14:39Z" reason: RestorePending status: "False" type: Pending - lastTransitionTime: "2020-11-11T14:55:32Z" message: |- 2020-05-26 13:11:25: CLI task (restore:site) starting. 2020-05-26 13:11:36: Deleting any old site data if it exists... 2020-05-26 13:13:18: Restoring site test.com ... 2020-05-26 13:13:18: . 2020-05-26 13:13:19: Patching the database dump before restoring ... 2020-05-26 13:13:48: . 2020-05-26 13:19:41: Triggering the drush command to restore the site. This may take some time. 2020-05-26 13:19:48: . 2020-05-26 13:25:40: Drush restore command completed. Setting up the site. 2020-05-26 13:25:48: . 2020-05-26 13:30:49: Site test.com restored from backup /var/aegir/backups/test.com-20200526.090209.tar.gz. Initializing the site... 2020-05-26 13:30:52: Restore site completed. 2020-05-26 13:30:52: CLI task (restore:site) completed successfully. reason: RestoreComplete status: "True" type: Ready - lastTransitionTime: "2020-11-11T14:55:32Z" reason: RestoreInProgress status: "False" type: Running - lastTransitionTime: "2020-11-11T10:14:39Z" reason: RestoreStatusUnknown status: "False" type: Warning fullBackupName: "" id: bybyibd99wxtmkmk message: ""
-
Check the contents of the restore and make sure that it contains the following statements,
which indicate a successful operation:
. . . reason: RestoreComplete status: "True" type: Ready
If the operation did not complete successfully, see Troubleshooting Developer Portal backup and restore on OpenShift and Cloud Pak for Integration for information on reviewing logs to help resolve the problem. -
Run the following command to get the name of the most recent restore record: