forked from xlnfinance/xln
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod
executable file
·59 lines (43 loc) · 1.27 KB
/
prod
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
# set -x
set -o nounset
set -o errexit
set -o pipefail
db=--db=mysql:root:123123
#db=--db=postgres:postgres:123123
pm2_opts=--no-autorestart
maxport=8008
fair_cluster_args="--wallet-dist $db --prod-server --color --silent --monkey=$maxport"
if [[ `node -v` =~ v10 ]]; then
nodeflags=--experimental-repl-await
fi
# Rotate logs for clarity
if [ -f /etc/logrotate.d/pm2-root ]; then
logrotate -f /etc/logrotate.d/pm2-root
fi
rm -rf isolate*
rm -rf data*
./install
npm run build
#--node-args="--prof"
pm2 delete all || true
killall Fairlayer 2>/dev/null || true
node fair.js --genesis=test $db --prod-server
fair_node_args="-p8000 --db-pool=50"
pm2 start $pm2_opts --name fair8000 fair.js -- $fair_cluster_args $fair_node_args
for i in $(seq 8001 $maxport); do
rsync -q -rva --exclude=offchain data/* data$i
fair_node_args="-p$i --username=$i --pw=password --datadir=data$i"
if (( i < 8004 )); then
pm2 start $pm2_opts --name fair$i fair.js -- $fair_cluster_args $fair_node_args
else
pm2 start $pm2_opts --name fair$i fair.js -- $fair_cluster_args $fair_node_args
fi
done
rm ~/Caddyfile
cp ./tools/Caddyfile ~/Caddyfile
caddy -service restart
# init demoapp at :3010
cd ~/demos
pm2 start app.js
#node --prof fair.js -p443 --silent --wallet-dist --db=$db