Created
October 7, 2024 15:33
-
-
Save lil5/91e9a719afc5fc6e97716e76602ef267 to your computer and use it in GitHub Desktop.
Deploy example.stupidwebauthn.site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "Build frontend" | |
pushd frontend | |
yarn install --frozen-lockfile | |
yarn run build | |
popd | |
echo "Build go server" | |
pushd backend | |
GOOS=linux GOARCH=amd64 go build -o backend | |
popd | |
echo "Rsync to server" | |
rsync -avP --delete --exclude=data/db.sqlite --exclude=.git/* --exclude=frontend/node_modules/* ./ [email protected]:/home/admin/example/ | |
echo "Docker compose build and restart" | |
ssh [email protected] "cd /home/admin/example && ./server_start.sh" | |
echo "Done" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Auth server | |
cd /home/admin/example | |
docker compose pull | |
docker compose up -d | |
docker system prune --filter "until=120h" -f | |
# Example frontend | |
sudo cp -rf /home/admin/example/frontend/dist/* /var/www/ | |
sudo chmod -R 774 /var/www/ | |
sudo chown -R caddy /var/www/ | |
# Example caddy | |
sudo cp -f /home/admin/example/frontend/caddy/Caddyfile /etc/caddy/ | |
sudo systemctl reload caddy | |
pushd /home/admin/example/backend | |
systemctl --user stop go_server | |
systemctl --user reset-failed | |
systemd-run --unit=go_server --user --working-directory=/home/admin/example/backend /home/admin/example/backend/backend | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment