More deploy messages, fix mkdir -p issue
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Adam Štrauch 2021-10-27 01:20:26 +02:00
parent 2640690cc6
commit 65bdabd78c
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -3,7 +3,7 @@ type: docker
name: testing name: testing
steps: steps:
- name: test - name: unittests
image: golang:1.17-buster image: golang:1.17-buster
environment: environment:
SNAPSHOTS_S3_ENDPOINT: minio:9000 SNAPSHOTS_S3_ENDPOINT: minio:9000
@ -42,16 +42,24 @@ steps:
image: debian:buster image: debian:buster
environment: environment:
#NODE: node-x.rosti.cz #NODE: node-x.rosti.cz
NODE: 192.168.1.236 NODES: 192.168.1.236
SSH_KEY: SSH_KEY:
from_secret: SSH_KEY from_secret: SSH_KEY
commands: commands:
- apt update && apt install -y ssh - apt update && apt install -y ssh
- mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 - |
- ssh-keyscan $NODE > ~/.ssh/known_hosts for NODE in $NODES; do
- scp node-api root@$NODE:/usr/local/bin/node-api_ echo "\033[0;32mDeploying $NODE\033[0m"
- ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api mkdir -p ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
- ssh root@$NODE systemctl restart node-api echo "\033[1;33m.. scanning SSH keys\033[0m"
ssh-keyscan $NODE > ~/.ssh/known_hosts
echo "\033[1;33m.. copying the binary\033[0m"
scp node-api root@$NODE:/usr/local/bin/node-api_
echo "\033[1;33m.. replacing the binary\033[0m"
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
echo "\033[1;33m.. restarting service file\033[0m"
ssh root@$NODE systemctl restart node-api
done
trigger: trigger:
branch: branch:
@ -89,10 +97,14 @@ steps:
- | - |
for NODE in $NODES; do for NODE in $NODES; do
echo "\033[0;32mDeploying $NODE\033[0m" echo "\033[0;32mDeploying $NODE\033[0m"
mkdir ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 mkdir -p ~/.ssh && echo "$SSH_KEY" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
echo "\033[1;33m.. scanning SSH keys\033[0m"
ssh-keyscan $NODE > ~/.ssh/known_hosts ssh-keyscan $NODE > ~/.ssh/known_hosts
echo "\033[1;33m.. copying the binary\033[0m"
scp node-api root@$NODE:/usr/local/bin/node-api_ scp node-api root@$NODE:/usr/local/bin/node-api_
echo "\033[1;33m.. replacing the binary\033[0m"
ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api ssh root@$NODE mv /usr/local/bin/node-api_ /usr/local/bin/node-api
echo "\033[1;33m.. restarting service file\033[0m"
ssh root@$NODE systemctl restart node-api ssh root@$NODE systemctl restart node-api
done done