From 8a74f452a9a71ad2a30e5f4117aa1e71f5fc3c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 30 Jan 2019 19:18:23 +0100 Subject: [PATCH] Create persistent volumes for minikube Running the import works in minikube! --- README.md | 18 ++++++++++++++++++ staging/db-migration-worker-deployment.yaml | 12 ++++++++++++ staging/neo4j-deployment.yaml | 7 +++++++ staging/volumes/mongo-export-claim.yaml | 11 +++++++++++ staging/volumes/mongo-export-volume.yaml | 12 ++++++++++++ staging/volumes/ssh-keys-volume-claim.yml | 11 +++++++++++ staging/volumes/ssh-keys-volume.yaml | 12 ++++++++++++ staging/volumes/uploads-claim.yaml | 11 +++++++++++ staging/volumes/uploads-volume.yaml | 12 ++++++++++++ 9 files changed, 106 insertions(+) create mode 100644 staging/volumes/mongo-export-claim.yaml create mode 100644 staging/volumes/mongo-export-volume.yaml create mode 100644 staging/volumes/ssh-keys-volume-claim.yml create mode 100644 staging/volumes/ssh-keys-volume.yaml create mode 100644 staging/volumes/uploads-claim.yaml create mode 100644 staging/volumes/uploads-volume.yaml diff --git a/README.md b/README.md index 17fbe5780..29faf84d5 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ kubectl apply -f secrets.yaml ## Deploy the app ```shell cd ./staging +kubectl apply -f ./volumes kubectl apply -f neo4j-deployment.yaml -f backend-deployment.yaml -f web-deployment.yaml -f db-migration-worker-deployment.yaml ``` This can take a while. @@ -68,3 +69,20 @@ kubectl expose deployment nitro-web --namespace=staging --type=LoadBalancer minikube service nitro-backend --namespace=staging minikube service nitro-web --namespace=staging ``` + + +## Provisioning db-migration-worker +Copy your private ssh key and the `.known-hosts` file of your remote legacy server. +```shell + +# check the corresponding db-migration-worker pod +kubectl --namespace=staging get pods +# change below +kubectl cp path/to/your/ssh/keys/folder staging/nitro-db-migration-worker-:/root/ +``` + +Run the migration: +```shell +# change below +kubectl --namespace=staging exec -it nitro-db-migration-worker- ./import.sh +``` diff --git a/staging/db-migration-worker-deployment.yaml b/staging/db-migration-worker-deployment.yaml index 7b06dcb6d..509f98093 100644 --- a/staging/db-migration-worker-deployment.yaml +++ b/staging/db-migration-worker-deployment.yaml @@ -58,6 +58,18 @@ spec: name: nitro-db-migration-worker resources: {} imagePullPolicy: Always + volumeMounts: + - mountPath: /root/ + name: ssh-keys-directory + - mountPath: /mongo-export/ + name: mongo-export restartPolicy: Always + volumes: + - name: ssh-keys-directory + persistentVolumeClaim: + claimName: ssh-keys-claim + - name: mongo-export + persistentVolumeClaim: + claimName: mongo-export-claim terminationGracePeriodSeconds: 30 status: {} diff --git a/staging/neo4j-deployment.yaml b/staging/neo4j-deployment.yaml index 66cf5a966..e8268b047 100644 --- a/staging/neo4j-deployment.yaml +++ b/staging/neo4j-deployment.yaml @@ -46,5 +46,12 @@ spec: # - containerPort: 7473 resources: {} imagePullPolicy: IfNotPresent + volumeMounts: + - mountPath: /mongo-export/ + name: mongo-export restartPolicy: Always + volumes: + - name: mongo-export + persistentVolumeClaim: + claimName: mongo-export-claim status: {} diff --git a/staging/volumes/mongo-export-claim.yaml b/staging/volumes/mongo-export-claim.yaml new file mode 100644 index 000000000..1c91996db --- /dev/null +++ b/staging/volumes/mongo-export-claim.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: mongo-export-claim + namespace: staging +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 1Gi diff --git a/staging/volumes/mongo-export-volume.yaml b/staging/volumes/mongo-export-volume.yaml new file mode 100644 index 000000000..945c28765 --- /dev/null +++ b/staging/volumes/mongo-export-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mongo-export-volume + namespace: staging +spec: + accessModes: + - ReadWriteMany + capacity: + storage: 1Gi + hostPath: + path: /data/shared/mongo-exports/ diff --git a/staging/volumes/ssh-keys-volume-claim.yml b/staging/volumes/ssh-keys-volume-claim.yml new file mode 100644 index 000000000..30191a500 --- /dev/null +++ b/staging/volumes/ssh-keys-volume-claim.yml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: ssh-keys-claim + namespace: staging +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Mi diff --git a/staging/volumes/ssh-keys-volume.yaml b/staging/volumes/ssh-keys-volume.yaml new file mode 100644 index 000000000..9c0353b74 --- /dev/null +++ b/staging/volumes/ssh-keys-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: ssh-keys-volume + namespace: staging +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: 1Mi + hostPath: + path: /data/pv0001/ diff --git a/staging/volumes/uploads-claim.yaml b/staging/volumes/uploads-claim.yaml new file mode 100644 index 000000000..c1b11ed4e --- /dev/null +++ b/staging/volumes/uploads-claim.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: uploads-claim + namespace: staging +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 8Gi diff --git a/staging/volumes/uploads-volume.yaml b/staging/volumes/uploads-volume.yaml new file mode 100644 index 000000000..4600a76a4 --- /dev/null +++ b/staging/volumes/uploads-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: uploads-volume + namespace: staging +spec: + accessModes: + - ReadWriteMany + capacity: + storage: 8Gi + hostPath: + path: /data/shared/uploads/