Systemd

Running Valvet as a systemd service

For bare-metal installations, run the hub and node agent as systemd services.

Hub Service

Create /etc/systemd/system/valvet-hub.service:

[Unit]
Description=Valvet Hub
After=network.target

[Service]
Type=simple
User=valvet
Group=valvet
ExecStart=/usr/local/bin/valvet-hub
WorkingDirectory=/var/lib/valvet
Environment=DATA_DIR=/var/lib/valvet
Environment=LOG_LEVEL=info
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable --now valvet-hub

Node Agent Service

The install script creates this automatically. For manual setup, create /etc/systemd/system/valvet-node.service:

[Unit]
Description=Valvet Node Agent
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/valvet-node run
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable --now valvet-node

Logs

View logs with journalctl:

# Hub logs
journalctl -u valvet-hub -f

# Node logs
journalctl -u valvet-node -f

Troubleshooting

Service fails to start: Check journalctl -u valvet-hub --no-pager -n 50 for error messages.

Permission denied: Ensure the service user has read/write access to the data directory.

Port in use: Check if another process is using port 4865: ss -tlnp | grep 4865.