forked from transistorsoft/background-geolocation-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_deploy.bash
More file actions
38 lines (32 loc) · 991 Bytes
/
server_deploy.bash
File metadata and controls
38 lines (32 loc) · 991 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
31
32
33
34
35
36
37
38
#deploys the current code to the server
#requires your ssh key, so run it directly from your mac, not from the vagrant
export SERVER='root@104.236.224.126'
echo "This deploys the APP to the $SERVER"
[ -z "$SERVER" ] && exit
rm -rf build
scp provision/* $SERVER:/tmp
ssh $SERVER <<"ENDSSH"
bash -l /tmp/mount-vagrant.sh
bash -l /tmp/locale.sh
bash -l /tmp/pg_prod.sh
bash -l /tmp/node.sh
bash -l /tmp/swap.sh
ENDSSH
ssh $SERVER 'pm2 stop server'
rsync --delete -rav -e ssh \
--exclude='build' \
--exclude='*.git' \
--exclude=".vagrant" \
--exclude="node_modules" \
. $SERVER:/vagrant
ssh $SERVER <<"ENDSSH"
sudo chmod -R 755 /vagrant
ENDSSH
ssh $SERVER <<"ENDSSH"
cd /vagrant/
npm install
npm run heroku-postbuild
./node_modules/.bin/babel --presets='node6' server.js -d compiled
./node_modules/.bin/babel --presets='node6' src/server -d compiled/src/server
ENDSSH
ssh $SERVER 'cd /vagrant; pm2 start compiled/server.js'