-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsui.sh
57 lines (47 loc) · 2.13 KB
/
sui.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
echo -e "\033[0;35m"
echo " ::: ::: ::::::::::: :::: ::: :::::::: ::::::::: :::::::::: :::::::: ";
echo " :+: :+: :+: :+:+: :+: :+: :+: :+: :+: :+: :+: :+: ";
echo " +:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ ";
echo " :+#++:+ +#+ +#+ +:+ +#+ +#+ +:+ +#+ +:+ :+#++:++# :+#++:++# ";
echo " :+#+ +:+ +#+ +#+ +#+#+# +#+ +#+ +#+ +#+ :+# :+# +:+ ";
echo " #+# #+# #+# #+# #+# #+#+# #+# #+# #+# #+# #+# #+# #+# ";
echo " ### ### ##### ### #### ######## ######### ########## ######## ";
echo -e "\e[0m
sleep 2
echo -e "\e[1m\e[32m1. Updating packages... \e[0m" && sleep 1
# update
sudo apt update && sudo apt upgrade -y
echo -e "\e[1m\e[32m2. Installing dependencies... \e[0m" && sleep 1
# packages
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.23.1/yq_linux_amd64 && chmod +x /usr/local/bin/yq
sudo apt-get install jq -y
# download sui binaries
version=$(wget -qO- https://api.github.com/repos/SecorD0/Sui/releases/latest | jq -r ".tag_name")
wget -qO- "https://github.com/SecorD0/Sui/releases/download/${version}/sui-linux-amd64-${version}.tar.gz" | sudo tar -C /usr/local/bin/ -xzf -
# download and update configs
mkdir -p $HOME/.sui
wget -qO $HOME/.sui/fullnode.yaml https://github.com/MystenLabs/sui/raw/main/crates/sui-config/data/fullnode-template.yaml
wget -qO $HOME/.sui/genesis.blob https://github.com/MystenLabs/sui-genesis/raw/main/devnet/genesis.blob
yq -i ".db-path = \"$HOME/.sui/db\"" $HOME/.sui/fullnode.yaml
yq -i '.metrics-address = "0.0.0.0:9184"' $HOME/.sui/fullnode.yaml
yq -i '.json-rpc-address = "0.0.0.0:9000"' $HOME/.sui/fullnode.yaml
yq -i ".genesis.genesis-file-location = \"$HOME/.sui/genesis.blob\"" $HOME/.sui/fullnode.yaml
# create sui service
sudo tee /etc/systemd/system/suid.service > /dev/null <<EOF
[Unit]
Description=Sui node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which sui-node) --config-path $HOME/.sui/fullnode.yaml
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# start sui node
sudo systemctl daemon-reload
sudo systemctl enable suid
sudo systemctl restart suid