#!/bin/sh -e host=root@oxaliq.net # organize files echo "ORGANIZING THE FILES" mkdir ludo-go mv target/release/ludo-go-server ludo-go/. mv target/release/ludo-go-db ludo-go/. mv target/release/go-game ludo-go/. ## move the database here # copy files to deployment target echo "COPYING FILES TO DEPLOYMENT TARGET" scp -r ludo-go "$host":~/ echo "SETTING OWNERSHIP AND PERMISSIONS" ssh $host 'chown -R oxaliqdotnet:oxaliqdotnet ludo-go/' ssh $host 'chown -R 755 ludo-go/' ## todo ensure new deployment is working prior to removing previous echo "REPLACING PREVIOUS DEPLOYMENT" ssh $host 'rm -rf /srv/ludo-go || true' ssh $host 'mv ludo-go /srv/.' echo "RESTARTING SERVICE" ssh $host 'systemctl restart ludogo.service' echo "SUCCESS!" exit 0