-
Notifications
You must be signed in to change notification settings - Fork 5
/
deploy.sh
executable file
·58 lines (34 loc) · 1000 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
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
DD=`date +%Y%m%dT%H%M%S`
source deploy/config
[[ -z "$DEPLOY_HOST" ]] && exit 1;
[[ -z "$DEPLOY_PATH" ]] && exit 1
[[ -z "$PORT" ]] && exit 1
[[ -z "$MONGO_URL" ]] && exit 1
[[ -z "$ROOT_URL" ]] && exit 1
[[ -z "$DROOLS_URL" ]] && exit 1
CMD="
export PORT=$PORT;
export ROOT_URL=$ROOT_URL;
export MONGO_URL=$MONGO_URL;
export MAIL_URL=$MAIL_URL;
export DROOLS_URL=$DROOLS_URL;
cd $DEPLOY_PATH/git;
echo 'update code';
git pull > /dev/null;
echo 'bundle package';
cd $DEPLOY_PATH/git/app;
mrt bundle $DEPLOY_PATH/bundle.tgz > /dev/null;
cd $DEPLOY_PATH;
echo 'stop server';
forever --plain -s stop $DEPLOY_PATH/bundle/main.js > /dev/null;
mv $DEPLOY_PATH/bundle $DEPLOY_PATH/bundle.$DD;
tar xzvf $DEPLOY_PATH/bundle.tgz > /dev/null;
cd $DEPLOY_PATH/bundle/programs/server && npm install fibers
echo 'clean';
rm $DEPLOY_PATH/bundle.tgz;
echo 'start server';
forever --plain -s start $DEPLOY_PATH/bundle/main.js > /dev/null;
"
echo $DEPLOY_HOST
ssh $DEPLOY_HOST $CMD