prysm-pulse/k8s/beacon-chain
Raul Jordan eb900a8193
Refactor Initial Sync, Enable Catching Up to Chain (#2111)
* refactor initial sync to prevent reorg infinite loops

* lint

* fixed build

* passing tests

* tests passing

* terence suggestion

* new attempt

* clean up and refactor sync service

* complete the new initial sync logic

* revert head

* init sync working

* config for blockchain receive block

* all works

* builds

* fix a few more tests

* init sync tests pass

* revert scripts

* revert accounts changes

* lint

* lint2

* travis lint

* fix build

* fix single use argument

* any peer

* imports spacing

* imports

* ready for a rolling restart

* add todo

* fork choice in blocks when exiting sync

* readd finalized state root to requests

* successful build

* revert blockchain config

* old config reversion

* initial sync tests pass

* initial sync full test works

* lint

* use the new block processing api

* new proto defs

* init sync functions again

* remove sync polling

* tests fixed

* fixed catching up with chain

* tests pass

* spacing

* lint

* goimports

* add changes

* add lock and conditional to prevent multiple goroutines

* make reg sync synchronous

* add

* fixed the parent block issue

* fix errors in chain service

* tests pass

* check nil block

* typo

* fix nil state

* merge & conflicts

* revert synchronus reg sync

* add more spans to state db

* fix lint

* lint
2019-04-03 10:13:19 -05:00
..
beacon-chain.deploy.yaml use infura for now (#2140) 2019-04-01 21:41:31 -05:00
beacon-chain.service.yaml Add IP based LB (#2055) 2019-03-23 09:26:57 -05:00
beacon-config.config.yaml Refactor Initial Sync, Enable Catching Up to Chain (#2111) 2019-04-03 10:13:19 -05:00
bootnode.deploy.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
bootnode.encrypted_secret.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
bootnode.service.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
BUILD.bazel Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
cluster-manager.encrypted_secret.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
cluster-manager.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
infura.yaml use infura for now (#2140) 2019-04-01 21:41:31 -05:00
namespace.yaml k8s goerli config (#1517) 2019-02-08 15:30:38 -05:00
README.md Add README to beacon-chain k8s (#1966) 2019-03-17 08:49:25 -06:00
relay.deploy.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
relay.encrypted_secret.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
relay.service.yaml Faucet enhancements + cluster private key management system (#1679) 2019-03-07 11:14:57 -05:00
testnet-site.yaml First pass on pow faucet for testnet (#1624) 2019-02-19 12:32:14 -05:00
validator.deploy.yaml Allow 8 Validator Multinode Cluster to Run Indefinitely (#2050) 2019-03-25 10:21:21 -05:00

Minikube setup for Beacon-chain and 8 Validators

Set up Kubernetes and Minikube

Make sure you have kubectl installed

https://kubernetes.io/docs/tasks/tools/install-minikube/

https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#hyperkit-driver

Configure Hyperkit as your default

minikube config set vm-driver hyperkit

Running the beacon chain and validators in Minikube

Start Minikube and the dashboard

minikube start --memory 4096

minikube dashboard

Set up the beacon-chain config

Deploy a new deposit contract with:

bazel run //contracts/deposit-contract/deployContract -- --httpPath=https://goerli.prylabs.net --privKey=$(cat /path/to/private/key/file) --chainStart=8 --minDeposit=100000 --maxDeposit=3200000 --customChainstartDelay 120

Place the Goerli network deposit contract address from above in k8s/beacon-chain/beacon-config.config.yaml

Apply the namespace and config yamls

cd k8s/
kubectl apply -f priority.yaml

cd beacon-chain/
kubectl apply -f namespace.yaml
kubectl apply -f beacon-config.config.yaml

Edit the beacon-chain.deploy.yaml to prepare it for a local instance

Change the lines 40-53 to:

  args:
    - --web3provider=ws://goerli.prylabs.com/websocket
    #- --verbosity=debug
    - --deposit-contract=$(DEPOSIT_CONTRACT_ADDRESS)
    - --rpc-port=4000
    - --monitoring-port=9090
#    - --bootstrap-node=/ip4/$(BOOTNODE_SERVICE_HOST)/tcp/$(BOOTNODE_SERVICE_PORT)/p2p/QmQEe7o6hKJdGdSkJRh7WJzS6xrex5f4w2SPR6oWbJNriw
#    - --relay-node=/ip4/35.224.249.2/tcp/30000/p2p/QmfAgkmjiZNZhr2wFN9TwaRgHouMTBT6HELyzE5A3BT2wK
    - --p2p-port=5000
    - --demo-config
#    - --enable-tracing
#    - --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268
#    - --trace-sample-fraction=1.0
    - --datadir=/data

(commenting out the 3 tracing items and the bootstrap/relay nodes, also changing the web3 provider to ws://goerli.prylabs.com/websocket)

Apply the beacon chain yamls to start the beacon-chain

kubectl apply -f beacon-chain.service.yaml
kubectl apply -f beacon-chain.deploy.yaml

Go into the minikube dashboard and set your namespace to "beacon-chain" in the middle of the left side

You should see 3 beacon-chain node replicas

Add your private key into the cluster manger config

Convert a goerli private key with ETH to base64 in a browser js console and set it in k8s/beacon-chain/cluster-manager.encrypted_secret.yaml.

Edit the cluster-manager.yaml to use the Prylabs Goerli node endpoint

Change lines 55-63 to:

  args:
  - --deposit-contract=$(DEPOSIT_CONTRACT_ADDRESS)
  - --private-key=$(PRIVATE_KEY)
  - --rpc=ws://goerli.prylabs.com/websocket
  - --port=8000
  - --metrics-port=9090
  - --deposit-amount=3200000000000000
  - --db-path=/data
  - --verbose

Edit the validator.deploy.yaml to prepare it for a local instance

Change the lines 20-28 to:

  args:
  - --keystore-path=/keystore
  - --password=nopass
  - --datadir=/data
  - --beacon-rpc-provider=beacon-chain:4000
  - --demo-config
#  - --enable-tracing
#  - --tracing-endpoint=http://jaeger-collector.istio-system.svc.cluster.local:14268
#  - --trace-sample-fraction=1.0

(commenting out the bottom 3)

Apply the cluster manager and validator yamls

kubectl apply -f cluster-manager.encrypted_secret.yaml
kubectl apply -f cluster-manager.yaml
kubectl apply -f validator.deploy.yaml

Check the beacon-chain namespace in the dashboard and you should see 8 validators loading

Minikube common commands

To remove all the containers inside the minikube

kubectl delete -f k8s/beacon-chain/namespace.yaml

To stop the minikube instance

minikube stop

To delete the container

minikube delete