forked from qor/qor-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·32 lines (24 loc) · 1.05 KB
/
deploy.sh
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
31
32
# Usage:
# ./deploy.sh production
# ./deploy.sh dev
if [ -n "$*" ]; then
env=$*
else
env=dev
fi
echo "Deploying \033[1;31m$env\033[0m from branch \033[1;33m$(git branch | sed -n '/\* /s///p')\033[0m..."
# build enterprise.go
echo "Building enterprise seeds..."
GOOS=linux GOARCH=amd64 go build -o db/seeds/enterprise -tags enterprise db/seeds/enterprise.go db/seeds/seeds.go
# build seeds.go
echo "Building main seeds..."
GOOS=linux GOARCH=amd64 go build -o db/seeds/main db/seeds/main.go db/seeds/seeds.go
go run -tags enterprise main.go -compile-templates=true
echo "Deploying..."
harp -s $env deploy
# please make sure you can run `ssh [email protected]`, or contact [email protected]
influxdb_table=$(git config --local remote.origin.url|sed -n 's#.*/\([^.]*\)\.git#\1#p')
user=$(git config user.name || whoami)
checksum=$(git rev-parse --short HEAD | tr -d '\n')
ssh [email protected] -- /home/deployer/deployment_record "$influxdb_table" "$user" "$env" "$checksum" || echo "failed to post data to influxdb"
harp -s $env log