Restore CloudBees CD/RO on Kubernetes

3 minute readReference

This page outlines the processes and steps needed to recover your CloudBees CD/RO server and help ensure critical data is not lost due to unforeseen circumstances.

Depending on your specific environment, not all information here may be relevant. Additionally, if your environment is highly-customized, the steps here may not be the most optimal, and additional solutions may be required.

Lastly, there are multiple third-party solutions for creating and restoring backups, including locally and cloud-hosted tools. CloudBees offers no support for these tools, except for the specific use cases explained in the product documentation.

Restore configuration data

As part of restoring your cluster you must have the:

  • Keystore file

  • Passkeys file

Additionally, these files must be converted to base64 format, which can then be included in your helm install/upgrade command.

To convert your keystore and passkey files to base64:

  1. For your keystore backup file, run the following command:

    base64 -i keystore -o keystore.b64
  2. For your passkey backup file, run the following command:

    base64 -i passkey -o passkey.b64

Your files can now be included with your helm install/upgrade command. To continue with restoring your data, refer to Restore CloudBees CD/RO server data.

Restore CloudBees CD/RO server data

There are several ways to restore CloudBees CD/RO data:

Restore CloudBees CD/RO database on Kubernetes

To restore your backup database in CloudBees CD/RO:

You must have a copy of your license.xml to complete the following steps.
  1. Start the database service in your Kubernetes cluster using your backup version.

  2. In your values file, ensure the following entries are present and updated for your database:

    • database.externalEndpoint

    • database.dbPort

    • database.dbType

    • database.dbName

    • database.dbUser

    • database.dbPassword

  3. Set the following variables:

    If performing a complete recovery, the keystore and passkey files must be in base64 format to include them in your helm install/upgrade command. If you have not already done so, refer to Restore configuration data before proceeding.

    releaseName="<your-current-release>" namespace="<your-current-release-namespace>" valuesFile="<path-to-your-values-file.yaml>" passkeyFile="<path-to-your-passkey.b64>" keystoreFile="<path-to-your-keystore.b64>" licenseFile="<path-to-your-license.xml>"
  4. Install CloudBees CD/RO using your helm install command.

    Example helm install command:

    helm install $releaseName cloudbees/cloudbees-flow --namespace $namespace \ --values $valuesFile \ --set-file server.customConfig.passkey\\.b64=$passkeyFile \ --set-file server.customConfig.keystore\\.b64=$keystoreFile \ # Helm upgrades exit when all tasks are complete, regardless of timeout. # However, if your database is very large, the timeout may need to be increased to prevent returning a FAILED status. # For instance: --timeout 10800s --timeout 4200s \ --set-file flowLicense.licenseData=$licenseFile
If you are installing a CloudBees CD/RO instance with an external database, do not use the --wait option. The flow-server-init-job cannot be started if --wait is used.

Restore to a previous CloudBees CD/RO Helm release

If you attempted an upgrade that failed or made an undesired change, you can restore your environment to a previous CloudBees CD/RO Helm release version.

To restore CloudBees CD/RO to a previous Helm release version:

  1. Use helm history to find the revision number to restore to.

    To restore a version of CloudBees CD/RO, you must have a database backup file of that version available.

    For example, run:

    Command
    Example
    helm history <release-name>
    helm history cloudbees-cd
  2. Use helm rollback to roll back to the desired revision. For example, run:

    Command
    Example
    helm rollback <release-name> <revision>
    helm rollback cloudbees-cd 4
  3. Restart the database service in your Kubernetes cluster using your backup version.

    • Examples include:

      MySQL
      MS SQL Server
      Oracle
      PostgreSQL
      mysql -u <username> -p<password> <db_name> < tmp/backup.sql # For `-p<password>`, there is no space after `-p`.
      sqlcmd -S <server_name> -U <username> -P <password> -Q "RESTORE DATABASE [DB_NAME] FROM DISK = N'/path/to/backup.bak' WITH FILE = 1, NOUNLOAD, REPLACE, STATS = 5"
      impdp <username>/<password>@<service_name> DIRECTORY=<directory_object> DUMPFILE=<backup_file.dmp> REMAP_SCHEMA=<source_schema>:<target_schema>
      psql -U <username> -d <database_name> -f /path/to/backup.sql

For additional guidance, please contact CloudBees Support.

Restore CloudBees CD/RO instance using XML backup

If you have an XML backup of your CloudBees CD/RO data, this file can be imported using ectool import. For more information, refer to ectool import.

Your CloudBees CD/RO instance must already be running and connected to your database for this process to work correctly.