@@ -3,6 +3,7 @@ For cost saving reasons, you can migrate the Concourse deployment to a different
3
3
4
4
## Prerequisites
5
5
- Access to the GCP account and the GKE cluster in the current region.
6
+ - You have the "Owner" role in the GCP project ("Editor" is not sufficient).
6
7
- "pg_dump" v16 is installed on the local machine.
7
8
8
9
## Backup Secrets and Databases
@@ -30,7 +31,7 @@ For cost saving reasons, you can migrate the Concourse deployment to a different
30
31
```
31
32
Copy the file from the pod to the local machine:
32
33
``` bash
33
- kubectl -n concourse cp credhub-cli-< id> :/credhub_backup.json credhub_backup.json
34
+ kubectl -n default cp credhub-cli-< id> :/go /credhub_backup.json credhub_backup.json
34
35
```
35
36
:warning : The file ` credhub_backup.json ` contains sensitive data in plaintext, so handle it with care and delete it after the migration.
36
37
@@ -59,6 +60,11 @@ For cost saving reasons, you can migrate the Concourse deployment to a different
59
60
` ` ` yaml
60
61
gke_controlplane_version: "1.31"
61
62
` ` `
63
+ 1. Revert the changes in the Terraform files :
64
+ - In `terraform-modules/concourse/dr_create/credhub_encryption_key.tf`, uncomment the "lifecycle" block.
65
+ - Uncomment module "assertion_encryption_key_identical" (if you commented it before).
66
+ - In `terraform-modules/concourse/infra/database.tf`, set `deletion_protection` and `deletion_protection_enabled` to `true`.
67
+ - In `terraform-modules/concourse/infra/gke_cluster.tf`, remove `deletion_protection = false`.
62
68
1. Now you can check the Terraform plan :
63
69
` ` ` bash
64
70
terragrunt run-all plan
@@ -68,20 +74,43 @@ For cost saving reasons, you can migrate the Concourse deployment to a different
68
74
` ` ` bash
69
75
terragrunt run-all apply
70
76
` ` `
71
- 1. To make the "e2e_test" pass, you must log on with the fly CLI and run the "apply" step again :
77
+ 1. Only for wg-ci-test : To make the "e2e_test" pass, you must log on with the fly CLI and run the "apply" step again:
72
78
` ` ` bash
73
79
fly -t wg-ci-test login -c https://concourse-test.app-runtime-interfaces.ci.cloudfoundry.org
74
80
` ` `
81
+ 1. Refresh your `kubectl` context to the new region :
82
+ ` ` ` bash
83
+ gcloud container clusters get-credentials wg-ci[-test] --region us-east1-b
84
+ ` ` `
75
85
1. Log on to CredHub with the [start-credhub-cli.sh](../../terragrunt/scripts/concourse/start-credhub-cli.sh) script. Copy the credential backup file from to the pod :
76
86
` ` ` bash
77
- kubectl -n concourse cp credhub_backup.json credhub-cli-<id>:/credhub_backup.json
87
+ kubectl -n default cp credhub_backup.json credhub-cli-<id>:/go /credhub_backup.json
78
88
` ` `
79
89
Then import all data :
80
90
` ` ` bash
81
91
credhub import -j -f credhub_backup.json
82
92
` ` `
83
93
1. Restart the Cloud SQL Auth Proxy with the new "Connection name".
94
+ 1. Stop the "web" pod :
95
+ ` ` ` bash
96
+ kubectl -n concourse scale deployment concourse-web --replicas=0
97
+ ` ` `
98
+ 1. Retrieve the new database password :
99
+ ` ` ` bash
100
+ kubectl -n concourse get secret concourse-postgresql-password -o yaml | yq -r .data.password | base64 -d
101
+ ` ` `
102
+ 1. Drop the existing "concourse" database :
103
+ ` ` ` bash
104
+ psql -h 127.0.0.1 -p 5432 -U concourse -d postgres
105
+ DROP DATABASE concourse;
106
+ CREATE DATABASE concourse;
107
+ ` ` `
84
108
1. Restore the Concourse database from the backup :
85
109
` ` ` bash
86
110
psql -h 127.0.0.1 -p 5432 -U concourse -d concourse -f concourse_backup.sql
87
- ` ` `
111
+ ` ` `
112
+ There should be no errors like "relation already exists" or constraint violations.
113
+ 1. Restart the "web" pod :
114
+ ` ` ` bash
115
+ kubectl -n concourse scale deployment concourse-web --replicas=1
116
+ ` ` `
0 commit comments