dentatsu

Self-hosting

Run dentatsu for your family and friends on one Linux machine: what you need, how the parts fit, and the steps in order.

This guide walks through a whole setup in order. Each step links to the operator reference, which has every command and setting. Plan for an afternoon the first time.

What you need

  • One Linux machine with systemd that stays on: a small home server, a mini PC or a cloud server. x86-64, with glibc 2.39 or newer. 1 GB of memory is plenty for a family.
  • A domain on Cloudflare, such as example.org. Cloudflare's API makes the certificates and the DNS records.
  • A router you can open ports on, if the machine is at home: TCP 443 and two UDP ports. A line behind carrier-grade NAT can't take incoming connections: check first (Before you start).
  • A second disk for the nightly backups.

How the parts fit

One web server, Caddy, answers on port 443 for three names and passes each one on:

AddressWhat it servesFrom
example.orgThis site: the landing page, the guides and the sign-up pagethe files the release installs
chat.example.orgThe dentatsu hub: the web app, the apps' connections, other hubsdentatsu-hub.service
pds.example.orgThe account server (PDS) for your family's accountsthe official PDS container

Beside Caddy, the hub uses two UDP ports of its own: one for iroh (fast, direct connections for the apps) and one for calls. Handles look like ada.example.org.

The steps

1. Prepare the network and the accounts

Check the line for carrier-grade NAT, give the machine a fixed address on your network, and forward TCP 443, UDP 7180 and UDP 7181 to it. Make a Cloudflare API token that can edit DNS in your one zone, and an age key pair for the backups. The reference lists each one, marked user-only: Before you start.

2. Get Caddy with the Cloudflare module

Plain Caddy can't make certificates through Cloudflare. Add the module to your distribution's Caddy, or build Caddy with it: Caddy with the Cloudflare module.

3. Point the names at the machine

Make A records for example.org, www.example.org, chat.example.org and pds.example.org, as "DNS only" (not proxied: calls and iroh must reach the machine directly). With an address that changes, the DDNS timer keeps them current: DNS records.

4. Install the release

A release is one tarball with the program, the web app, this site and the recipes. Check its checksum, unpack it, and run its install.sh. It makes a system user, installs the files and the services, and starts nothing until you ask: The release bundle and Install the hub.

sha256sum -c dentatsu-…-x86_64-linux.tar.gz.sha256
tar xzf dentatsu-…-x86_64-linux.tar.gz
dentatsu-…-x86_64-linux/deploy/hub/install.sh --caddy --dry-run   # what it would do
dentatsu-…-x86_64-linux/deploy/hub/install.sh --caddy             # do it

5. Say who may sign in

Edit /etc/dentatsu/hub.conf. Replace each placeholder in capitals. Most important: who may sign in (every account on your PDS, and friends elsewhere by their DID), who the admins are, and that only admins make spaces. A hub that others can reach won't start until you choose: Who may sign in.

6. Set up Caddy

install.sh --caddy puts an example Caddyfile in place. Replace DOMAIN and ADMIN_EMAIL, put the Cloudflare token in /etc/caddy/cloudflare.env, and reload Caddy. The example serves this site at example.org (and redirects www.example.org to it), the hub at chat.example.org and the PDS at pds.example.org. If you want the site somewhere else, it is one block to change: the Caddyfile's comments say how.

7. Start the PDS and make accounts

The PDS runs as a container beside the hub. Make its settings file with fresh secrets, start it, and make an account for each person with new-account.sh, which also sets their handle: The PDS.

8. Start everything

dentatsu-…-x86_64-linux/deploy/hub/install.sh --start
journalctl -u dentatsu-hub -f

Then open https://example.org/ and https://chat.example.org/ from outside your network and from inside it, sign in with a family account, and make the first space.

9. Backups and monitoring

The nightly backup is encrypted to your age key and kept on the other disk. Practice a restore once a month with the restore drill: Backups and The restore drill. A health check runs every five minutes and can notify you through ntfy: Monitoring.

Running it day to day

  • Invite people: in the web app, invite someone in a space; or dentatsu invite create SPACE (Invites).
  • Let someone in, or keep them out: dentatsu hub admin accounts allow DID or deny DID (Admin commands).
  • Someone lost a phone: they remove it themselves (Your devices), or see A lost device.
  • A new release: run install.sh --bundle NEW.tar.gz --start. It changes only what changed and keeps your settings.
  • Is it healthy? dentatsu hub admin health, or https://chat.example.org/healthz (Health).

What your users trust you with

As the operator, you see who is in which space and when they talk, but not what they write, unless the hub is a member of a room. Tell your users what Privacy and safety says, and keep the machine's disk encrypted.