← Self-hosting Guide

ruzed on a Raspberry Pi

A Pi on a shelf at home can do what a VPS does for Ruze: hold your servers, so messages reach people who were offline, run a relay for devices that can’t reach each other directly, or both. It takes about half an hour, and after that it looks after itself.

What you need

  • A Raspberry Pi that runs 64-bit Raspberry Pi OS: a Pi 4 or 5 is the comfortable choice; a Pi 3 or Zero 2 W works too. ruzed is built for 64-bit ARM, so the 32-bit edition of the OS will not run it.
  • Storage that does not mind being written all day. A good microSD card works; an SSD on USB lasts longer.
  • A wired connection to your router, if you can. Wi-Fi works, and drops more.
  • A router you can forward ports on, and an internet connection that gives you a public address. Some providers share one address between many homes (carrier-grade NAT), and then nothing outside can reach the Pi: a small VPS is the way round that.

1 Install the OS

With Raspberry Pi Imager, write Raspberry Pi OS Lite (64-bit) to the card. In the Imager’s settings, set a hostname, a user and password, and turn on SSH. Start the Pi, then from another computer:

ssh you@raspberrypi.local
uname -m        # should say aarch64
sudo apt update && sudo apt full-upgrade -y

2 Give it a name, and open the door

Members reach ruzed by name, and a home address changes now and then, so the name has to follow it: a free dynamic DNS name does that (DuckDNS, or your router’s own dynamic DNS if it has one). It’s highly recommended, not required.

Without a name, ruzed uses your public IP address. Hosting works the same, though if the address changes, members find the Pi more slowly. The relay can’t get a certificate for an address, so it makes its own: members of servers you host can still use it, and nobody else can.

In your router, give the Pi a fixed local address (often called a DHCP reservation), then forward these ports to it:

ForForward
Hosting serversUDP 11204
The relayTCP 443, TCP 80, UDP 7842

3 Install ruzed

curl -LO https://download.ruzechat.app/v0.0.72/ruze-server-0.0.72-linux-aarch64.tar.gz
tar xzf ruze-server-0.0.72-linux-aarch64.tar.gz
cd ruze-server-0.0.72-linux-aarch64
sudo install -m 755 ruzed /usr/local/bin/ruzed

4 Choose what it does

One command writes the config, for the name from step 2:

sudo ruzed init yourname.duckdns.org            # hosting and a relay
sudo ruzed init yourname.duckdns.org --servers  # hosting only
sudo ruzed init yourname.duckdns.org --relay    # a relay only
sudo ruzed init                                 # no name: your public IP

It lands in /etc/ruzed/ruzed.toml, with whatever you left out written in, commented, to switch on later. For the relay you can add contact = "you@example.com" under [relay], an address Let’s Encrypt may write to about the certificate.

5 Start it

sudo cp ruzed.service /etc/systemd/system/
sudo systemctl enable --now ruzed
systemctl status ruzed

It starts with the Pi from now on. With the relay on, journalctl -u ruzed shows the relay is up; the certificate takes a few seconds the first time.

6 Bind a server

For each server you want held here, mint a host code and give it to the server’s owner:

sudo systemd-run --pty -p DynamicUser=yes -p StateDirectory=ruzed \
  ruzed --config /etc/ruzed/ruzed.toml host-code

The owner pastes it into Server settings → Hosting in Ruze. Members need do nothing: their apps find the server on the Pi, and use its relay beside the public ones.

Keeping it going

  • Back up /var/lib/private/ruzed. The ruzed.key in it is the machine every binding names; without it, every server bound here has to be bound again.
  • To update, download the new version as in step 3, install it over the old one, and sudo systemctl restart ruzed.
  • To see what it is doing, journalctl -u ruzed -f.

If something is wrong

Nobody can reach it from outside
Try from a phone on mobile data, not your own Wi-Fi. Check the forwards point at the Pi’s fixed address, and that the dynamic DNS name resolves to your current public address. If your router’s public address is not the one the internet sees, your provider is sharing it, and a VPS is the answer.
The log says the relay did not start
Something else may be using port 80 or 443 on the Pi, or public_host is an address rather than a name. Hosting carries on regardless.