-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0g_kv_install.sh
66 lines (49 loc) · 1.44 KB
/
0g_kv_install.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
58
59
60
61
62
63
64
65
66
#!/bin/bash
cd
sudo systemctl stop 0gkv
rm -r 0g-storage-kv
echo "Updating system..."
sudo apt update && sudo apt upgrade -y
echo "Cloning repository..."
git clone -b v1.4.0 https://github.com/0glabs/0g-storage-kv.git
cd $HOME/0g-storage-kv
echo "Stashing any local changes..."
git stash
echo "Fetching all tags..."
git fetch --all --tags
echo "Checking out commit 0f1510a..."
git checkout 1e7c207
echo "Updating submodules..."
git submodule update --init
echo "Building the project..."
cargo build --release
echo "Removing existing config file..."
rm -rf $HOME/0g-storage-kv/run/config.toml
echo "Downloading new config file..."
curl -o $HOME/0g-storage-kv/run/config.toml https://raw.githubusercontent.com/zstake-xyz/test/main/0g_kv_config.toml
echo "Creating systemd service file..."
sudo tee /etc/systemd/system/0gkv.service > /dev/null <<EOF
[Unit]
Description=0G-KV Node
After=network.target
[Service]
User=root
WorkingDirectory=$HOME/0g-storage-kv/run
ExecStart=$HOME/0g-storage-kv/target/release/zgs_kv --config $HOME/0g-storage-kv/run/config.toml
Restart=always
RestartSec=10
LimitNOFILE=65535
StandardOutput=journal
StandardError=journal
SyslogIdentifier=zgs_kv
[Install]
WantedBy=multi-user.target
EOF
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Enabling the service..."
sudo systemctl enable 0gkv
echo "Starting the service..."
sudo systemctl start 0gkv
echo "Tailing the service logs..."
sudo journalctl -u 0gkv -f -o cat