JetBrains CodeCanvas 2024.2 Help

Restore User Data

Sometimes, a dev environment may stop working correctly, so connecting to it via SSH or the IDE client is impossible. In this case, you can try to get user data (e.g., uncommited changes) from the dev environment volume. CodeCanvas doesn't provide a built-in tool for this, so you need to do this manually using the following main steps:

  1. Get the volume name in the CodeCanvas UI.

  2. In the cloud object storage, find the volume by its name.

  3. In the same cloud, create a virtual machine with the same OS as the dev environment.

  4. Attach the volume to the virtual machine.

  5. Get user data from the volume.

This guide describes the first two steps.

Step 1. Get a volume name

  1. In the header navigation, select Administration, then in the sidebar menu, select Dev environments.

  2. Find the problematic dev environment and in the dev environment menu, click Restore user data.

    Restore a dev environment
  3. In the dialog, copy the volume name.

    Restore a dev environment

Step 2. Find the volume

You can get the required volume either in the AWS Management Console or in the Kubernetes cluster using the kubectl command.

  1. Open AWS Management Console.

  2. Open the EC2 service.

  3. Under Elastic Block Store, click Volumes.

  4. In the Volumes list, start searching by the following tag: kubernetes.io/created-for/pvc/name

  5. In Operators, select Equals and paste the volume name you got from CodeCanvas.

    Restore an EBS volume
  6. As a result, you will see the required volume which you can attach to a virtual machine.

    Restore an EBS volume
  1. Get information about the related persistent volume claim (PVC) in the Kubernetes cluster:

    kubectl describe pvc -n NAMESPACE_NAME VOLUME_NAME_FROM_CODECANVAS

    For example:

    kubectl describe pvc -n my-codecanvas 5556191681540985008

    In the output, find the Volume field:

    Name: 5556191681540985008 Namespace: my-codecanvas StorageClass: ebs-sc Status: Bound Volume: pvc-d20a1bf8-36c3-4d18-ae42-79432526f65b Labels: ... ...
  2. Use the Volume value to get the related persistent volume (PV):

    kubectl describe pv -n NAMESPACE_NAME VOLUME_VALUE_FROM_PVC

    For example:

    kubectl describe pv -n my-codecanvas pvc-d20a1bf8-36c3-4d18-ae42-79432526f65b

    In the output, find the Source.VolumeHandle field:

    Name: pvc-d20a1bf8-36c3-4d18-ae42-79432526f65b Labels: <none> Annotations: ... Finalizers: [kubernetes.io/pv-protection external-attacher/ebs-csi-aws-com] StorageClass: ebs-sc Status: Bound Claim: my-codecanvas/5556191681540985008 Reclaim Policy: Delete Access Modes: RWO VolumeMode: Filesystem Capacity: 101Gi Node Affinity: Required Terms: Term 0: topology.ebs.csi.aws.com/zone in [eu-west-1a] Message: Source: Type: CSI (a Container Storage Interface (CSI) volume source) Driver: ebs.csi.aws.com FSType: ext4 VolumeHandle: vol-0b56ca4e68437875a ReadOnly: false VolumeAttributes: ... Events: <none>

    The VolumeHandle value is the AWS volume ID. In our example, it is vol-0b56ca4e68437875a.

