oxaliq.net/.woodpecker/deploy.sh
sorrel 7b9e5d2d18
All checks were successful
ci/woodpecker/push/build-and-deploy Pipeline was successful
add html cache directories to static/
2024-01-17 21:13:56 -05:00

43 lines
1 KiB
Bash
Executable file

#!/bin/sh -e
# hello variables
host=deploy@turtle.hup.is
# organize the files
echo "ORGANIZING THE FILES NICELY"
mkdir oxaliq
mv dist oxaliq/.
mv source oxaliq/.
mv static oxaliq/.
# add html cache directories
echo "ADDING HTML CACHE DIRECTORIES"
mkdir fragment
mkdir fragment/settled
mkdir fragment/unsettled
mv fragment oxaliq/static/.
mkdir page
mkdir page/settled
mkdir page/unsettled
mv page oxaliq/static/.
# put them on the deployment target
echo "COPYING FILES TO DEPLOYMENT TARGET"
scp -r oxaliq "$host":~/
# do everything on the server that's necessary to run the new thing
# TODO make this not remove the old-working version until
# the new version is confirmed working
echo "SETTING OWNERSHIP AND PERMISSIONS"
ssh $host 'sudo chown -R oxaliqdotnet:oxaliqdotnet oxaliq/'
ssh $host 'sudo chmod -R 755 oxaliq/'
echo "REPLACING PREVIOUS DEPLOYMENT"
ssh $host 'sudo rm -rf /srv/oxaliq || true'
ssh $host 'sudo mv oxaliq /srv/.'
echo "RESTARTING SERVICE"
ssh $host 'sudo systemctl restart oxaliqdotnet.service'
echo "SUCCESS!"
exit 0