working deployment

This commit is contained in:
jem 2021-04-16 16:28:19 +02:00
parent 822b263845
commit 54cb0ac9e7
3 changed files with 31 additions and 8 deletions

2
.gitignore vendored
View file

@ -21,3 +21,5 @@ public/js/
*.iml *.iml
.idea/ .idea/
myauth.edn
myconfig.edn

View file

@ -31,6 +31,16 @@ apt update && apt install kubectl
kubectl completion bash >> /etc/bash_completion.d/kubernetes 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 ## remote access to k8s
``` ```
@ -43,3 +53,10 @@ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@devops.test
kubectl get pods 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 -
```

View file

@ -13,20 +13,24 @@ spec:
labels: labels:
app.kubernetes.io/name: k8s-mastodon-bot app.kubernetes.io/name: k8s-mastodon-bot
spec: spec:
volumes:
- name: config-volume
configMap:
name: mastodon-bot
containers: containers:
- image: mastodon-bot - image: domaindrivenarchitecture/mastodon-bot
name: mastodon-bot name: mastodon-bot
env: env:
- name: MASTODON_BOT_CREDENTIALS - name: MASTODON_BOT_CREDENTIALS
value: /app/credentials.edn value: /credentials.edn
cmd: cmd:
volumeMounts: volumeMounts:
- name: mastodon-bot - name: config-volume
mountPath: /app/config.edn mountPath: /config.edn
subPath: config.conf subPath: config.edn
readOnly: true readOnly: true
- name: mastodon-bot - name: config-volume
mountPath: /app/credentials.edn mountPath: /credentials.edn
subPath: credentials.conf subPath: credentials.edn
readOnly: true readOnly: true