/ self-hosting / install ← self-hosting

Install a server

One Linux box, Docker, a DNS name, and two ports. This page is the first thirty minutes: what to install, the command that starts it, and the checks that tell you it is actually serving.

Before you start: the repository goes public with the first stable release, so git clone does not work yet. Everything below is what the shipped deploy/ directory does once it does; the flags and file names are current today.

1. What you need

If the box is fresh, deploy/vps-setup.sh installs Docker, opens 80/443 in the machine's own firewall and turns on unattended security upgrades:

ssh ubuntu@VM_IP 'sudo sh -s' < deploy/vps-setup.sh

2. Start it

git clone https://github.com/foreski/Yap
cd Yap/deploy
YAP_DOMAIN=chat.example.com docker compose up -d

The first build compiles the server, which takes a few minutes on a small ARM box. Every start after that is seconds.

3. What that started

PieceDetails
yapThe Rust server. Not published to the host at all: only Caddy can reach it, on the compose network at port 8080. Runs as an unprivileged user with a read-only root filesystem, all capabilities dropped and no-new-privileges.
caddyPublishes 80 and 443, fetches the certificate for YAP_DOMAIN, sets HSTS, strips the Server header, and discards request logs so IPs and paths are never written down.
yap-dataThe volume holding everything: /data/yap.db, its WAL files and the sign-up key beside it. Backing this up is backing up the server.

The container's entrypoint is yap-server serve --trust-proxy, with YAP_DB=sqlite:///data/yap.db and YAP_BIND=0.0.0.0:8080. --trust-proxy is correct here because Caddy is the only thing that can reach it: without it every request would look like it came from the proxy, and the per-address sign-up cap would be meaningless.

4. Check it

curl -sS https://chat.example.com/api/v1/health            # expect: ok
curl -sS -o /dev/null -w '%{http_code}\n' https://chat.example.com/gateway   # expect: 426

Then open the site in a client, create the first account, and make a space. A fresh server has two accounts per address by default, which is why the second one usually comes from an invite.

5. The flags you might change

FlagDefaultWhy you would touch it
--max-accounts-per-ip N20 lifts the cap. Worth raising only if your group really does share one address.
--voice-directoffVoice without a relay. Participants then see each other's IP addresses: LAN and testing only.
--turn-url URLnoneA TURN relay for voice, repeatable; the secret comes from YAP_TURN_SECRET. With a relay configured, clients are told to use relay candidates only.
--bind ADDR127.0.0.1:8080Where the server listens. In Docker this is set by the image, not by you.
--db URLsqlite://yap.dbAnother SQLite path. The image points it at the volume.

6. If it does not answer

Next: TLS and reverse proxies, then backups — the one chore that is easy to postpone and impossible to undo.

Updated . Part of hosting and self-hosting.