Docs
Tangle Network
Node Operators
Running with Systemd
Collator Node

Running with Systemd

You can run your collator node as a Systemd process so that it will automatically restart on server reboots or crashes (and helps to avoid getting slashed!).

Before following this guide you should have already set up your machines environment, installed the dependencies, and compiled the Tangle binary. If you have not done so, please refer to the Requirements page.

System service setup

Run the following commands to create the service configuration file:

# Move the tangle-collator binary to the bin directory (assumes you are in repo root directory)
sudo mv ./target/release/tangle-parachain /usr/bin/

# navigate to /etc
cd /etc/systemd/system

# create the service configuration file
sudo touch collator.service

Add the following contents to the service configuration file. Make sure to replace the USERNAME with the username you created in the previous step, add your own node name, and update any paths or ports to your own preference.

Note: The below configuration assumes you are targeting the Tangle Network chainspec.

Collator Node

[Unit]
Description=Tangle Collator Node
After=network-online.target
StartLimitIntervalSec=0

[Service]
User=<USERNAME>
Restart=always
RestartSec=3
ExecStart=/usr/bin/tangle-parachain \
  --base-path /data/collator/<USERNAME> \
  --name <NODE-NAME> \
  --chain tangle \
  --node-key-file "/home/<USERNAME>/node-key" \
  --port 30333 \
  --validator \
  --no-mdns

[Install]
WantedBy=multi-user.target

Enable the services

Double check that the config has been written to /etc/systemd/system/collator.service correctly. If so, enable the service so it runs on startup, and then try to start it now:

sudo systemctl enable collator

sudo systemctl start collator

Check the status of the service:

systemctl status collator

You should see the node connecting to the network and syncing the latest blocks. If you need to tail the latest output, you can use:

journalctl -u collator.service -f

Congratulations! You have officially setup an Tangle Network node using Systemd. If you are interested in learning how to setup monitoring for your node, please refer to the monitoring page.

Last updated on February 1, 2023