Kuruluma başlıyoruz. Öncelike sunucumuza gerekli güncellemeleri ve kurulumları yapalım.
sudo su
cd
sudo apt update && sudo apt upgrade -y
sudo apt install curl build-essential git wget jq make gcc tmux chrony -y
cd
ver="1.18.5"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version
Binary dosyalarını indiriyoruz.
cd $HOME
rm -rf gitopia
curl https://get.gitopia.com | bash
git clone -b v1.2.0 gitopia://gitopia/gitopia
cd gitopia
make install
Node'un konfigürasyon ayarlarını yapıp başlatıyoruz.
gitopiad config chain-id $GITOPIA_CHAIN_ID
gitopiad config keyring-backend test
gitopiad config node tcp://localhost:${GITOPIA_PORT}657
gitopiad init <NODEADINIZ> --chain-id gitopia-janus-testnet-2
Genesis dosyasını indiriyoruz.
wget -O $HOME/.gitopia/config/addrbook.json "http://65.108.6.45:8000/gitopia/addrbook.json"
wget https://server.gitopia.com/raw/gitopia/testnets/master/gitopia-janus-testnet-2/genesis.json.gz
gunzip genesis.json.gz
mv genesis.json $HOME/.gitopia/config/genesis.json
Peer ayarlamaları yapıyoruz.
SEEDS="[email protected] :26656"
PEERS=""
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.gitopia/config/config.toml
sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${GITOPIA_PORT}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${GITOPIA_PORT}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${GITOPIA_PORT}060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${GITOPIA_PORT}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${GITOPIA_PORT}660\"%" $HOME/.gitopia/config/config.toml
sed -i.bak -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${GITOPIA_PORT}317\"%; s%^address = \":8080\"%address = \":${GITOPIA_PORT}080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${GITOPIA_PORT}090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${GITOPIA_PORT}091\"%; s%^address = \"0.0.0.0:8545\"%address = \"0.0.0.0:${GITOPIA_PORT}545\"%; s%^ws-address = \"0.0.0.0:8546\"%ws-address = \"0.0.0.0:${GITOPIA_PORT}546\"%" $HOME/.gitopia/config/app.toml
pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="50"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.gitopia/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.gitopia/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.gitopia/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.gitopia/config/app.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0utlore\"/" $HOME/.gitopia/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.gitopia/config/config.toml
gitopiad tendermint unsafe-reset-all --home $HOME/.gitopia
Servis dosyası oluşturuyoruz.
sudo tee /etc/systemd/system/gitopiad.service > /dev/null <<EOF
[Unit]
Description=gitopia
After=network-online.target
[Service]
User=$USER
ExecStart=$(which gitopiad) start --home $HOME/.gitopia
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
systemctl restart systemd-journald.service
sudo systemctl enable gitopiad
sudo systemctl restart gitopiad && journalctl -u gitopiad -f -o cat
Dilerseniz StateSync yükleyebilirsiniz.
SNAP_RPC=https://gitopia-testnet-rpc.polkachu.com:443
peers="[email protected] :46656,[email protected] :11356,[email protected] :11356,[email protected] :21656,[email protected] :26656,[email protected] :26656,[email protected] :19656,[email protected] :46656,[email protected] :26656,[email protected] :24256,[email protected] :29686,[email protected] :11156,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :7040,[email protected] :656,[email protected] :7040,[email protected] :7040,[email protected] :7070,[email protected] :26878,[email protected] :27956,[email protected] :36656,[email protected] :26656,[email protected] :36656,[email protected] :27001,[email protected] :26656,[email protected] :36656,[email protected] :24656,[email protected] :36656,[email protected] :60756,[email protected] :17656,[email protected] :12656,[email protected] :46656,[email protected] :11156,[email protected] :46656,[email protected] :16656,[email protected] :35656,[email protected] :26656,[email protected] :34656,[email protected] :34656,[email protected] :26656,[email protected] :26656,[email protected] :34656,[email protected] :15656,[email protected] :28656,[email protected] :31656,[email protected] :16656,[email protected] :26656,[email protected] :22656,[email protected] :26676,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :19656,[email protected] :41656,[email protected] :11056,[email protected] :26656,[email protected] :13656,[email protected] :26656,[email protected] :14656,[email protected] :29656,[email protected] :60756,[email protected] :33656,[email protected] :60756,[email protected] :26656,[email protected] :60756,[email protected] :56656,[email protected] :26656,[email protected] :38816,[email protected] :26656,[email protected] :36656,[email protected] :26656,[email protected] :36656,[email protected] :41656,[email protected] :32656,[email protected] :41656,[email protected] :41656,[email protected] :26656,[email protected] :26556,[email protected] :13656,[email protected] :22656,[email protected] :46656,[email protected] :30656,[email protected] :26858,[email protected] :41656,[email protected] :26256,[email protected] :26656,[email protected] :40656,[email protected] :30656,[email protected] :26156,[email protected] :656,[email protected] :56656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26676,[email protected] :656,[email protected] :28656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :6656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656,[email protected] :26656"
sed -i 's|^persistent_peers *=.*|persistent_peers = "'$peers'"|' $HOME/.gitopia/config/config.toml
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.gitopia/config/config.toml
gitopiad tendermint unsafe-reset-all --home /root/.gitopia
systemctl restart gitopiad && journalctl -u gitopiad -f -o cat