-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.sh
116 lines (97 loc) · 3.32 KB
/
setup.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
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
#!/bin/bash
GLOBAL_PATH=$(pwd)
source "$(dirname $0)/params.sh"
TESTNET_DIR=$GLOBAL_PATH/node;
NODE_HTTP_SRV_ADDR="0.0.0.0:$API_PORT"
NODE_P2P_LST_ENDP="0.0.0.0:$P2P_PORT"
NODE_P2P_SRV_ADDR="$NODE_IP:$P2P_PORT"
BASE_CONFIG=$TESTNET_DIR/config.ini;
signature='#!/bin/bash'
# Creating node start.sh
echo "..:: Creating start.sh ::..";
echo -ne "$signature" > $TESTNET_DIR/start.sh
echo "" >> $TESTNET_DIR/start.sh
echo "NODEOS=$EOS_SOURCE_DIR/build/programs/nodeos/nodeos" >> $TESTNET_DIR/start.sh
echo "DATADIR=$TESTNET_DIR" >> $TESTNET_DIR/start.sh
echo -ne "\n";
echo "\$DATADIR/stop.sh" >> $TESTNET_DIR/start.sh
echo -ne "\n";
echo "\$NODEOS --data-dir \$DATADIR --config-dir \$DATADIR \"\$@\" > \$DATADIR/stdout.txt 2> \$DATADIR/stderr.txt & echo \$! > \$DATADIR/nodeos.pid" >> $TESTNET_DIR/start.sh
chmod u+x $TESTNET_DIR/start.sh
# Creating node stop.sh
echo "..:: Creating stop.sh ::..";
echo -ne "$signature" > $TESTNET_DIR/stop.sh
echo "" >> $TESTNET_DIR/stop.sh
echo "DIR=$TESTNET_DIR" >> $TESTNET_DIR/stop.sh
echo -ne "\n";
echo '
if [ -f $DIR"/nodeos.pid" ]; then
pid=$(cat $DIR"/nodeos.pid")
echo $pid
kill $pid
rm -r $DIR"/nodeos.pid"
echo -ne "Stopping Nodeos"
while true; do
[ ! -d "/proc/$pid/fd" ] && break
echo -ne "."
sleep 1
done
echo -ne "\rNodeos stopped. \n"
fi
' >> $TESTNET_DIR/stop.sh
chmod u+x $TESTNET_DIR/stop.sh
# Creating cleos.sh
echo "..:: Creating cleos.sh ::..";
echo -ne "$signature" > $TESTNET_DIR/cleos.sh
echo "CLEOS=$EOS_SOURCE_DIR/build/programs/cleos/cleos" >> $TESTNET_DIR/cleos.sh
echo -ne "\n"
echo "\$CLEOS -u http://127.0.0.1:$API_PORT --wallet-url http://127.0.0.1:$WALLET_PORT \"\$@\"" >> $TESTNET_DIR/cleos.sh
chmod u+x $TESTNET_DIR/cleos.sh
# config.ini
echo -ne "\n\n..:: Creating config.ini ::..\n\n";
echo '
blocks-dir = "blocks"
chain-state-db-size-mb = 65536
reversible-blocks-db-size-mb = 340
contracts-console = false
# Override default maximum ABI serialization time allowed in ms (eosio::chain_plugin)
abi-serializer-max-time-ms = 2000
# actor-whitelist =
# actor-blacklist =
# contract-whitelist =
# contract-blacklist =
filter-on = *
# https-client-root-cert =
https-client-validate-peers = 1
# https-certificate-chain-file =
# https-private-key-file =
access-control-allow-origin = *
# access-control-allow-headers =
# access-control-max-age =
access-control-allow-credentials = false
http-server-address = '$NODE_HTTP_SRV_ADDR'
p2p-listen-endpoint = '$NODE_P2P_LST_ENDP'
p2p-server-address = '$NODE_P2P_SRV_ADDR'
p2p-max-nodes-per-host = 1
agent-name = "agent"
allowed-connection = any
' > $BASE_CONFIG
echo 'signature-provider = '$SIGNING_PUBLIC_KEY'='KEY:$SIGNING_PRIV_KEY'' >> $BASE_CONFIG;
echo 'producer-name = '$PRODUCER_NAME'' >> $BASE_CONFIG;
echo '
max-clients = 100
connection-cleanup-period = 30
network-version-match = 1
sync-fetch-span = 100
max-implicit-request = 1500
enable-stale-production = false
pause-on-startup = false
max-transaction-time = 10000
max-irreversible-block-age = -1
txn-reference-block-lag = 0
unlock-timeout = 900
plugin = eosio::chain_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::chain_plugin
plugin = eosio::history_plugin
' >> $BASE_CONFIG