generated from dappnode/DAppNodePackage-lukso-geth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·78 lines (64 loc) · 2.43 KB
/
entrypoint.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
#!/bin/sh
SNAP_DATA_DIR=/data/snap
ARCHIVAL_DATA_DIR=/data/archive
HISTORICAL_RPC_URL=http://op-l2geth.dappnode:8545
PRELOADED_DATA_FILE=/mainnet-bedrock.tar.zst
# Configuration defined in https://community.optimism.io/docs/developers/bedrock/node-operator-guide/#configuring-op-geth
# Tx pool gossip is disabled as it is not supported yet
# TODO: Should we add --http.api and --ws.api flags?
if [ "$_DAPPNODE_GLOBAL_OP_ENABLE_HISTORICAL_RPC" = "true" ]; then
if [ -z "$HISTORICAL_RPC_URL" ]; then
echo "[ERROR - entrypoint] ENABLE_HISTORICAL_RPC is set to true but HISTORICAL_RPC_URL is not defined"
sleep 60
exit 1
fi
echo "[INFO - entrypoint] Enabling historical RPC"
rm -rf $SNAP_DATA_DIR
# Before starting the download, check if a partial file exists.
if [ -f "$PRELOADED_DATA_FILE" ]; then
echo "[WARNING - entrypoint] Found a partial preloaded data file. Removing it..."
rm -f $PRELOADED_DATA_FILE
fi
# Start the download.
wget -O $PRELOADED_DATA_FILE https://datadirs.optimism.io$PRELOADED_DATA_FILE
if [ $? -ne 0 ]; then
echo "[ERROR - entrypoint] Failed to download preloaded data."
exit 1
fi
echo "[INFO - entrypoint] Decompressing preloaded data. This can take a while..."
zstd -d --stdout $PRELOADED_DATA_FILE | tar xvf - -C $ARCHIVAL_DATA_DIR
if [ $? -ne 0 ]; then
echo "[ERROR - entrypoint] Failed to decompress preloaded data."
rm -f $PRELOADED_DATA_FILE # Remove the faulty file
exit 1
fi
echo "[INFO - entrypoint] Removing preloaded data file. Not needed anymore."
rm -rf $PRELOADED_DATA_FILE
EXTRA_FLAGS="--rollup.historicalrpc $HISTORICAL_RPC_URL --gcmode archive --syncmode full --datadir $ARCHIVAL_DATA_DIR"
# EXTRA_FLAGS="--datadir.ancient $ARCHIVAL_DATA_DIR/geth/chaindata/ancient"
else
echo "[INFO - entrypoint] Historical RPC is disabled"
EXTRA_FLAGS="--gcmode full --syncmode snap --datadir $SNAP_DATA_DIR"
rm -rf $ARCHIVAL_DATA_DIR
fi
echo "[INFO - entrypoint] Starting Geth"
exec geth --rollup.sequencerhttp $SEQUENCER_HTTP_URL \
--rollup.disabletxpoolgossip \
--ws \
--ws.port 8546 \
--ws.addr 0.0.0.0 \
--ws.origins "*" \
--http \
--http.port 8545 \
--http.addr 0.0.0.0 \
--http.vhosts "*" \
--http.corsdomain "*" \
--authrpc.addr 0.0.0.0 \
--authrpc.port 8551 \
--authrpc.vhosts "*" \
--authrpc.jwtsecret /config/jwtsecret.hex \
--verbosity 3 \
--port ${P2P_PORT} \
--networkid 10 \
--op-network op-mainnet \
${EXTRA_FLAGS}