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