Last active
August 10, 2022 15:32
-
-
Save BlockByBlock/78d8c5ee866396b5014be195930301c9 to your computer and use it in GitHub Desktop.
Sui node service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits to Sr20de | |
# Checkout article here https://medium.com/@sr20de/sui-devnet-run-a-node-491698aaa130 | |
# Install node only | |
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch "devnet" sui-node | |
sudo cp $HOME/.cargo/bin/sui-node /usr/bin/ | |
mkdir $HOME/.sui | |
wget -O $HOME/.sui/fullnode.yaml https://raw.githubusercontent.com/MystenLabs/sui/main/crates/sui-config/data/fullnode-template.yaml | |
wget -P $HOME/.sui/ https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob | |
# sed edit for fullnode.yaml | |
sed -i.bak 's/127.0.0.1/0.0.0.0/' $HOME/.sui/fullnode.yaml | |
sed -i -e "s%db-path:.*%db-path: \"$HOME/.sui/db\"%; " $HOME/.sui/fullnode.yaml | |
sed -i -e "s%genesis-file-location:.*%genesis-file-location: \"$HOME/.sui/genesis.blob\"%; " $HOME/.sui/fullnode.yaml | |
# fullnode.yaml | |
db-path: "/root/.sui/db" | |
network-address: "/dns/localhost/tcp/8080/http" | |
metrics-address: "0.0.0.0:9184" | |
json-rpc-address: "0.0.0.0:9000" | |
genesis: | |
genesis-file-location: "/root/.sui/genesis.blob" | |
# service file | |
sudo tee /etc/systemd/system/suid.service > /dev/null <<EOF | |
[Unit] | |
Description=Sui node | |
After=network-online.target | |
[Service] | |
User=$USER | |
ExecStart=/usr/bin/sui-node --config-path $HOME/.sui/fullnode.yaml | |
Restart=on-failure | |
RestartSec=3 | |
LimitNOFILE=65535 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
# Restart services and run Sui with log output: | |
sudo systemctl daemon-reload && \ | |
sudo systemctl enable suid && \ | |
sudo systemctl restart suid && sudo journalctl -u suid -f -o cat | |
# Check the node | |
echo "http://`wget -qO- icanhazip.com`:9000" | |
# Update | |
sudo systemctl stop suid | |
rm -rf $HOME/.sui/db | |
rm $HOME/.sui/genesis.blob | |
wget -P $HOME/.sui/ https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob | |
cargo install --locked --git https://github.com/MystenLabs/sui.git --branch "devnet" sui-node | |
sudo cp $HOME/.cargo/bin/sui-node /usr/bin/ | |
sudo systemctl restart suid && sudo journalctl -u suid -f -o cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment