A safer wrapper script for launching the beacon node containers in docker
This commit is contained in:
parent
7785b31431
commit
0f680e887a
|
@ -21,7 +21,7 @@ RUN export GOROOT=/usr/local/go \
|
|||
&& git reset --hard ${GIT_REVISION} \
|
||||
&& make update deps vendor/go/bin/p2pd nat-libs \
|
||||
&& cp vendor/go/bin/p2pd /usr/bin/p2pd \
|
||||
&& cat vendor/.nimble/pkgs/*/*
|
||||
&& cp docker/beacon_node/run_in_docker.sh /usr/bin/run_beacon_node.sh
|
||||
|
||||
ARG NETWORK
|
||||
ARG NETWORK_TYPE
|
||||
|
@ -53,9 +53,10 @@ RUN apt update \
|
|||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY --from=build /usr/bin/beacon_node /usr/bin/beacon_node
|
||||
COPY --from=build /usr/bin/run_beacon_node.sh /usr/bin/run_beacon_node.sh
|
||||
COPY --from=build /usr/bin/p2pd /usr/bin/p2pd
|
||||
|
||||
MAINTAINER Zahary Karadjov <zahary@status.im>
|
||||
LABEL description="Nimbus installation that can act as an ETH2 network bootstrap node."
|
||||
|
||||
ENTRYPOINT ["/usr/bin/beacon_node"]
|
||||
ENTRYPOINT ["/usr/bin/run_beacon_node.sh"]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
killall p2pd
|
||||
rm -rf /tmp/*
|
||||
|
||||
beacon_node $*
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import strformat
|
||||
import
|
||||
strformat
|
||||
|
||||
var
|
||||
serverCount = 10
|
||||
|
@ -11,8 +12,7 @@ var
|
|||
validatorsPerServer = systemValidators div serverCount
|
||||
validatorsPerNode = validatorsPerServer div instancesCount
|
||||
|
||||
network = "testnet1"
|
||||
buildFlavour = "libp2p_spec"
|
||||
network = "testnet0"
|
||||
|
||||
type
|
||||
ContainerCmd = enum
|
||||
|
@ -22,23 +22,23 @@ type
|
|||
iterator containers: tuple[cmd: ContainerCmd, node, container: string, firstValidator, lastValidator: int] =
|
||||
for i in 0 ..< serverCount:
|
||||
let baseIdx = userValidators + i * validatorsPerServer
|
||||
for j in 0 ..< instancesCount:
|
||||
for j in 1 .. instancesCount:
|
||||
let firstIdx = baseIdx + j * validatorsPerNode
|
||||
let lastIdx = firstIdx + validatorsPerNode - 1
|
||||
yield (restart, &"nimbus-node-0{i}", &"beacon-node-{buildFlavour}-{network}-{j}", firstIdx, lastIdx)
|
||||
for j in instancesCount .. 2:
|
||||
yield (stop, &"nimbus-node-0{i}", &"beacon-node-{buildFlavour}-{network}-{j}", -1, -1)
|
||||
yield (restart, &"nimbus-node-0{i}", &"beacon-node-{network}-{j}", firstIdx, lastIdx)
|
||||
|
||||
for i in 0 ..< serverCount:
|
||||
let baseIdx = userValidators + i * validatorsPerServer
|
||||
for j in 1 .. instancesCount:
|
||||
let firstIdx = baseIdx + (j - 1) * validatorsPerNode
|
||||
let lastIdx = firstIdx + validatorsPerNode - 1
|
||||
let dockerPath = &"/docker/beacon-node-{buildFlavour}-{network}-{j}/data/BeaconNode/{network}"
|
||||
echo &"ssh nimbus-node-0{i} 'sudo mkdir -p {dockerPath}/validators && sudo rm -f {dockerPath}/validators/* && " &
|
||||
&"sudo ~/nimbus/vendor/nim-beacon-chain/scripts/download_validator_keys.sh {network} {firstIdx} {lastIdx} {dockerPath} && " &
|
||||
&"sudo chown dockremap:docker -R {dockerPath}'"
|
||||
when false:
|
||||
for i in 0 ..< serverCount:
|
||||
let baseIdx = userValidators + i * validatorsPerServer
|
||||
for j in 1 .. instancesCount:
|
||||
let firstIdx = baseIdx + (j - 1) * validatorsPerNode
|
||||
let lastIdx = firstIdx + validatorsPerNode - 1
|
||||
let dockerPath = &"/docker/beacon-node-{network}-{j}/data/BeaconNode/{network}"
|
||||
|
||||
echo &"ssh nimbus-node-0{i} 'sudo mkdir -p {dockerPath}/validators && sudo rm -f {dockerPath}/validators/* && " &
|
||||
&"sudo ~/nimbus/vendor/nim-beacon-chain/scripts/download_validator_keys.sh {network} {firstIdx} {lastIdx} {dockerPath} && " &
|
||||
&"sudo chown dockremap:docker -R {dockerPath}'"
|
||||
|
||||
# for c in containers():
|
||||
# echo &"ssh {c.node} docker {c.cmd} {c.container}"
|
||||
for c in containers():
|
||||
echo &"ssh {c.node} docker {c.cmd} {c.container}"
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ module_name="${1#*/}"
|
|||
|
||||
if [ `ls -1 *.nimble 2>/dev/null | wc -l ` -gt 0 ]; then
|
||||
mkdir -p "${NIMBLE_DIR}/pkgs/${module_name}-#head"
|
||||
PKG_DIR="$(${PWD_CMD})"
|
||||
if [ -d src ]; then
|
||||
PKG_DIR="$(${PWD_CMD})"
|
||||
if [ -d src ]; then
|
||||
PKG_DIR="${PKG_DIR}/src"
|
||||
fi
|
||||
echo -e "${PKG_DIR}\n${PKG_DIR}" > "${NIMBLE_DIR}/pkgs/${module_name}-#head/${module_name}.nimble-link"
|
||||
echo -e "${PKG_DIR}\n${PKG_DIR}" > "${NIMBLE_DIR}/pkgs/${module_name}-#head/${module_name}.nimble-link"
|
||||
fi
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 681fc2dd36ff865c6dae50ed5b69587bc235e2a4
|
||||
Subproject commit 855d141cf2660d7a22699a29f05215c1be7a56e3
|
Loading…
Reference in New Issue