Restore a managed instance when it is completely gone
SOC2/CI-110
For MI 1.1, see the new process here.
Assess what is deleted
Navigate to sourcegraph-managed-$CUSTOMER
project, and look at existing compute instance. Does the VM still exist?
-
No, the VM is gone.
- Does the data disk
default-$CURRENT_DEPLOYMENT-data-disk
still exists?
- Does the data disk
-
Yes, follow operation guides to troubleshoot services condition. If unable to recover running services on the VM, fallback to re-create the VM with a new data disk from disk snapshot.
Re-create the VM with existing data disk
- Open sourcegraph/deploy-sourcegraph-managed and check out to the
$CUSTOMER
directory - Run
terraform apply
to reconcile the infrastructure to its definition in code. - Follow confirm instance health
Re-create the VM with new data disk from disk snapshot
-
Run
gcloud compute snapshots list --project=sourcegraph-managed-$CUSTOMER --sort-by="~creationTimestamp" --limit=5 --format="table(name,creationTimestamp)"
and copy the name of the latest snapshot -
Go to sourcegraph/deploy-sourcegraph-managed and create a new branch
$CUSTOMER/restore-instance
-
Edit
$CUSTOMER/terraform.tfvars
. NOTES: the key could beblack
depending on the current active instancedisks = { red = { from_snapshot = "REPLACE_ME_WITH_SNAPSHOT_NAME" } }
-
Run
terraform apply
to reconcile the infrastructure to its definition in code. -
Follow confirm instance health
-
Commit your changes and open a Pull Request