update book link and remove obsolete directory (#2097)

* update book link and remove obsolete directory

* remove redundant link to book
This commit is contained in:
tersec 2020-11-29 12:18:04 +00:00 committed by GitHub
parent 7731109320
commit b32c7c0851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 0 additions and 295 deletions

View File

@ -49,8 +49,6 @@ Nimbus beacon chain is a research implementation of the beacon chain component o
You can find the information you need to run a beacon node and operate as a validator in [The Book](https://status-im.github.io/nimbus-eth2/).
See [this page](https://status-im.github.io/nimbus-eth2/medalla.html) for how to become a validator on Medalla.
## Related projects
* [status-im/nimbus-eth1](https://github.com/status-im/nimbus-eth1/): Nimbus for Ethereum 1

View File

@ -1,14 +0,0 @@
FROM debian:bullseye-slim
SHELL ["/bin/bash", "-c"]
RUN apt-get -qq update \
&& apt-get -qq -y install build-essential git &>/dev/null \
&& apt-get -qq clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
STOPSIGNAL SIGINT
COPY "entry_point.sh" "/root/"
ENTRYPOINT ["/root/entry_point.sh"]

View File

@ -1,26 +0,0 @@
SHELL := bash # the shell used internally by "make"
# These default settings can be overriden by exporting env variables
IMAGE_TAG ?= testnet2
IMAGE_NAME ?= statusteam/nimbus_beacon_node:$(IMAGE_TAG)
CURRENT_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
COMPUTER_SAYS_NO = { echo "I'm sorry, Dave. I'm afraid I can't do that."; exit 1; }
.PHONY: build push push-last
build:
@ DOCKER_BUILDKIT=1 \
docker build \
-t $(IMAGE_NAME) \
--progress=plain \
.
push: build
+@ $(MAKE) push-last
push-last:
@ [[ "$(CURRENT_BRANCH)" != "devel" ]] && $(COMPUTER_SAYS_NO) || true
docker push $(IMAGE_NAME)

View File

@ -1,79 +0,0 @@
## local testing
From the "nim-beacon-chain" repo (top-level dir):
```text
make -C docker/shared_testnet NETWORK=witti build
mkdir tmp
docker run --rm --mount type=bind,source="$(pwd)"/tmp,target=/root/.cache/nimbus --name testnet2 statusteam/nimbus_beacon_node:testnet2 --build
ls -l tmp/nim-beacon-chain/build
docker run --rm --mount type=bind,source="$(pwd)"/tmp,target=/root/.cache/nimbus --name testnet2 -p 127.0.0.1:8008:8008 -p 9000:9000 statusteam/nimbus_beacon_node:testnet2 --run -- --metrics-address=0.0.0.0
# from another terminal
docker ps
docker stop testnet2
# when you're happy with the Docker image:
make -C docker/shared_testnet NETWORK=witti push
```
## setting up remote servers
From the "infra-nimbus" repo:
```text
git pull
make requirements
ansible-playbook ansible/nimbus.yml -i ansible/inventory/test -t beacon-node -u YOUR_USER -K -l nimbus.test[6:9]
# faster way to pull the Docker image and recreate the containers (this also stops any running container)
ansible nimbus.test[6:9] -i ansible/inventory/test -u YOUR_USER -o -m shell -a "echo; cd /docker/beacon-node-testnet2; docker-compose --compatibility pull; docker-compose --compatibility up --no-start; echo '---'" | sed 's/\\n/\n/g'
# build beacon_node in an external volume
ansible nimbus.test[6:9] -i ansible/inventory/test -u YOUR_USER -o -m shell -a "echo; cd /docker/beacon-node-testnet2; docker-compose --compatibility run --rm beacon_node --build; echo '---'" | sed 's/\\n/\n/g'
```
### create and copy validator keys
Back up "build/data/shared\_witti\_0", if you need to. It will be deleted.
From the nim-beacon-chain repo:
```bash
# If you have "ignorespace" or "ignoreboth" in HISTCONTROL in your ".bashrc", you can prevent
# the key from being stored in your command history by prefixing it with a space.
# See https://www.linuxjournal.com/content/using-bash-history-more-efficiently-histcontrol
./docker/shared_testnet/validator_keys.sh 0xYOUR_ETH1_PRIVATE_GOERLI_KEY
```
### start the containers
From the "infra-nimbus" repo:
```bash
ansible nimbus.test[6:9] -i ansible/inventory/test -u YOUR_USER -o -m shell -a "echo; cd /docker/beacon-node-testnet2; docker-compose --compatibility up -d; echo '---'" | sed 's/\\n/\n/g'
```
### restarting the containers
Periodic rebuilds and restarts are implemented using Cron jobs on the servers:
```crontab
0 0,6,12,18 * * * PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin'; cd /docker/beacon-node-testnet2; docker-compose --compatibility run --rm --name beacon-node-testnet2-build-run beacon_node --build; docker-compose restart -t 60
```
The same, using Ansible (not normally needed):
```bash
ansible nimbus.test[6:9] -i ansible/inventory/test -u YOUR_USER -o -m shell -a "echo; cd /docker/beacon-node-testnet2; docker-compose --compatibility run --rm --name beacon-node-testnet2-build-run beacon_node --build; docker-compose restart -t 60; echo '---'" | sed 's/\\n/\n/g'
```
## Medalla
```bash
make -C docker/shared_testnet IMAGE_TAG=testnet3 push
cd ../infra-nimbus
ansible nimbus.test[0:5] -i ansible/inventory/test -u YOUR_USER -o -m shell -a "echo; cd /docker/beacon-node-testnet3; docker-compose --compatibility run --rm --name beacon-node-testnet3-build-run beacon_node --build; docker-compose restart -t 60; echo '---'" | sed 's/\\n/\n/g'
```

View File

@ -1,106 +0,0 @@
#!/bin/bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")"
####################
# argument parsing #
####################
! getopt --test > /dev/null
if [ ${PIPESTATUS[0]} != 4 ]; then
echo '`getopt --test` failed in this environment.'
exit 1
fi
OPTS="h"
LONGOPTS="help,network:,build,run"
# default values
NETWORK="pyrmont"
BUILD=0
RUN=0
print_help() {
cat <<EOF
Usage: $(basename $0) <options> -- <nimbus_beacon_node options>
-h, --help this help message
--network default: ${NETWORK}
--build build the nimbus_beacon_node binary
--run run the nimbus_beacon_node binary
EOF
}
! PARSED=$(getopt --options=${OPTS} --longoptions=${LONGOPTS} --name "$0" -- "$@")
if [ ${PIPESTATUS[0]} != 0 ]; then
# getopt has complained about wrong arguments to stdout
exit 1
fi
# read getopt's output this way to handle the quoting right
eval set -- "$PARSED"
while true; do
case "$1" in
-h|--help)
print_help
exit
;;
--network)
NETWORK="$2"
shift 2
;;
--build)
BUILD=1
shift
;;
--run)
RUN=1
shift
;;
--)
shift
break
;;
*)
echo "argument parsing error"
print_help
exit 1
esac
done
# docker-compose.yml inserts newlines in our options
if [[ "$(echo $1 | tr -d '[:space:]')" == "--" ]]; then
shift
fi
EXTRA_ARGS="$@"
#########
# build #
#########
if [[ "$BUILD" == "1" ]]; then
# "/root/.cache/nimbus" is the external bind-mounted dir, preserved between runs
cd /root/.cache/nimbus
[[ -d nim-beacon-chain ]] || git clone https://github.com/status-im/nim-beacon-chain.git
cd nim-beacon-chain
git config pull.rebase false
git checkout -- .
git checkout devel
git pull
# don't use too much RAM
make update
make LOG_LEVEL="TRACE" NIMFLAGS="-d:insecure -d:testnet_servers_image --parallelBuild:1" nimbus_beacon_node nimbus_signing_process
fi
#######
# run #
#######
if [[ "$RUN" == "1" ]]; then
cd /root/.cache/nimbus/nim-beacon-chain
# make sure Docker's SIGINT reaches the nimbus_beacon_node binary
exec build/nimbus_beacon_node --network="${NETWORK}" --data-dir="build/data/shared_${NETWORK}_0" --web3-url="wss://goerli.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e" ${EXTRA_ARGS}
fi

