-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_deploy.sh
More file actions
executable file
·30 lines (24 loc) · 905 Bytes
/
Copy pathbuild_deploy.sh
File metadata and controls
executable file
·30 lines (24 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
set -e
# This script will build the binary and upload it together with the frontend
# and restart the service.
# NOTE: this does not a full deployment, and assumes config and keys are already provided!
# Dependencies: bash, git, ssh
if [ ! -z "$(git status --untracked-files=no --porcelain)" ]; then
echo "won't deploy as long as there are uncommitted changes!"
exit 1
fi
version=$(git rev-parse --short HEAD)
userHost=fsadmin@geofs.uni-muenster.de
targetDir=/srv/UserManager
targetBinary=$targetDir/UserManager_$version
echo "building binary.."
go build
# upload stuff
echo "shooting it into the interweb.."
scp UserManager $userHost:$targetBinary
scp public/index.html $userHost:$targetDir/public/
# set new version & restart service
echo "unleashing your latest creation.."
ssh $userHost 'ln -sf $targetBinary $targetDir/userManager'
ssh $userHost 'systemctl restart userManager'