From 6bab2b1e39cc81fa61b96a5d0a3a1bc938457427 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sat, 2 Oct 2021 16:38:46 +0000 Subject: [PATCH 1/3] docs(operations): document k8s migration process --- docs/operations/migrate-to-k8s.md | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 docs/operations/migrate-to-k8s.md diff --git a/docs/operations/migrate-to-k8s.md b/docs/operations/migrate-to-k8s.md new file mode 100644 index 00000000..8b6754d4 --- /dev/null +++ b/docs/operations/migrate-to-k8s.md @@ -0,0 +1,65 @@ +# Migrate to Kubernetes + +In September / October 2021, codeforphilly.org was migrated from being hosted on a legacy Emergence VM (`poplar.phl.io`) at DigitalOcean to the `cfp-live-cluster` hosted at Linode. + +## Procedure + +1. Configure `KUBECONFIG` to access `cfp-live-cluster`: + + ```bash + export KUBECONFIG=~/.kube/cfp-live-cluster-kubeconfig.yaml + ``` + +2. Find production Pod and store name in shell variable: + + ```bash + pod_name=$(kubectl -n code-for-philly get pod \ + -l app.kubernetes.io/name=code-for-philly \ + -l app.kubernetes.io/instance=code-for-philly \ + --field-selector=status.phase==Running \ + -o jsonpath='{.items[0].metadata.name}' + ) + ``` + +3. Get authenticated SQL dump url from and store in a shell variable: + + ```bash + sql_url='https://codeforphilly.org/site-admin/database/dump.sql?_session=abcdef1234567890' + ``` + +4. Load database into Kubernetes host: + + ```bash + kubectl -n code-for-philly exec "${pod_name}" -- \ + hab pkg exec codeforphilly/site-composite \ + bash -c \ + "curl '${sql_url}' | mysql" + ``` + +5. Install rsync and openssh into running Kubernetes host: + + ```bash + kubectl -n code-for-philly exec "${pod_name}" -- \ + hab pkg install --binlink --force core/rsync core/openssh + ``` + +6. Copy SSH key into Kubernetes host that can connect to legacy VM: + + ```bash + kubectl -n code-for-philly cp .scratch/id_rsa "${pod_name}:/root/" + ``` + +7. User rsync to synchronize data files from legacy VM to Kubernetes host: + + ```bash + kubectl -n code-for-philly exec "${pod_name}" -- \ + rsync \ + -e 'ssh -i /root/id_rsa -o "StrictHostKeyChecking no"' \ + -av \ + --chown hab:hab \ + --exclude '*.log' \ + --exclude 'git/' \ + --exclude 'media/*x*/' \ + 'root@poplar.phl.io:/emergence/sites/code-for-philly/site-data/' \ + '/hab/svc/site/data/' + ``` From 3180f7ce78c43d6980cd0db6a922617d20762501 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sun, 3 Oct 2021 23:07:57 +0000 Subject: [PATCH 2/3] docs: move secret guide to operations --- docs/{development/add-secret.md => operations/deploy-secret.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename docs/{development/add-secret.md => operations/deploy-secret.md} (98%) diff --git a/docs/development/add-secret.md b/docs/operations/deploy-secret.md similarity index 98% rename from docs/development/add-secret.md rename to docs/operations/deploy-secret.md index 00a24163..c2269d5e 100644 --- a/docs/development/add-secret.md +++ b/docs/operations/deploy-secret.md @@ -1,4 +1,4 @@ -# Add a secret +# Deploy a secret ## Prerequisites From 45a64ca68a5dee541d138a09bf9946fc57bbaacd Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Mon, 4 Oct 2021 02:46:34 +0000 Subject: [PATCH 3/3] chore(deps): bump laddr to v3.0.12 --- .holo/sources/laddr.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.holo/sources/laddr.toml b/.holo/sources/laddr.toml index 5321f63f..63c1a57c 100644 --- a/.holo/sources/laddr.toml +++ b/.holo/sources/laddr.toml @@ -1,3 +1,3 @@ [holosource] url = "https://github.com/CodeForPhilly/laddr" -ref = "refs/tags/v3.0.10" +ref = "refs/tags/v3.0.12"