forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steemd.run
130 lines (108 loc) · 3.89 KB
/
steemd.run
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
STEEMD="/usr/local/steemd-default/bin/steemd"
VERSION=`cat /etc/steemdversion`
if [[ "$USE_WAY_TOO_MUCH_RAM" ]]; then
STEEMD="/usr/local/steemd-full/bin/steemd"
fi
chown -R steemd:steemd $HOME
ARGS=""
# if user did pass in desired seed nodes, use
# the ones the user specified:
if [[ ! -z "$STEEMD_SEED_NODES" ]]; then
for NODE in $STEEMD_SEED_NODES ; do
ARGS+=" --p2p-seed-node=$NODE"
done
fi
if [[ ! -z "$STEEMD_WITNESS_NAME" ]]; then
ARGS+=" --witness=\"$STEEMD_WITNESS_NAME\""
fi
if [[ ! -z "$STEEMD_PRIVATE_KEY" ]]; then
ARGS+=" --private-key=$STEEMD_PRIVATE_KEY"
fi
if [[ ! -z "$TRACK_ACCOUNT" ]]; then
if [[ ! "$USE_WAY_TOO_MUCH_RAM" ]]; then
ARGS+=" --plugin=account_history_rocksdb --plugin=account_history_api"
fi
ARGS+=" --account-history-rocksdb-track-account-range=[\"$TRACK_ACCOUNT\",\"$TRACK_ACCOUNT\"]"
fi
if [[ ! "$DISABLE_SCALE_MEM" ]]; then
ARGS+=" --shared-file-full-threshold=9500 --shared-file-scale-rate=1000"
fi
NOW=`date +%s`
STEEMD_FEED_START_TIME=`expr $NOW - 1209600`
ARGS+=" --follow-start-feeds=$STEEMD_FEED_START_TIME"
# overwrite local config with image one
if [[ "$USE_FULL_WEB_NODE" ]]; then
cp /etc/steemd/fullnode.config.ini $HOME/config.ini
elif [[ "$IS_BROADCAST_NODE" ]]; then
cp /etc/steemd/config-for-broadcaster.ini $HOME/config.ini
elif [[ "$IS_AH_NODE" ]]; then
cp /etc/steemd/config-for-ahnode.ini $HOME/config.ini
elif [[ "$IS_OPSWHITELIST_NODE" ]]; then
cp /etc/steemd/fullnode.opswhitelist.config.ini $HOME/config.ini
else
cp /etc/steemd/config.ini $HOME/config.ini
fi
chown steemd:steemd $HOME/config.ini
if [[ ! -d $HOME/blockchain ]]; then
if [[ -e /var/cache/steemd/blocks.tbz2 ]]; then
# init with blockchain cached in image
ARGS+=" --replay-blockchain"
mkdir -p $HOME/blockchain/database
cd $HOME/blockchain/database
tar xvjpf /var/cache/steemd/blocks.tbz2
chown -R steemd:steemd $HOME/blockchain
fi
else
ARGS+=" --tags-skip-startup-update"
fi
# without --data-dir it uses cwd as datadir(!)
# who knows what else it dumps into current dir
cd $HOME
if [[ "$USE_PUBLIC_SHARED_MEMORY" ]]; then
echo steemd: Downloading and uncompressing blockchain-$VERSION-latest.tar.lz4 - this may take awhile.
wget -qO- https://s3.amazonaws.com/steemit-dev-blockchainstate/blockchain-$VERSION-latest.tar.lz4 | lz4 -d | tar x
fi
if [[ "$USE_PUBLIC_BLOCKLOG" ]]; then
if [[ ! -e $HOME/blockchain/block_log ]]; then
if [[ ! -d $HOME/blockchain ]]; then
mkdir -p $HOME/blockchain
fi
echo "steemd: Downloading a block_log and replaying the blockchain"
echo "This may take a little while..."
wget -O $HOME/blockchain/block_log https://s3.amazonaws.com/steemit-dev-blockchainstate/block_log-latest
ARGS+=" --replay-blockchain"
fi
fi
# slow down restart loop if flapping
sleep 1
mv /etc/nginx/nginx.conf /etc/nginx/nginx.original.conf
cp /etc/nginx/steemd.nginx.conf /etc/nginx/nginx.conf
if [[ "$USE_NGINX_FRONTEND" ]]; then
cp /etc/nginx/healthcheck.conf.template /etc/nginx/healthcheck.conf
echo server 127.0.0.1:8091\; >> /etc/nginx/healthcheck.conf
echo } >> /etc/nginx/healthcheck.conf
rm /etc/nginx/sites-enabled/default
cp /etc/nginx/healthcheck.conf /etc/nginx/sites-enabled/default
/etc/init.d/fcgiwrap restart
service nginx restart
exec chpst -usteemd \
$STEEMD \
--webserver-ws-endpoint=0.0.0.0:8091 \
--webserver-http-endpoint=0.0.0.0:8091 \
--p2p-endpoint=0.0.0.0:2001 \
--data-dir=$HOME \
$ARGS \
$STEEMD_EXTRA_OPTS \
2>&1
else
exec chpst -usteemd \
$STEEMD \
--webserver-ws-endpoint=0.0.0.0:8090 \
--webserver-http-endpoint=0.0.0.0:8090 \
--p2p-endpoint=0.0.0.0:2001 \
--data-dir=$HOME \
$ARGS \
$STEEMD_EXTRA_OPTS \
2>&1
fi