From 0b075830bc497dde1145aa6a9617687d3f46bc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Sat, 2 Feb 2019 13:33:42 +0100 Subject: [PATCH] Put many configuration files in one folder --- README.md | 47 +++++++++---------- ...onfigmap-db-migration-worker.template.yaml | 0 ...pace-staging.yml => namespace-staging.yaml | 0 secrets.template.yml => secrets.template.yaml | 0 staging/.gitignore | 2 + staging/config/.gitignore | 1 - staging/config/backend.yml | 9 ---- staging/config/neo4j.yml | 9 ---- staging/config/web.yml | 8 ---- staging/configmaps.yaml | 29 ++++++++++++ .../backend.yml => deployment-backend.yaml} | 0 ...ml => deployment-db-migration-worker.yaml} | 0 .../neo4j.yml => deployment-neo4j.yaml} | 0 .../web.yml => deployment-web.yaml} | 0 .../backend.yml => service-backend.yaml} | 0 .../neo4j.yml => service-neo4j.yaml} | 0 .../{services/web.yml => service-web.yaml} | 0 ...rt.yml => volume-claim-mongo-exports.yaml} | 0 .../uploads.yml => volume-claim-uploads.yaml} | 0 19 files changed, 52 insertions(+), 53 deletions(-) rename db-migration-worker.template.yml => configmap-db-migration-worker.template.yaml (100%) rename namespace-staging.yml => namespace-staging.yaml (100%) rename secrets.template.yml => secrets.template.yaml (100%) create mode 100644 staging/.gitignore delete mode 100644 staging/config/.gitignore delete mode 100644 staging/config/backend.yml delete mode 100644 staging/config/neo4j.yml delete mode 100644 staging/config/web.yml create mode 100644 staging/configmaps.yaml rename staging/{deployments/backend.yml => deployment-backend.yaml} (100%) rename staging/{deployments/db-migration-worker.yml => deployment-db-migration-worker.yaml} (100%) rename staging/{deployments/neo4j.yml => deployment-neo4j.yaml} (100%) rename staging/{deployments/web.yml => deployment-web.yaml} (100%) rename staging/{services/backend.yml => service-backend.yaml} (100%) rename staging/{services/neo4j.yml => service-neo4j.yaml} (100%) rename staging/{services/web.yml => service-web.yaml} (100%) rename staging/{volumes/mongo-export.yml => volume-claim-mongo-exports.yaml} (100%) rename staging/{volumes/uploads.yml => volume-claim-uploads.yaml} (100%) diff --git a/README.md b/README.md index 3fb1a983b..0225f0aa9 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,20 @@ # Human-Connection Nitro | Deployment Configuration -> Currently the deployment is not primetime ready as you still have to do some manual work. That we need to change, the following list gives some glimpse of the missing steps. - -## Todo`s -- [ ] check labels and selectors if they all are correct -- [ ] configure NGINX from yml +Todos: +- [x] check labels and selectors if they all are correct +- [x] configure NGINX from yml - [ ] configure Let's Encrypt cert-manager from yml -- [ ] configure ingress form yml -- [ ] configure persistent & shared storage between nodes +- [x] configure ingress from yml +- [x] configure persistent & shared storage between nodes - [x] reproduce setup locally ## Minikube -There are many Kubernetes distributions, but if you're just getting started, Minikube is a tool that you can use to get your feet wet. +There are many Kubernetes distributions, but if you're just getting started, +Minikube is a tool that you can use to get your feet wet. [Install Minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/) -### Open minikube dashboard +Open minikube dashboard: ``` $ minikube dashboard ``` @@ -24,10 +23,9 @@ Some of the steps below need some timing to make ressources available to other dependent deployments. Keeping an eye on the dashboard is a great way to check that. -### Access exposed services - -Follow the installation instruction below. Just at the end, expose the -`nitro-web` service on your host system with: +Follow the [installation instruction](#installation-with-kubernetes) below. +If all the pods and services have settled and everything looks green in your +minikube dashboard, expose the `nitro-web` service on your host system with: ```shell $ minikube service nitro-web --namespace=staging @@ -35,7 +33,7 @@ $ minikube service nitro-web --namespace=staging ## Digital Ocean -Install the kubernetes dashboard first: +First, install kubernetes dashboard: ```sh $ kubectl apply -f dashboard/ ``` @@ -67,20 +65,21 @@ token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZ Grab the token and paste it into the login screen at [http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/](http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/) -## Installation with kubernetes (minikube + Digital Ocean) +## Installation with kubernetes -You have to do some prerequisites and change some secrets according to your own setup. +You have to do some prerequisites e.g. change some secrets according to your +own setup. #### Setup config maps ```shell -$ cp db-migration-worker.template.yml staging/config/db-migration-worker.yml +$ cp configmap-db-migration-worker.template.yaml staging/configmap-db-migration-worker.yaml ``` Edit all variables according to the setup of the remote legacy server. #### Setup secrets and deploy themn ```sh -$ cp secrets.yml.template staging/secrets.yml +$ cp secrets.template.yaml staging/secrets.yaml ``` Change all secrets as needed. @@ -95,18 +94,13 @@ Those secrets get `base64` decoded in a kubernetes pod. #### Create a namespace locally ```shell -$ kubectl create -f namespace-staging.yml +$ kubectl create -f namespace-staging.yaml ``` Switch to the namespace `staging` in your kubernetes dashboard. ### Run the configuration ```shell -$ cd staging/ -$ kubectl apply -f secrets.yml -$ kubectl apply -f config/ -$ kubectl apply -f volumes/ -$ kubectl apply -f services/ -$ kubectl apply -f deployments/ +$ kubectl apply -f staging/ ``` This can take a while because kubernetes will download the docker images. @@ -116,7 +110,8 @@ Wait until all pods turn green and they don't show a warning ### Provision db-migration-worker -Copy your private ssh key and the `.known-hosts` file of your remote legacy server. +Copy your private ssh key and the `.known-hosts` file of your remote legacy +server. ```shell # check the corresponding db-migration-worker pod diff --git a/db-migration-worker.template.yml b/configmap-db-migration-worker.template.yaml similarity index 100% rename from db-migration-worker.template.yml rename to configmap-db-migration-worker.template.yaml diff --git a/namespace-staging.yml b/namespace-staging.yaml similarity index 100% rename from namespace-staging.yml rename to namespace-staging.yaml diff --git a/secrets.template.yml b/secrets.template.yaml similarity index 100% rename from secrets.template.yml rename to secrets.template.yaml diff --git a/staging/.gitignore b/staging/.gitignore new file mode 100644 index 000000000..599426dbb --- /dev/null +++ b/staging/.gitignore @@ -0,0 +1,2 @@ +configmap-db-migration-worker.yaml +secrets.yaml diff --git a/staging/config/.gitignore b/staging/config/.gitignore deleted file mode 100644 index 6fe22561d..000000000 --- a/staging/config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -db-migration-worker.yml diff --git a/staging/config/backend.yml b/staging/config/backend.yml deleted file mode 100644 index cfb19b538..000000000 --- a/staging/config/backend.yml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -data: - GRAPHQL_PORT: "4000" - GRAPHQL_URI: "http://nitro-backend.staging:4000" - MOCK: "false" -metadata: - name: staging-backend - namespace: staging diff --git a/staging/config/neo4j.yml b/staging/config/neo4j.yml deleted file mode 100644 index 0165338db..000000000 --- a/staging/config/neo4j.yml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -data: - NEO4J_URI: "bolt://nitro-neo4j.staging:7687" - NEO4J_USER: "neo4j" - NEO4J_AUTH: none -metadata: - name: staging-neo4j - namespace: staging diff --git a/staging/config/web.yml b/staging/config/web.yml deleted file mode 100644 index 1dbf5e25e..000000000 --- a/staging/config/web.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -data: - CLIENT_URI: "https://nitro-staging.human-connection.org" - MAPBOX_TOKEN: pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ -metadata: - name: staging-web - namespace: staging diff --git a/staging/configmaps.yaml b/staging/configmaps.yaml new file mode 100644 index 000000000..c07353141 --- /dev/null +++ b/staging/configmaps.yaml @@ -0,0 +1,29 @@ +--- + apiVersion: v1 + kind: ConfigMap + data: + GRAPHQL_PORT: "4000" + GRAPHQL_URI: "http://nitro-backend.staging:4000" + MOCK: "false" + metadata: + name: staging-backend + namespace: staging +--- + apiVersion: v1 + kind: ConfigMap + data: + NEO4J_URI: "bolt://nitro-neo4j.staging:7687" + NEO4J_USER: "neo4j" + NEO4J_AUTH: none + metadata: + name: staging-neo4j + namespace: staging +--- + apiVersion: v1 + kind: ConfigMap + data: + CLIENT_URI: "https://nitro-staging.human-connection.org" + MAPBOX_TOKEN: pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2lzNTNud3ZtIn0.KZ8KK9l70omjXbEkkbHGsQ + metadata: + name: staging-web + namespace: staging diff --git a/staging/deployments/backend.yml b/staging/deployment-backend.yaml similarity index 100% rename from staging/deployments/backend.yml rename to staging/deployment-backend.yaml diff --git a/staging/deployments/db-migration-worker.yml b/staging/deployment-db-migration-worker.yaml similarity index 100% rename from staging/deployments/db-migration-worker.yml rename to staging/deployment-db-migration-worker.yaml diff --git a/staging/deployments/neo4j.yml b/staging/deployment-neo4j.yaml similarity index 100% rename from staging/deployments/neo4j.yml rename to staging/deployment-neo4j.yaml diff --git a/staging/deployments/web.yml b/staging/deployment-web.yaml similarity index 100% rename from staging/deployments/web.yml rename to staging/deployment-web.yaml diff --git a/staging/services/backend.yml b/staging/service-backend.yaml similarity index 100% rename from staging/services/backend.yml rename to staging/service-backend.yaml diff --git a/staging/services/neo4j.yml b/staging/service-neo4j.yaml similarity index 100% rename from staging/services/neo4j.yml rename to staging/service-neo4j.yaml diff --git a/staging/services/web.yml b/staging/service-web.yaml similarity index 100% rename from staging/services/web.yml rename to staging/service-web.yaml diff --git a/staging/volumes/mongo-export.yml b/staging/volume-claim-mongo-exports.yaml similarity index 100% rename from staging/volumes/mongo-export.yml rename to staging/volume-claim-mongo-exports.yaml diff --git a/staging/volumes/uploads.yml b/staging/volume-claim-uploads.yaml similarity index 100% rename from staging/volumes/uploads.yml rename to staging/volume-claim-uploads.yaml