Restoring a Che instance from a backup

You can restore a Che instance from a backup snapshot by using the CheClusterRestore custom object or chectl:

Restoring a Che instance from a backup by using the CheClusterRestore custom object

You can restore a Che instance from a backup snapshot by using custom resources. A new CheClusterRestore custom object is required every time you restore a Che instance from a backup snapshot. (So editing an already consumed CheClusterRestore custom object, during or after backing up, has no effect.)

Backup snapshots are bound to a Kubernetes or OpenShift cluster. To restore a Che instance, you must only use a backup snapshot that was created in the same Kubernetes or OpenShift cluster.
Do not use the CheClusterRestore custom object to recover a Che instance of an earlier version of Che! Use only chectl to recover a Che instance of an earlier version of Che; see Restoring a Che instance from a backup by using chectl!
Prerequisites
Procedure
  1. Create the CheClusterRestore custom object, which restores a backup:

    apiVersion: org.eclipse.che/v1
    kind: CheClusterRestore
    metadata:
      name: eclipse-che-restore
      namespace: eclipse-che
    spec:
      backupServerConfigRef: backup-server-configuration (1)
      snapshotId: <snapshot_id> (2)
    1 Name of the CheBackupServerConfiguration object that defines what backup server to use. You can find this name as backupServerConfigRef in spec of the CheClusterBackup custom object. (You can also find it as name in metadata of the CheBackupServerConfiguration custom object used to take the backup snapshot you are restoring.)
    2 Optional parameter defining the Snapshot ID to restore from. The default value is the last snapshot in the backup repository on the backup server.

    To reuse a name for CheClusterRestore custom objects, first delete any existing custom object with the same name. To delete it on the command line, use kubectl:

    $ kubectl delete CheClusterRestore <name> -n eclipse-che
  2. Read the status section of the CheClusterRestore object to monitor the recovery process, for example:

    status:
      message: 'Restore is in progress. Start time: <timestamp>' (1)
      stage: Restoring Che related cluster objects (2)
      state: InProgress (3)
    1 Overall state or error message; for example, Restore successfully finished.
    2 Current phase of the recovery process in a human-readable format.
    3 Recovery process state. One of InProgress, Succeeded, or Failed.
  3. Check that the Che instance has been recovered.

    If errors occur in your browser after the recovery, clean up the browser data for the Che domain.
  4. Delete the CheClusterRestore object.

Restoring a Che instance from a backup by using chectl

Using chectl, you can restore a Che instance from a backup snapshot by using any of the following options (as applicable):

Restoring a Che instance from its latest backup by using chectl

To restore the Che instance from its latest backup by using chectl, you can enter latest as the snapshot ID.

Backup snapshots are bound to a Kubernetes or OpenShift cluster. To restore a Che instance, you must only use a backup snapshot that was created in the same Kubernetes or OpenShift cluster.
If the backup snapshot was taken in an earlier version of Che, add the --version=<earlier_version_number> option to the chectl server:restore command to roll back Che to that earlier version.
Prerequisites
Procedure
  1. Run the chectl server:restore command with the following arguments:

    $ chectl server:restore \
    --snapshot-id=latest \ (1)
    --repository-url=<repository-url> \ (2)
    --repository-password=<repository-password> (3)
    1 The latest snapshot.
    2 The backup repository URL as an argument using the --repository-url or -r option. (Omit if using the internal backup server!)
    3 The backup repository password as an argument using the --repository-password or -p option. (Omit if using the internal backup server!)
    Last used backup server information is stored in a Secret inside the Che cluster. When consistently using the same backup server, you can enter the --repository-url and --repository-password options with the chectl server:backup command just once and omit them onward when entering chectl server:backup or chectl server:restore.
  2. When prompted in the output, enter y to confirm:

    ...
     ✔ Snapshot:          ...
     Asking for restore confirmation: Do you want to proceed? [y/n]
    ...
    To skip this question, add the --batch option to the server:restore command.
  3. Verify the output of the entered command. For example:

    ...
      ✔ Scheduling restore...OK
      ✔ Waiting until restore process finishes...OK
    Command server:restore has completed successfully in 05:59.

Restoring a Che instance from a backup by snapshot ID

To restore a Che instance from a particular backup snapshot, you can enter the snapshot ID with chectl.

Backup snapshots are bound to a Kubernetes or OpenShift cluster. To restore a Che instance, you must only use a backup snapshot that was created in the same Kubernetes or OpenShift cluster.
If the backup snapshot was taken in an earlier version of Che, add the --version=<earlier_version_number> option to the chectl server:restore command to roll back Che to that earlier version.
Prerequisites
Procedure
  1. Run the chectl server:restore command with the backup snapshot ID specified using the --snapshot-id= option:

    $ chectl server:restore \
    --snapshot-id=<snapshot-id> \ (1)
    --repository-url=<repository-url> \ (2)
    --repository-password=<repository-password> (3)
    1 The snapshot ID.
    2 The backup repository URL as an argument using the --repository-url or -r option. (Omit if using the internal backup server!)
    3 The backup repository password as an argument using the --repository-password or -p option. (Omit if using the internal backup server!)
    Last used backup server information is stored in a Secret inside the Che cluster. When consistently using the same backup server, you can enter the --repository-url and --repository-password options with the chectl server:backup command just once and omit them onward when entering chectl server:backup or chectl server:restore.
  2. When prompted in the output, enter y to confirm:

    ...
     ✔ Snapshot:          ...
     Asking for restore confirmation: Do you want to proceed? [y/n]
    ...
    To skip this question, add the --batch option to the server:restore command.
  3. Verify the output of the entered command. For example:

    ...
      ✔ Scheduling restore...OK
      ✔ Waiting until restore process finishes...OK
    Command server:restore has completed successfully in 05:59.

Restoring a Che instance by using chectl and a CheClusterBackup custom object

You can restore a Che instance by entering the name of the CheClusterBackup custom object as an argument with the chectl server:restore command.

If the backup snapshot was taken in an earlier version of Che, then chectl server:restore --backup-cr-name=<name_of_custom_object> rolls back Che to that earlier version, which is specified in the CheClusterBackup custom object.
Prerequisites
Procedure
  1. Run the following command on a command line:

    $ chectl server:restore \
    --backup-cr-name=<name_of_custom_object> (1)
    1 The name of the CheClusterBackup custom object.
  2. When prompted in the output, enter y to confirm:

    ...
     Asking for restore confirmation: Do you want to proceed? [y/n]
    ...
    To skip this question, add the --batch option to the server:restore command.
  3. Verify the output of the entered command. For example:

    ...
      ✔ Scheduling restore...OK
      ✔ Waiting until restore process finishes...OK
    Command server:restore has completed successfully in 05:59.