View File

@ -1,38 +0,0 @@
#!/bin/bash
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
GROUP=0
TOTAL=$(ls -d ../nimbus-private/medalla_deposits/validators/* | wc -l)
HOSTS=(
"master-01.aws-eu-central-1a.nimbus.test.statusim.net"
"node-01.aws-eu-central-1a.nimbus.test.statusim.net"
"node-02.aws-eu-central-1a.nimbus.test.statusim.net"
"node-03.aws-eu-central-1a.nimbus.test.statusim.net"
"node-04.aws-eu-central-1a.nimbus.test.statusim.net"
"node-05.aws-eu-central-1a.nimbus.test.statusim.net"
)
PER_GROUP=$(( TOTAL / ${#HOSTS[@]} ))
for HOST in "${HOSTS[@]}"; do
ssh ${HOST} "sudo rm -rf /docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/secrets"
ssh ${HOST} "sudo rm -rf /docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/validators"
for TARGET in "validators" "secrets"; do
DIR_NO=0
ls -d ../nimbus-private/medalla_deposits/${TARGET}/* | while read DIR; do
if [[ $DIR_NO -ge $((GROUP * PER_GROUP)) && $DIR_NO -lt $(( (GROUP + 1) * PER_GROUP )) ]]; then
rsync -a -zz --rsync-path="sudo rsync" "$DIR" ${HOST}:/docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/${TARGET}/
elif [[ $(( GROUP + 1 )) == ${#HOSTS[@]} && $DIR_NO -ge $(( (GROUP + 1) * PER_GROUP )) ]]; then
# extra validators from the integer division remainder
rsync -a -zz --rsync-path="sudo rsync" "$DIR" ${HOST}:/docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/${TARGET}/
fi
DIR_NO=$((DIR_NO + 1))
done
done
GROUP=$((GROUP + 1))
ssh ${HOST} "sudo chown -R dockremap:dockremap /docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/secrets"
ssh ${HOST} "sudo chown -R dockremap:dockremap /docker/beacon-node-testnet3/data/nim-beacon-chain/build/data/shared_medalla_0/validators"
done

View File

@ -1,30 +0,0 @@
#!/bin/bash
# This script creates validator keys and uploads them to remote servers,
# assuming your local username is the same as the remote one.
set -e
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
[[ -z "$1" ]] && { echo "Usage: $(basename $0) YOUR_ETH1_PRIVATE_GOERLI_KEY"; exit 1; }
echo -ne "About to delete \"build/data/shared_medalla_0\".\nMake a backup, if you need to, then press Enter. >"
read TMP
make clean-medalla
make nimbus_beacon_node
for N in $(seq 6 9); do
build/nimbus_beacon_node deposits create --deposit-private-key=$1 --dont-send && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo rm -rf /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_medalla_0/secrets" && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo rm -rf /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_medalla_0/validators" && \
rsync -a -zz --rsync-path="sudo rsync" build/data/shared_medalla_0/{secrets,validators} node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net:/docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_medalla_0/ && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo chown -R dockremap:dockremap /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_medalla_0/secrets" && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo chown -R dockremap:dockremap /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_medalla_0/validators"
rm -rf build/data/shared_medalla_0/{secrets,validators}
# if we're doing it too fast, we get {"code":-32000,"message":"replacement transaction underpriced"}
# or {"code":-32000,"message":"nonce too low"}
echo "Sleeping..."
sleep 120
done