-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.sh
executable file
·43 lines (34 loc) · 857 Bytes
/
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
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
export PORT=5100
export MIX_ENV=prod
export GIT_PATH=/home/othello/src/othello
PWD=`pwd`
if [ $PWD != $GIT_PATH ]; then
echo "Error: Must check out git repo to $GIT_PATH"
echo " Current directory is $PWD"
exit 1
fi
if [ $USER != "othello" ]; then
echo "Error: must run as user 'othello'"
echo " Current user is $USER"
exit 2
fi
mix deps.get
(cd assets && npm install)
(cd assets && ./node_modules/brunch/bin/brunch b -p)
mix phx.digest
mix release --env=prod
mkdir -p ~/www
mkdir -p ~/old
NOW=`date +%s`
if [ -d ~/www/othello ]; then
echo mv ~/www/othello ~/old/$NOW
mv ~/www/othello ~/old/$NOW
fi
mkdir -p ~/www/othello
REL_TAR=~/src/othello/_build/prod/rel/othello/releases/0.0.1/othello.tar.gz
(cd ~/www/othello && tar xzvf $REL_TAR)
crontab - <<CRONTAB
@reboot bash /home/othello/src/othello/start.sh
CRONTAB
#. start.sh