Skip to content

Commit

Permalink
Few fixs in docker setup (#221)
Browse files Browse the repository at this point in the history
* few docker related updates

* few minor updates in docker

* docker and config file related changes

* addressed comments
  • Loading branch information
pratikspatil024 authored Jan 18, 2024
1 parent 32b7e8e commit ca14b9b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
7 changes: 7 additions & 0 deletions src/setup/devnet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ export class Devnet {
obj: this,
ganache: this.ganache
})

for (let i = 0; i < this.totalBorNodes; i++) {
await fs.copyFile(
path.join(this.config.targetDirectory, 'docker-bor-config.toml'),
path.join(this.borDir(i), 'config.toml')
)
}
}
}
]
Expand Down
15 changes: 9 additions & 6 deletions src/setup/devnet/templates/docker/docker-bor-setup.sh.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

set -x

# TODO - revisit this when static-nodes.json is outdated
# # copy static nodes from json to toml
# STATICNODES=$(cat $NODE_DIR/static-nodes.json)
# sed -i "s%.*static-nodes =.*%static-nodes = $(echo $STATICNODES)%g" $NODE_DIR/config.toml

for i in {0..{{ obj.totalNodes - 1 }}}
do
NODE_DIR=$HOME/node
NODE_DIR=/root/var/lib/bor
DATA_DIR=/root/var/lib/bor/data
BOR_DIR=/root/var/lib/bor
docker compose run --rm --entrypoint bash bor$i -c "
sudo mkdir -p $DATA_DIR/bor;
sudo cp $NODE_DIR/bor-config.toml $BOR_DIR/config.toml
sudo cp $NODE_DIR/bor/nodekey $DATA_DIR/bor/;
sudo cp $NODE_DIR/bor/static-nodes.json $DATA_DIR/bor/;
mkdir -p $DATA_DIR/bor;
cp $NODE_DIR/nodekey $DATA_DIR/bor/;
cp $NODE_DIR/static-nodes.json $DATA_DIR/bor/;
"
done

Expand Down
20 changes: 0 additions & 20 deletions src/setup/devnet/templates/docker/docker-bor-start-config.sh.njk

This file was deleted.

15 changes: 8 additions & 7 deletions src/setup/devnet/templates/docker/docker-bor-start.sh.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ ADDRESSES=({% for s in obj.signerDumpData %}
INDEX=$1;
ADDRESS=${ADDRESSES[$INDEX]};

BOR_DIR=/root/var/lib/bor
BOR_DATA_DIR=/root/var/lib/bor/data
NODE_DIR=/root/var/lib/bor
DATA_DIR=/root/var/lib/bor/data

docker compose run --service-ports -d --name bor$INDEX --entrypoint bash bor$INDEX -c "
touch /root/logs/bor.log
bor server \
--chain=$BOR_DIR/genesis.json \
--config $NODE_DIR/config.toml \
--chain=$NODE_DIR/genesis.json \
--identity matic-cli \
--datadir $BOR_DATA_DIR \
--datadir $DATA_DIR \
--port 30303 \
--bor.heimdall http://heimdall$INDEX:1317 \
--http --http.addr '0.0.0.0' \
Expand All @@ -26,7 +27,7 @@ bor server \
--http.corsdomain '*' \
--ws.origins '*' \
--http.port 8545 \
--ipcpath $BOR_DATA_DIR/bor.ipc \
--ipcpath $DATA_DIR/bor.ipc \
--http.api 'personal,eth,net,web3,txpool,miner,admin,bor,debug' \
--bor.logs=true \
--syncmode 'full' \
Expand All @@ -38,8 +39,8 @@ bor server \
--unlock $ADDRESS \
--miner.etherbase $ADDRESS \
--disable-bor-wallet=false \
--keystore $BOR_DIR/keystore \
--password $BOR_DIR/password.txt \
--keystore $NODE_DIR/keystore \
--password $NODE_DIR/password.txt \
--allow-insecure-unlock \
--mine > /root/logs/bor.log 2>&1 &
tail -f /root/logs/bor.log
Expand Down

0 comments on commit ca14b9b

Please sign in to comment.