forked from cerc-io/stack-orchestrator
Gracefully shutdown optimism batcher and op-geth containers (#345)
* Gracefully shutdown optimism batcher and op-geth containers * Remove unnecessary env export
This commit is contained in:
parent
3130af1615
commit
c6e6122516
@ -9,6 +9,15 @@ CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
# Get BACTHER_KEY from keys.json
|
||||
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
cleanup() {
|
||||
echo "Signal received, cleaning up..."
|
||||
kill ${batcher_pid}
|
||||
|
||||
wait
|
||||
echo "Done"
|
||||
}
|
||||
trap 'cleanup' INT TERM
|
||||
|
||||
op-batcher \
|
||||
--l2-eth-rpc=http://op-geth:8545 \
|
||||
--rollup-rpc=http://op-node:8547 \
|
||||
@ -23,4 +32,8 @@ op-batcher \
|
||||
--max-channel-duration=1 \
|
||||
--target-l1-tx-size-bytes=2048 \
|
||||
--l1-eth-rpc=$CERC_L1_RPC \
|
||||
--private-key=$BATCHER_KEY
|
||||
--private-key=$BATCHER_KEY \
|
||||
&
|
||||
|
||||
batcher_pid=$!
|
||||
wait $batcher_pid
|
||||
|
@ -47,6 +47,15 @@ fi
|
||||
SEQUENCER_ADDRESS=$(jq -r '.Sequencer.address' /l2-accounts/keys.json | tr -d '"')
|
||||
echo "SEQUENCER_ADDRESS: ${SEQUENCER_ADDRESS}"
|
||||
|
||||
cleanup() {
|
||||
echo "Signal received, cleaning up..."
|
||||
kill ${geth_pid}
|
||||
|
||||
wait
|
||||
echo "Done"
|
||||
}
|
||||
trap 'cleanup' INT TERM
|
||||
|
||||
# Run op-geth
|
||||
geth \
|
||||
--datadir ./datadir \
|
||||
@ -74,4 +83,8 @@ geth \
|
||||
--allow-insecure-unlock \
|
||||
--mine \
|
||||
--miner.etherbase=$SEQUENCER_ADDRESS \
|
||||
--unlock=$SEQUENCER_ADDRESS
|
||||
--unlock=$SEQUENCER_ADDRESS \
|
||||
&
|
||||
|
||||
geth_pid=$!
|
||||
wait $geth_pid
|
||||
|
@ -91,6 +91,9 @@ docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts
|
||||
```
|
||||
|
||||
* This means that the data directory that `op-geth` is using is corrupted and needs to be reinitialized; the containers `op-geth`, `op-node` and `op-batcher` need to be started afresh:
|
||||
|
||||
WARNING: This will reset the L2 chain; consequently, all the data on it will be lost
|
||||
|
||||
* Stop and remove the concerned containers:
|
||||
|
||||
```bash
|
||||
|
Loading…
Reference in New Issue
Block a user