-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·58 lines (47 loc) · 1.34 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·58 lines (47 loc) · 1.34 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/bash
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "1 argument required, $# provided"
branch=$1
peralta="peralta_${branch}"
judy="judy_${branch}"
echo ">>> deploying: $peralta"
echo ">>> deploying: $judy"
echo ">>> deploying floatingfile"
echo ">>> branch: $branch"
git pull "https://github.com/garethlau/floatingfile.git" $branch
echo ">>> installing dependencies"
yarn install
echo ">>> increase memory for build"
export NODE_OPTIONS="--max-old-space-size=5120" # increase to 5gb
echo ">>> building packages"
yarn --cwd packages/ui build
yarn --cwd packages/types build
echo ">>> building frontend"
if [ "$branch" = "master" ]; then
yarn --cwd apps/client build:master
else
yarn --cwd apps/client build:staging
fi
echo ">>> building backend"
yarn --cwd apps/server build
echo ">>> restarting application"
if [ "$(pm2 id ${peralta})" = "[]" ]; then
pm2 start yarn --interpreter bash --name $peralta -- start:server
else
pm2 reload $peralta
fi
echo ">>> building landing site"
yarn --cwd apps/landing build
echo ">>> starting landing server"
if [ "$(pm2 id ${judy})" = "[]" ]; then
if [ "$branch" = "master" ]; then
pm2 start yarn --interpreter bash --name $judy -- start:landing
else
pm2 start yarn --interpreter bash --name $judy -- stage:landing
fi
else
pm2 reload $judy
fi