You can get the required volume either in the Google Cloud Console or in the Kubernetes cluster using the kubectl command.

  1. In Google Cloud Console, open the Kubernetes Engine service.

  2. Under Resource Management, click Storage.

  3. In Cluster, select the cluster with the dev environment.

  4. Use a filter by Name and paste the volume name you got from CodeCanvas.

    Restore a GCP volume
  5. Copy the value from the Volume column. It must start with pvc- prefix. E.g., pvc-12345678-1234-1234.

  6. Open the Compute Engine service.

  7. Under Storage, click Disks.

  8. Use a filter by Name and paste the value you got from the previous step (e.g., pvc-12345678-1234-1234).

  9. As a result, you will see the required volume which you can attach to a virtual machine.

    Restore a GCP volume
  1. Get information about the related persistent volume claim (PVC) in the Kubernetes cluster:

    kubectl describe pvc -n NAMESPACE_NAME VOLUME_NAME_FROM_CODECANVAS

    For example:

    kubectl describe pvc -n my-codecanvas 5556191681540985008

    In the output, find the Volume field:

    Name: 8309948235062827357 Namespace: my-codecanvas StorageClass: workers-storageclass Status: Bound Volume: pvc-7a4647e9-5e22-473a-b7bc-e8c4cfcf7c05 Labels: ... ...
  2. Use the Volume value to get the related persistent volume (PV):

    kubectl describe pv -n NAMESPACE_NAME VOLUME_VALUE_FROM_PVC

    For example:

    kubectl describe pv -n my-codecanvas pvc-7a4647e9-5e22-473a-b7bc-e8c4cfcf7c05

    In the output, find the Source.VolumeHandle field:

    Name: pvc-7a4647e9-5e22-473a-b7bc-e8c4cfcf7c05 Labels: <none> Annotations: ... Finalizers: [kubernetes.io/pv-protection external-attacher/pd-csi-storage-gke-io] StorageClass: workers-storageclass Status: Bound Claim: my-codecanvas/8309948235062827357 Reclaim Policy: Delete Access Modes: RWO VolumeMode: Filesystem Capacity: 101Gi Node Affinity: Required Terms: Term 0: topology.kubernetes.io/zone in [europe-west1-b] Message: Source: Type: CSI (a Container Storage Interface (CSI) volume source) Driver: pd.csi.storage.gke.io FSType: ext4 VolumeHandle: projects/dev-workers/zones/europe-west1-b/disks/pvc-7a4647e9-5e22-473a-b7bc-e8c4cfcf7c05 ReadOnly: false VolumeAttributes: ...

    In the VolumeHandle field, you're interested only in the last part of the value after the last slash. In our example, it is pvc-7a4647e9-5e22-473a-b7bc-e8c4cfcf7c05. This is the GCP persistent disk ID.

You can get the required volume either in the Azure Portal or in the Kubernetes cluster using the kubectl command.

  1. Open Azure Portal.

  2. Open Disks.

  3. Click Add filter and in Filters, select the kubernetes.io-created-for-pvc-name tag.

  4. In Operator, select Equals and paste the volume name you got from CodeCanvas to the Value field.

    Restore an Azure volume
  5. Click Apply. As a result, you will see the required volume.

    Restore an Azure volume
  1. Get information about the related persistent volume claim (PVC) in the Kubernetes cluster:

    kubectl describe pvc -n NAMESPACE_NAME VOLUME_NAME_FROM_CODECANVAS

    For example:

    kubectl describe pvc -n my-codecanvas 4587199150817713543

    In the output, find the Volume field:

    Name: 4587199150817713543 Namespace: my-codecanvas StorageClass: managed-csi Status: Bound Volume: pvc-66731b2f-fd27-4323-88c1-cbfa4ed0ea6f Labels: ... ...
  2. Use the Volume value to get the related persistent volume (PV):

    kubectl describe pv -n NAMESPACE_NAME VOLUME_VALUE_FROM_PVC

    For example:

    kubectl describe pv -n my-codecanvas pvc-66731b2f-fd27-4323-88c1-cbfa4ed0ea6f

    In the output, find the Source.VolumeHandle field:

    Name: pvc-66731b2f-fd27-4323-88c1-cbfa4ed0ea6f Labels: <none> Annotations: ... Finalizers: [external-provisioner.volume.kubernetes.io/finalizer kubernetes.io/pv-protection external-attacher/disk-csi-azure-com] StorageClass: managed-csi Status: Bound Claim: my-codecanvas/4587199150817713543 Reclaim Policy: Delete Access Modes: RWO VolumeMode: Filesystem Capacity: 101Gi Node Affinity: Required Terms: Term 0: topology.disk.csi.azure.com/zone in [] Message: Source: Type: CSI (a Container Storage Interface (CSI) volume source) Driver: disk.csi.azure.com FSType: VolumeHandle: /subscriptions/8fd64-98c4f3a20/resourceGroups/mc_azure-doc-helm-v3_azure-doc-helm-v3_northeurope/providers/Microsoft.Compute/disks/pvc-66731b2f-fd27-4323-88c1-cbfa4ed0ea6f ReadOnly: false VolumeAttributes: ...

    In the VolumeHandle field, you're interested only in the last part of the value after the last slash. In our example, it is pvc-66731b2f-fd27-4323-88c1-cbfa4ed0ea6f. This is the Azure disk ID.

Last modified: 17 September 2024