Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add in validator service. working blockchain deployment #20

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b96aa7a
wip. bug in docker build
gregcusack Mar 29, 2024
08f084a
build docker bootstrap image
gregcusack Mar 29, 2024
836d006
cargo-fmt/clippy. change to docker-build default
gregcusack Apr 8, 2024
e5097ad
push bootstrap to dockerhub registry. modify dockerconfig. create Doc…
gregcusack Mar 29, 2024
115b5f5
add create and deploy bootstrap secrets
gregcusack Apr 1, 2024
5402d0e
add bootstrap validator selector
gregcusack Apr 1, 2024
2a465b8
wip. adding replicaset but need validator config flags
gregcusack Apr 1, 2024
f2d65a1
add validator config
gregcusack Apr 1, 2024
15b1ae7
add pod requests. need for scheduling
gregcusack Apr 1, 2024
80c7496
create bootstrap validator replicaset
gregcusack Apr 1, 2024
4fb7b4e
refactor. add validator struct to clean up main
gregcusack Apr 2, 2024
5732486
refactor. add validator struct to clean up main
gregcusack Apr 2, 2024
1dad6c9
deploy bootstrap validator
gregcusack Apr 2, 2024
f29654c
rebase for updated validator struct
gregcusack Apr 8, 2024
1e23150
wip. added bootstrap service. need lb service
gregcusack Apr 2, 2024
02b2849
deploy and wait for validator ready. need readme update
gregcusack Apr 2, 2024
5078887
update readme. update progress. fix selector bug
gregcusack Apr 2, 2024
1a6f572
add metrics
gregcusack Apr 2, 2024
1b124f8
create N validator accounts
gregcusack Apr 2, 2024
3d154bb
create and deploy validator secrets
gregcusack Apr 2, 2024
d73d011
create validator selectors
gregcusack Apr 3, 2024
ca24ac1
add in build and push validator docker images
gregcusack Apr 3, 2024
4d80096
wip. more work
gregcusack Apr 3, 2024
2056649
i forgot to build the validator docker images first
gregcusack Apr 3, 2024
8c191f5
working. build and deploy validators
gregcusack Apr 3, 2024
7e53ece
update scripts to work with agave and solana validator versions
gregcusack Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ log = "0.4.21"
rand = "0.8.5"
reqwest = { version = "0.11.23", features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
rustls = { version = "0.21.10", default-features = false, features = ["quic"] }
solana-accounts-db = "1.18.8"
solana-core = "1.18.8"
solana-ledger = "1.18.8"
solana-logger = "1.18.8"
solana-sdk = "1.18.8"
strum = "0.26.2"
Expand Down
36 changes: 19 additions & 17 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,40 @@
- [x] Create Genesis
- [x] Generate faucet and bootstrap accounts
- [x] Build genesis
- [ ] Docker Build
- [ ] Build Bootstrap Image
- [ ] Push Image to registry
- [x] Docker Build and Push to registry
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Create & Deploy Secrets
- [ ] Bootstrap
- [ ] Validator (regular)
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Create & Deploy Selector
- [ ] Bootstrap
- [ ] Validator (regular)
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Create & Deploy Replica Set
- [ ] Bootstrap
- [ ] Validator (regular)
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Create & Deploy Services
- [ ] Bootstrap
- [ ] Validator (regular)
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Check Bootstrap is deployed and running
- [ ] Build and deploy Load Balancer (sits in front of bootstrap and RPC nodes)
- [x] Check Bootstrap is deployed and running
- [x] Build and deploy Load Balancer (sits in front of bootstrap and RPC nodes)
- [ ] Add metrics
- [ ] Bootstrap
- [ ] Validator (regular)
- [x] Bootstrap
- [x] Validator (regular)
- [ ] RPC nodes
- [ ] Client
- [ ] Create accounts
- [ ] Validator (regular)
- [x] Validator (regular)
- [ ] RPC
- [ ] Client
- [ ] Add feature flags to configure:
Expand All @@ -69,7 +71,7 @@ Above, we start with bootstrap, and then we do validators (regular), and then we
- Use command line flags to set type of client, tx-count, etc

- [ ] Add in kubernetes deployment flags
- [ ] CPU/Memory Requests
- [x] CPU/Memory Requests
- [ ] Node Affinity -> Regions
- [ ] Node Affinity -> Node Type (Equinix/Lumen)

Expand Down
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ kubectl create ns <namespace>
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--local-path <path-to-local-agave-monorepo>
```

#### Build specific Agave release
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--release-channel <agave-version: e.g. v1.17.28> # note: MUST include the "v"
```

#### Build from Local Repo and Configure Genesis
#### Build from Local Repo and Configure Genesis and Bootstrap Validator Image
Example:
```
cargo run --bin cluster --
-n <namespace>
--num_validators <number-of-non-bootstrap-voting-validators>
--local-path /home/sol/solana
# genesis config. Optional: Many of these have defaults
--hashes-per-tick <hashes-per-tick>
Expand All @@ -51,4 +54,64 @@ cargo run --bin cluster --
--max-genesis-archive-unpacked-size <size in bytes>
--target-lamports-per-signature <lamports-per-signature>
--slots-per-epoch <slots-per-epoch>
# docker config
--registry <docker-registry> # e.g. gregcusack
--tag <docker-image-tag> # e.g. v1
--base-image <base-image> # e.g. ubuntu:20.04
--image-name <docker-image-name> # e.g. cluster-image
# validator config
--full-rpc
--internal-node-sol <Sol>
--internal-node-stake-sol <Sol>
# kubernetes config
--cpu-requests <cores>
--memory-requests <memory>
```

## Metrics
1) Setup metrics database:
```
cd scripts/
./init-metrics -c <database-name> <metrics-username>
# enter password when promted
```
2) add the following to your `cluster` command from above
```
--metrics-host https://internal-metrics.solana.com # need the `https://` here
--metrics-port 8086
--metrics-db <database-name> # from (1)
--metrics-username <metrics-username> # from (1)
--metrics-password <metrics-password> # from (1)
```


## Kubernetes Cheatsheet
Create namespace:
```
kubectl create ns <namespace>
```

Delete namespace:
```
kubectl delete ns <namespace>
```

Get running pods:
```
kubectl get pods -n <namespace>
```

Get pod logs:
```
kubectl logs -n <namespace> <pod-name>
```

Exec into pod:
```
kubectl exec -it -n <namespace> <pod-name> -- /bin/bash
```

Get information about pod:
```
kubectl describe pod -n <namespace> <pod-name>
```
87 changes: 87 additions & 0 deletions scripts/init-metrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash
set -e

here=$(dirname "$0")
# shellcheck source=net/common.sh
source "$here"/common.sh

usage() {
exitcode=0
if [[ -n "$1" ]]; then
exitcode=1
echo "Error: $*"
fi
cat <<EOF
usage: $0 [-e] [-d] [-c database_name] [username]

Creates a testnet dev metrics database

username InfluxDB user with access to create a new database
-c Manually specify a database to create, rather than read from config file
-d Delete the database instead of creating it
-e Assume database already exists and SOLANA_METRICS_CONFIG is
defined in the environment already

EOF
exit $exitcode
}

useEnv=false
delete=false
createWithoutConfig=false
host="https://internal-metrics.solana.com:8086"
while getopts ":hdec:" opt; do
case $opt in
h)
usage
exit 0
;;
c)
createWithoutConfig=true
netBasename=$OPTARG
;;
d)
delete=true
;;
e)
useEnv=true
;;
*)
usage "unhandled option: $OPTARG"
;;
esac
done
shift $((OPTIND - 1))

if $useEnv; then
[[ -n $SOLANA_METRICS_CONFIG ]] ||
usage "SOLANA_METRICS_CONFIG is not defined in the environment"
else
username=$1
[[ -n "$username" ]] || usage "username not specified"

read -rs -p "InfluxDB password for $username: " password
[[ -n $password ]] || { echo "Password not specified"; exit 1; }
echo

password="$(urlencode "$password")"

query() {
echo "$*"
set -x
curl -XPOST \
"$host/query?u=${username}&p=${password}" \
--data-urlencode "q=$*"
}

query "DROP DATABASE \"$netBasename\""
! $delete || exit 0
query "CREATE DATABASE \"$netBasename\""
query "ALTER RETENTION POLICY autogen ON \"$netBasename\" DURATION 7d"
query "GRANT READ ON \"$netBasename\" TO \"ro\""
query "GRANT WRITE ON \"$netBasename\" TO \"scratch_writer\""

SOLANA_METRICS_CONFIG="host=$host,db=$netBasename,u=scratch_writer,p=topsecret"
fi

exit 0
Loading