Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 0xhousemd/cc07f19ea69a6473845c8f34a1075682 to your computer and use it in GitHub Desktop.
Save 0xhousemd/cc07f19ea69a6473845c8f34a1075682 to your computer and use it in GitHub Desktop.

Running a Ziesha Node under Systemd Service

Lets run the Node using systemd service

first lets install the server as is described in ziesha github

1.- sudo apt-get update && sudo apt-get upgrade
2.- sudo apt install -y build-essential libssl-dev cmake
3.- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
a prompt message will appears please choose option 1 and press ENTER after cargo/rustup installation is over lets continue with the how-to.
4.- source "$HOME/.cargo/env"
5- git clone https://github.com/ziesha-network/bazuka
6.- cd bazuka
7.- cargo install --path .

Now your node is compiling installing Bazuka..Give some Time.

now lets setup Systemd service

1.- copy the whole block of code and paste in the terminal and Hit ENTER

echo "[Unit]
Description=Ziesha
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/bazuka
ExecStart=/bin/bash -c 'PATH=$HOME/.cargo/bin:$PATH exec bazuka node start --discord-handle \"add-here-your-discord-id\"'
Restart=always
RestartSec=10
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
" > $HOME/zieshad.service

2.- now lets edit that file to add your Discord-id
nano $HOME/zieshad.service
3.- use the ArrowKey to move to that part of the code add-here-your-discord-id and change that to your Discord-ID
4.- save it with:
CTRL X Y + ENTER
5.- Lets move that file under systemd directory
sudo mv $HOME/zieshad.service /etc/systemd/system
6.- lets check that everything is ok
cat /etc/systemd/system/zieshad.service
7.- Lets Enable zieshad service to boot with the machine
sudo systemctl enable /etc/systemd/system/zieshad.service

now lets start the node (the follow script use pelmeni-3 network for use it future testnet just change the name.)

Use one of the following Options to start your node. (not both please)

OPTION1: if your own a Mnemonic phases use this code and change YOUR OLD MNEMONIC PHRASE with yours and leave the quote around.
bazuka init --network pelmeni-3 --bootstrap 65.108.193.133:8765 --mnemonic "YOUR OLD MNEMONIC PHRASE"

OPTION2: if you do not have a Mnemonic phase and want the system create one for you Run the next code
bazuka init --network pelmeni-3 --bootstrap 65.108.193.133:8765

Lets Start our Node with systemd

1.- Lets reload the daemon
sudo systemctl daemon-reload
2.- Lets Restart our daemon
sudo systemctl restart zieshad
3.- Last step to see Logs
sudo journalctl -u zieshad -f

That its, if you follow all the steps you should see logs of the node right now. the installation is over and your node is running but lets post some extra command that will help us to manage the node.

important command to manage zieshad service

sudo systemctl daemon-reload
sudo systemctl status zieshad
sudo systemctl start zieshad
sudo systemctl stop zieshad
sudo systemctl restart zieshad
sudo journalctl -u zieshad -f

oh wait, do you need more details about some of those commands.. ok ok, here we go.

Lets said, you need to update/upgrade your node. first lets stop your node with: sudo systemctl stop zieshad now lets jump to bazuka directory to upgrade/update the node

cd bazuka
git pull origin master
cargo update
cargo install --path .

after compilation ends lets reload the daemon and restart/start the node
sudo systemctl daemon-reload
and now restart
sudo systemctl restart zieshad

want to see the logs Again than, run:
sudo journalctl -u zieshad -f

Thats all, Have Fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment