Skip to content

Instantly share code, notes, and snippets.

@dendisuhubdy
Forked from Bambarello/099_docker.sh
Created April 13, 2022 00:20
Show Gist options
  • Save dendisuhubdy/c675c6cc60c3abff93166316116b6376 to your computer and use it in GitHub Desktop.
Save dendisuhubdy/c675c6cc60c3abff93166316116b6376 to your computer and use it in GitHub Desktop.
####
# пути к ключам будут вида /solana/validator-keypair.json
# а на хосте они будут лежать в папке /root/solana_blabla. например /root/solana_agx10k
####
#######################################dockerfile####
echo "export SOLANA_NAME=<имя>" | tee -a ~/.bashrc ### например AG
source ~/.bashrc
echo "export SOLANA_DIR=/root/solana_${SOLANA_NAME}" | tee -a ~/.bashrc
echo "export SOLANA_CONTAINER=solana_validator_${SOLANA_NAME}" | tee -a ~/.bashrc
source ~/.bashrc
mkdir -p ${SOLANA_DIR}
cd ${SOLANA_DIR}
wget https://gist.githubusercontent.com/AGx10k/b3bf9c126bb97febb7f8f7d5fbceb6e5/raw/ -O Dockerfile
docker build -t solana .
в текущую директорию (должно быть /root/solana_имя) кладём файл ключа validator-keypair.json, который генерировали в прошлой части
### длинная форма run команд
###docker run -it --rm -v ${SOLANA_DIR}:/root --name ${SOLANA_CONTAINER} -e SOLANA_NAME --network="host" --privileged solana:latest solana config set --url http://tds.solana.com --keypair ~/validator-keypair.json
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana config set --url http://tds.solana.com --keypair /solana/validator-keypair.json
### проверка конфига
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana config get
### баланс
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana balance
#### почему-то если просто запустить solana-gossip spy, то не реагирует на ctrl-c и не получается выйти...
### поэтому запускаем баш, в нём команду, потом выходим
### Confirm the Solana network is running
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest bash
solana-gossip spy --entrypoint tds.solana.com:8001
exit
### show validators
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana show-validators
### Finally the ping command can be used to check that the cluster is able to process transactions:
### без баланса не работает!
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana ping
###Create Vote Account
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana-keygen new -o /solana/vote-account-keypair.json
###Create your vote account on the blockchain:
docker run -v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config --rm -it solana:latest solana create-vote-account /solana/vote-account-keypair.json /solana/validator-keypair.json
### start validator
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network#connect-your-validator
docker run --name ${SOLANA_CONTAINER} -d --restart=always \
-v ${SOLANA_DIR}:/solana/ -v ${SOLANA_DIR}/.config/:/root/.config \
--network="host" --privileged -e SOLANA_NAME \
-e SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=tds_writer,p=dry_run" solana:latest \
solana-validator --identity /solana/validator-keypair.json \
--vote-account /solana/vote-account-keypair.json \
--ledger /solana/validator-ledger \
--rpc-port 8899 \
--entrypoint tds.solana.com:8001 \
--limit-ledger-size
### catchup
docker exec -it ${SOLANA_CONTAINER} solana catchup /solana/validator-keypair.json
### publish info
### ЗАПОЛНИТЬ ПОЛЯ!!!!
docker exec -it ${SOLANA_CONTAINER} solana validator-info publish "<your_name>" -n <keybase_username> [-w "https://<example.com/blabla"]
например:
docker exec -it ${SOLANA_CONTAINER} solana validator-info publish "AG" -n agx10k
###Staking
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/delegating-stake
### Create Stake Keypair
docker exec -it ${SOLANA_CONTAINER} solana-keygen new -o /solana/validator-stake-keypair.json
### Create stake account
docker exec -it ${SOLANA_CONTAINER} solana create-stake-account /solana/validator-stake-keypair.json 1
### Delegate stake to your validator
docker exec -it ${SOLANA_CONTAINER} solana delegate-stake /solana/validator-stake-keypair.json /solana/vote-account-keypair.json
### View your vote account:
docker exec -it ${SOLANA_CONTAINER} solana vote-account /solana/vote-account-keypair.json
### View your stake account, the delegation preference and details of your stake:
docker exec -it ${SOLANA_CONTAINER} solana stake-account /solana/validator-stake-keypair.json
### проверить все стейки, делегированные на аккаунт
docker exec -it ${SOLANA_CONTAINER} solana stakes /solana/vote-account-keypair.json
### проверить "next leader slot"
docker exec -it ${SOLANA_CONTAINER} bash -c 'grep "My next leader slot is" *log | tail -n50'
###Solana
###TODO: register validator??
###https://docs.google.com/forms/d/e/1FAIpQLSde61JRq3kzsTr20MbcxH8it0zMz5LLc5xWVO6YfPA7yQE0uQ/viewform
screen -S solana -h 100000
docker run -it --name solana --network host --device /dev/fuse --cap-add SYS_ADMIN --privileged rust:slim-buster bash
PS1='🐳 Solana \[\033[1;36m\]\h \[\033[1;34m\]\W\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'
apt-get -yq update && apt-get -yq install screen mc htop strace strace wget curl git unzip etckeeper tmux psmisc dnsutils bc jq lynx ntp net-tools software-properties-common wget whois pciutils curl lsof vim gawk rsync sudo build-essential
#keybase
curl --remote-name https://prerelease.keybase.io/keybase_amd64.deb
apt install ./keybase_amd64.deb
### придумать пользователю юзернейм любой
echo "export USERNAME=<username>" | tee -a ~/.bashrc
source ~/.bashrc
useradd $USERNAME -s /bin/bash
mkdir /home/$USERNAME
chown -R $USERNAME:$USERNAME /home/$USERNAME
sudo -i -u $USERNAME
# run without GUI
run_keybase -g
keybase login
### solana
### ctrl-D - exit (from user)
### as root
echo "export SOLANA_KEYBASE_USERNAME=<keybase_username>" | tee -a ~/.bashrc
source ~/.bashrc
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v0.22.2/install/solana-install-init.sh | sh -s - 1.1.2
export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
solana-keygen new -o ~/validator-keypair.json
#### СОХРАНИТЬ файл и сохранить вывод на экране!!
echo "export SOLANA_PUBKEY=$(solana-keygen pubkey ~/validator-keypair.json)" | tee -a ~/.bashrc
source ~/.bashrc
sudo -u $USERNAME mkdir -p /keybase/public/${SOLANA_KEYBASE_USERNAME}/solana/
sudo -u $USERNAME touch /keybase/public/${SOLANA_KEYBASE_USERNAME}/solana/validator-${SOLANA_PUBKEY}
echo "https://keybase.pub/${SOLANA_KEYBASE_USERNAME}/solana/"
^ проверить, что папка открывается в браузере и что файл существует
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/connecting-your-validator
### Create and configure a Solana validator
solana config set --url http://tds.solana.com --keypair ~/validator-keypair.json
solana config get
после этого - просим монеты в дискорде
#проверка баланса:
solana balance
solana balance --lamports
####################### остальное - только после получения монет
################################### начинаем создавать нормальный контейнер ##################3
echo "export SOLANA_NAME=<имя>" | tee -a ~/.bashrc ### например AG
source ~/.bashrc
echo "export SOLANA_DIR=/root/solana_${SOLANA_NAME}" | tee -a ~/.bashrc
echo "export SOLANA_CONTAINER=solana-validator-${SOLANA_NAME}" | tee -a ~/.bashrc
source ~/.bashrc
mkdir -p ${SOLANA_DIR}
cd ${SOLANA_DIR}
###docker run -it --name ${SOLANA_CONTAINER} --network host -v ${SOLANA_DIR}:/root/ --device /dev/fuse -e SOLANA_NAME --cap-add SYS_ADMIN --privileged rust:slim-buster bash
docker run -it --name ${SOLANA_CONTAINER} --network host -v ${SOLANA_DIR}:/root/ -e SOLANA_NAME --privileged rust:slim-buster bash
### добавь эту строчку в ~/.bashrc
PS1='🐳 Solana-'$SOLANA_NAME' \[\033[1;36m\]\h \[\033[1;34m\]\W\[\033[0;35m\] \[\033[1;36m\]# \[\033[0m\]'
### создать старый ключ validator-keypair.json в домашней директории
apt-get -yq update && apt-get -yq install screen mc htop strace strace wget curl git unzip etckeeper tmux psmisc dnsutils bc jq lynx ntp net-tools software-properties-common wget whois pciutils curl lsof vim gawk rsync sudo build-essential
### install solana
curl -sSf https://raw.githubusercontent.com/solana-labs/solana/v0.22.2/install/solana-install-init.sh | sh -s - 1.1.2
echo 'export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"' | tee -a ~/.bashrc
source ~/.bashrc
solana config set --url http://tds.solana.com --keypair ~/validator-keypair.json
solana balance
echo "export SOLANA_PUBKEY=$(solana-keygen pubkey ~/validator-keypair.json)" | tee -a ~/.bashrc
source ~/.bashrc
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/confirm-the-solana-network-is-running
### Confirm the Solana network is running
solana-gossip spy --entrypoint tds.solana.com:8001
### статус сети
### список валидаторов
solana show-validators
### Finally the ping command can be used to check that the cluster is able to process transactions:
### без баланса не работает!
solana ping
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network
### Connect to the Solana network
solana-keygen new -o ~/vote-account-keypair.json
### зарегистрировать акк в блокчейне (не сработает без баланса)
solana create-vote-account ~/vote-account-keypair.json ~/validator-keypair.json
### Connect Your Validator
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network#connect-your-validator
echo 'export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=tds_writer,p=dry_run"' | tee -a ~/.bashrc
source ~/.bashrc
#solana-validator --identity ~/validator-keypair.json \
# --vote-account ~/vote-account-keypair.json \
# --authorized-voter ~/vote-account-keypair.json \
# --ledger ~/validator-ledger --rpc-port 8899 --entrypoint tds.solana.com:8001 \
# --limit-ledger-size
solana-validator --identity ~/validator-keypair.json \
--vote-account ~/vote-account-keypair.json \
--ledger ~/validator-ledger --rpc-port 8899 --entrypoint tds.solana.com:8001 \
--limit-ledger-size
ctrl-p-q
### проверить, что наш валидатор появился в списке
solana-gossip spy --entrypoint tds.solana.com:8001
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/monitoring-your-validator
### catch-up - проверить, что валидатор отсинхронился - должно написать "has caught up"
solana catchup ~/validator-keypair.json
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/delegating-stake
### Create Stake Keypair
solana-keygen new -o ~/validator-stake-keypair.json
### сохранить!
### delegate 1 SOL
solana create-stake-account ~/validator-stake-keypair.json 1
solana delegate-stake ~/validator-stake-keypair.json ~/vote-account-keypair.json
### View your vote account:
### This displays the current state of all the votes the validator has submitted to the network.
solana vote-account ~/vote-account-keypair.json
### View your stake account, the delegation preference and details of your stake:
solana stake-account ~/validator-stake-keypair.json
### displays the current active stake of all validators, including yours
solana validators
### shows the history of stake warming up and cooling down over recent epochs
solana stake-history
### publish info about validator
solana validator-info publish "<some name>" -n <keybase_username> -w "<website>"
### example:
###solana validator-info publish "Elvis Validator" -n elvis -w "https://elvis-validates.com"
########## СЮДА НЕ ХОДИТЬ!!!!
#######################################dockerfile####
echo "export SOLANA_NAME=<имя>" | tee -a ~/.bashrc ### например AG
source ~/.bashrc
echo "export SOLANA_DIR=/root/solana_${SOLANA_NAME}" | tee -a ~/.bashrc
echo "export SOLANA_CONTAINER=solana_validator_${SOLANA_NAME}" | tee -a ~/.bashrc
source ~/.bashrc
mkdir -p ${SOLANA_DIR}
cd ${SOLANA_DIR}
wget https://gist.githubusercontent.com/AGx10k/b3bf9c126bb97febb7f8f7d5fbceb6e5/raw/ -O Dockerfile
docker build -t solana .
в текущую директорию (должно быть /root/solana_имя) кладём файл ключа validator-keypair.json, который генерировали в прошлой части
### длинная форма run команд
###docker run -it --rm -v ${SOLANA_DIR}:/root --name ${SOLANA_CONTAINER} -e SOLANA_NAME --network="host" --privileged solana:latest solana config set --url http://tds.solana.com --keypair ~/validator-keypair.json
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana config set --url http://tds.solana.com --keypair ~/validator-keypair.json
### проверка конфига
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana config get
### баланс
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana balance
#### почему-то если просто запустить solana-gossip spy, то не реагирует на ctrl-c и не получается выйти...
### поэтому запускаем баш, в нём команду, потом выходим
### Confirm the Solana network is running
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana balance bash
solana-gossip spy --entrypoint tds.solana.com:8001
exit
### show validators
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana show-validators
### Finally the ping command can be used to check that the cluster is able to process transactions:
### без баланса не работает!
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana ping
###Create Vote Account
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana-keygen new -o ~/vote-account-keypair.json
###Create your vote account on the blockchain:
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana create-vote-account ~/vote-account-keypair.json ~/validator-keypair.json
### start validator
### https://docs.solana.com/tour-de-sol/participation/steps-to-create-a-validator/connect-to-the-solana-network#connect-your-validator
docker run --name ${SOLANA_CONTAINER} -d --restart=always -v ${SOLANA_DIR}:/root \
--network="host" --privileged -e SOLANA_NAME \
-e SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=tds_writer,p=dry_run" solana:latest \
solana-validator --identity ~/validator-keypair.json \
--vote-account ~/vote-account-keypair.json \
--ledger ~/validator-ledger \
--rpc-port 8899 \
--entrypoint tds.solana.com:8001 \
--limit-ledger-size
### catchup
docker run -v ${SOLANA_DIR}:/root --rm -it solana:latest solana catchup ~/validator-keypair.json
### солана почти не
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment