Restoring DevOps Test Hub data on Ubuntu

You can restore the data that is backed up in Test Hub at any point in time after you install latest version.

Before you begin

You must have completed the following tasks:

  • Been assigned the same role that was required to install and uninstall Test Hub.

  • Been granted with the sudo access.

  • Communicated to the users that Test Hub might be unavailable for some time until the process is complete.

  • Backed up the data from Test Hub.

About this task

The following procedure is for the restoration of the server data from the current release. If you are upgrading Test Hub, then you can restore the data from the earlier version to the latest version during the installation of Test Hub. For more information, see the Related information section.

Procedure

  1. Log in to the Ubuntu server and open a terminal.
  2. Run the following command to extract the base:
    helm pull --untar hclsoftware/hcl-onetest-base --version 13.1054.0
  3. Change to the hcl-onetest-base directory.
    This directory contains the backup.sh script which is required to complete the restore operation.
  4. Create a directory that contains metadata related to the Persistent Volume Claims and their Persistent Volumes by running the following command if you have not done before:
    sudo ./backup.sh create-pvc-links

    You can use the following optional parameter along with the create-pvc-links command:

    --volumes or -v: Use this parameter to specify the directory path of the Volumes.

    For example, backup.sh create-pvc-links -v hcl-onetest-base/my-pvc-links creates a directory called my-pvc-links that stores the metadata required to restore your user data.

    Remember:
    • If you did not provide the volume parameter, by default, the command creates a sub-directory in the same directory where you have the backup script.

    • You must ensure that the directory you create must be empty or not exist to avoid script failure.

  5. Run the following command to stop the cluster and Test Hub:
    k3s-killall.sh
  6. Run the following command to restore the backed-up user data:
    sudo ./backup.sh restore [options] <backup-file-name>

    The restore command overwrites the existing Persistent Volumes with data from the <backup-file-name>.

    You can use the following parameters along with the restore command:

    • --namespace or -n: Use this parameter to restore a specific namespace from the backup file. If you do not mention the namespace, then volumes from all the namespaces in the backup file are restored. You can map one namespace to another namespace by using a colon (:). The syntax is:
      --namespace <name of the namespace> [:<target-namespace>]
    • --release or -r: Use this parameter if the Helm release name of the server to which the backup is being restored is different than the Helm release name of the server where the backup was taken. The syntax is:
      --release <backup-release>:<target-release>
    • --volumes or -v: Use this parameter to specify the directory path of the volumes. The syntax is:
      --volumes <path-of-the-directory>
    • -k or --confirm: Use this parameter to skip the confirmation step.

    For example,
    sudo ./backup.sh restore --namespace test-system:devops-system -r rel-1:rel-2 -k my-backup.tar.gz

    This command restores the volumes that are backed up from the rel-1 release in the test-system namespace to the rel-2 release in the devops-system namespace and skips the confirmation step.

  7. Run the following command to restart the cluster and Test Hub:
    sudo systemctl start k3s
    Note:
    • The cluster and Test Hub might take some time to restart and until that time, you cannot access the Test Hub URL.

    • You can run the kubectl get pods -A command to verify that the Kubernetes environment is working. After a while, the status of the pods must be Running state.

Results

You have restored the data of Test Hub.