From 54cb0ac9e70026bb0c4064e629f07a9196042276 Mon Sep 17 00:00:00 2001 From: jem Date: Fri, 16 Apr 2021 16:28:19 +0200 Subject: [PATCH] working deployment --- .gitignore | 2 ++ doc/Developement.md | 17 +++++++++++++++++ src/main/resources/deployment.yaml | 20 ++++++++++++-------- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1826f93..0217c33 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ public/js/ *.iml .idea/ +myauth.edn +myconfig.edn diff --git a/doc/Developement.md b/doc/Developement.md index afe27e4..c769b6b 100644 --- a/doc/Developement.md +++ b/doc/Developement.md @@ -31,6 +31,16 @@ apt update && apt install kubectl kubectl completion bash >> /etc/bash_completion.d/kubernetes ``` +## install kubeval + +``` +wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz +tar xf kubeval-linux-amd64.tar.gz +sudo cp kubeval /usr/local/bin + +## remote access to k8s +``` + ## remote access to k8s ``` @@ -43,3 +53,10 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test kubectl get pods ``` + +## deploy mastodon-bot + +``` +java -jar target/uberjar/k8s-mastodon-bot-standalone.jar myconfig.edn myauth.edn | kubeval - +java -jar target/uberjar/k8s-mastodon-bot-standalone.jar myconfig.edn myauth.edn | kubectl apply -f - +``` \ No newline at end of file diff --git a/src/main/resources/deployment.yaml b/src/main/resources/deployment.yaml index ac72f19..f7ed6d0 100644 --- a/src/main/resources/deployment.yaml +++ b/src/main/resources/deployment.yaml @@ -13,20 +13,24 @@ spec: labels: app.kubernetes.io/name: k8s-mastodon-bot spec: + volumes: + - name: config-volume + configMap: + name: mastodon-bot containers: - - image: mastodon-bot + - image: domaindrivenarchitecture/mastodon-bot name: mastodon-bot env: - name: MASTODON_BOT_CREDENTIALS - value: /app/credentials.edn + value: /credentials.edn cmd: volumeMounts: - - name: mastodon-bot - mountPath: /app/config.edn - subPath: config.conf + - name: config-volume + mountPath: /config.edn + subPath: config.edn readOnly: true - - name: mastodon-bot - mountPath: /app/credentials.edn - subPath: credentials.conf + - name: config-volume + mountPath: /credentials.edn + subPath: credentials.edn readOnly: true