Skip to content

Commit c249d2b

Browse files
Merge pull request #32 from CodeForPhilly/develop
Release: v1.1.9
2 parents de751f7 + 45a64ca commit c249d2b

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.holo/sources/laddr.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[holosource]
22
url = "https://github.com/CodeForPhilly/laddr"
3-
ref = "refs/tags/v3.0.10"
3+
ref = "refs/tags/v3.0.12"

docs/development/add-secret.md renamed to docs/operations/deploy-secret.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Add a secret
1+
# Deploy a secret
22

33
## Prerequisites
44

docs/operations/migrate-to-k8s.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Migrate to Kubernetes
2+
3+
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.
4+
5+
## Procedure
6+
7+
1. Configure `KUBECONFIG` to access `cfp-live-cluster`:
8+
9+
```bash
10+
export KUBECONFIG=~/.kube/cfp-live-cluster-kubeconfig.yaml
11+
```
12+
13+
2. Find production Pod and store name in shell variable:
14+
15+
```bash
16+
pod_name=$(kubectl -n code-for-philly get pod \
17+
-l app.kubernetes.io/name=code-for-philly \
18+
-l app.kubernetes.io/instance=code-for-philly \
19+
--field-selector=status.phase==Running \
20+
-o jsonpath='{.items[0].metadata.name}'
21+
)
22+
```
23+
24+
3. Get authenticated SQL dump url from <https://codeforphilly.org/site-admin> and store in a shell variable:
25+
26+
```bash
27+
sql_url='https://codeforphilly.org/site-admin/database/dump.sql?_session=abcdef1234567890'
28+
```
29+
30+
4. Load database into Kubernetes host:
31+
32+
```bash
33+
kubectl -n code-for-philly exec "${pod_name}" -- \
34+
hab pkg exec codeforphilly/site-composite \
35+
bash -c \
36+
"curl '${sql_url}' | mysql"
37+
```
38+
39+
5. Install rsync and openssh into running Kubernetes host:
40+
41+
```bash
42+
kubectl -n code-for-philly exec "${pod_name}" -- \
43+
hab pkg install --binlink --force core/rsync core/openssh
44+
```
45+
46+
6. Copy SSH key into Kubernetes host that can connect to legacy VM:
47+
48+
```bash
49+
kubectl -n code-for-philly cp .scratch/id_rsa "${pod_name}:/root/"
50+
```
51+
52+
7. User rsync to synchronize data files from legacy VM to Kubernetes host:
53+
54+
```bash
55+
kubectl -n code-for-philly exec "${pod_name}" -- \
56+
rsync \
57+
-e 'ssh -i /root/id_rsa -o "StrictHostKeyChecking no"' \
58+
-av \
59+
--chown hab:hab \
60+
--exclude '*.log' \
61+
--exclude 'git/' \
62+
--exclude 'media/*x*/' \
63+
'[email protected]:/emergence/sites/code-for-philly/site-data/' \
64+
'/hab/svc/site/data/'
65+
```

0 commit comments

Comments
 (0)