diff options
Diffstat (limited to 'deploy')
| -rwxr-xr-x | deploy | 46 |
1 files changed, 31 insertions, 15 deletions
@@ -1,21 +1,37 @@ -USER=fnurk -HOST=samuelw.dev -BIN_DIR=/opt/tinygram/ # the directory where your binary should go -ASSET_DIR=/srv/tinygram/ # the directory where your asset dir should go +#!/usr/bin/env janet +(use sh) -echo "generating templates" -templ generate +(def user "fnurk") +(def host "samuelw.dev") -echo "building" -go build . +(def bin-dir "/opt/tinygram/") +(def asset-dir "/srv/tinygram/") -echo "syncing binary" -rsync --rsync-path 'sudo -u tinygram rsync' tinygram ${USER}@${HOST}:${BIN_DIR} +(def ssh-target (string user "@" host)) -echo "syncing assets" -rsync --rsync-path 'sudo -u tinygram rsync' -r assets ${USER}@${HOST}:${ASSET_DIR} +(def bin-target (string ssh-target ":" bin-dir)) +(def asset-target (string ssh-target ":" asset-dir)) -echo "restarting service" -ssh ${USER}@${HOST} 'sudo systemctl restart tinygram.service' +(def rsync-path ["--rsync-path" "sudo -u tinygram rsync"]) -exit 0 +(def rsync-bin-args [;rsync-path "tinygram" bin-target]) +(def rsync-asset-args [;rsync-path "-r" "assets" asset-target]) + + +(print "-- building templ --") +($ templ generate) + +(print "-- building go --") +($ go build ".") + +(print "-- syncing binary --") +($ rsync ;rsync-bin-args) + +(print "-- syncing assets --") +($ rsync ;rsync-asset-args) + + +(print "-- restarting service --") +($ ssh ,ssh-target "sudo systemctl restart tinygram.service") + +(print "done!") |
