diff --git a/announcer/deploy.sh b/announcer/deploy.sh new file mode 100755 index 0000000..00613a7 --- /dev/null +++ b/announcer/deploy.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -Eeuxo pipefail + +for HOST in "$@"; do + # copy files to target server + scp ./unhinged-traefik-announcer ${HOST}:unhinged-traefik-announcer.tmp + scp ./unhinged-traefik-announcer.service ${HOST}:unhinged-traefik-announcer.service.tmp + # set permissions of files on remote server + ssh ${HOST} chmod 755 unhinged-traefik-announcer.tmp + ssh ${HOST} chmod 644 unhinged-traefik-announcer.service.tmp + # update the unit and reload systemd + ssh ${HOST} mv unhinged-traefik-announcer.service.tmp unhinged-traefik-announcer.service + ssh ${HOST} systemctl daemon-reload + # restart the service after updating the binary + ssh ${HOST} systemctl stop unhinged-traefik-announcer + ssh ${HOST} mv unhinged-traefik-announcer.tmp /usr/local/bin/unhinged-traefik-announcer + ssh ${HOST} systemctl enable unhinged-traefik-announcer + ssh ${HOST} systemctl start unhinged-traefik-announcer + # make sure things are ok + sleep 1 + ssh ${HOST} systemctl status unhinged-traefik-announcer +done + +