Скрипт для запуска seed ноды тестнета


Скрипт можно использовать как boot startup script в облачном хостинге, например, в https://vultr.com/.

При необходимости поменять размер swap, дополнить config делегатом/плагинами.

#!/bin/sh
fallocate -l 10G /swapfile
ls -lh /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon --show

mount -o remount,size=10G /dev/shm
mount -l | grep "/dev/shm"

free -h
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
cat /etc/fstab

sysctl vm.swappiness=80
sysctl vm.vfs_cache_pressure=50
echo "vm.swappiness=80" >> /etc/sysctl.conf
echo "vm.vfs_cache_pressure=50" >> /etc/sysctl.conf
tail /etc/sysctl.conf

apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get install -y build-essential
sudo apt-get install -y autoconf automake cmake g++ git libssl-dev libtool make pkg-config python3 python3-jinja2
sudo apt-get install -y libboost-chrono-dev libboost-context-dev libboost-coroutine-dev libboost-date-time-dev libboost-filesystem-dev libboost-iostreams-dev libboost-locale-dev libboost-program-options-dev libboost-serialization-dev libboost-signals-dev libboost-system-dev libboost-test-dev libboost-thread-dev
sudo apt-get install -y doxygen libncurses5-dev libreadline-dev perl

mkdir /viz
cd /viz
git clone https://github.com/VIZ-World/viz-world.git
cd /viz/viz-world
git checkout master
git submodule update --init --recursive -f

mkdir /viz/viz-world/build
cd /viz/viz-world/build

cmake -DCMAKE_BUILD_TYPE=Release ..
cd /viz/viz-world/build/ && nohup make -j$(nproc) vizd > buildlog_vizd.txt
cd /viz/viz-world/build/ && nohup make -j$(nproc) cli_wallet > buildlog_cli_wallet.txt

cd /viz/viz-world/build/programs/vizd/ && rm -f screenlog.0 && screen -dmLS vizd /viz/viz-world/build/programs/vizd/vizd --resync
sleep 5s
screen -S vizd -p 0 -X quit

cat <<EOT > /viz/viz-world/build/programs/vizd/witness_node_data_dir/config.ini
shared-file-dir = "blockchain"
shared-file-size = 2G
inc-shared-file-size = 2G
min-free-shared-file-size = 500M
block-num-check-free-size = 1000
single-write-thread = 0
clear-votes-before-block = 0
skip-virtual-ops = 0
enable-plugins-on-push-transaction = 1
follow-max-feed-size = 500
webserver-thread-pool-size = 256

p2p-seed-node = 140.82.37.172:8082 # testnet
p2p-endpoint = 0.0.0.0:8082

[log.console_appender.stderr]
stream = std_error

[log.file_appender.p2p]
filename = logs/p2p/p2p.log

[logger.default]
level = all
appenders = stderr

[logger.p2p]
level = all
appenders = p2p
EOT

cd /viz/viz-world/build/programs/vizd/ && rm -f screenlog.0 && screen -dmLS vizd /viz/viz-world/build/programs/vizd/vizd --resync

Проверка статуса билда vizd: cat /viz/viz-world/build/buildlog_vizd.txt

Проверка вывода сессии ноды: cat /viz/viz-world/build/programs/vizd/screenlog.0

Вернуться в сессию ноды: screen -x vizd

Вернуться в консоль: Ctrl+A+D, завершить работу ноды: Ctrl+C


Comments 1