Production Deployment
A checklist-driven guide from "it runs on my laptop" to "it serves a network". Two reference setups: systemd on a Linux host, and Docker Compose.
The shape of a production instance
┌──────────────────────────────────────┐
clients ── TLS ──┤ :6697 ferrixd [metrics] ├── 127.0.0.1:9090 ── Prometheus
browsers ─ HTTPS ┤ :8443 ([web], optional) [admin] ├── 127.0.0.1:8080 ── SSH tunnel
│ (unprivileged user) [control] ├── /run/ferrixd/ctl.sock ── ferrixd ctl
peers ── mTLS ───┤ :6666 (link_bind, firewalled) │
└───────────────┬──────────────────────┘
│
/var/lib/ferrixd/ferrixd.db (history, channels, accounts, keys)
/var/lib/ferrixd/uploads/ (uploads, if [filehost] is local)
/etc/ferrixd/ferrixd.toml (config, certs)- One static binary, no runtime dependencies. The web client is a separate directory of static files (
ferrixd-web.tar.gzfrom the release, or already inside the container image). - State: one SQLite file (if persistence is enabled) holds history, registrations, accounts and E2EE keys. Add the uploads directory (and its
index.db) if you enable local file uploads, theoverridesJSON if you use runtime switches, and the ACME directory if ferrixd manages its own certificates. - Config + certificates under
/etc/ferrixd.
systemd
1. User, directories, binary
useradd --system --home /var/lib/ferrixd --shell /usr/sbin/nologin ferrixd
mkdir -p /etc/ferrixd /var/lib/ferrixd
chown ferrixd:ferrixd /var/lib/ferrixd
curl -fsSL https://raw.githubusercontent.com/josunlp/ferrixd/main/scripts/install.sh | sh
# → /usr/local/bin/ferrixd (running as root)2. Config
cd /etc/ferrixd
ferrixd gen-config -o ferrixd.toml
$EDITOR ferrixd.tomlProduction essentials in that file:
[server]
name = "irc.example.org"
network = "examplenet"
tls_bind = "0.0.0.0:6697"
[tls]
cert = "/etc/ferrixd/fullchain.pem"
key = "/etc/ferrixd/privkey.pem"
[persistence]
path = "/var/lib/ferrixd/ferrixd.db"
[metrics]
bind = "127.0.0.1:9090"
[control] # for `ferrixd ctl` (backup, drain, …)
socket = "/run/ferrixd/ctl.sock"Optional, as needed: [web] + [filehost] for the web client and uploads, [admin] for the dashboard, [tls.acme] instead of certbot (TLS).
Key readable by the service user, then validate:
chown root:ferrixd /etc/ferrixd/privkey.pem && chmod 640 /etc/ferrixd/privkey.pem
sudo -u ferrixd ferrixd -c /etc/ferrixd/ferrixd.toml check3. Unit file
# /etc/systemd/system/ferrixd.service
[Unit]
Description=ferrixd — Ferrous IRC Daemon
After=network-online.target
Wants=network-online.target
[Service]
User=ferrixd
Group=ferrixd
ExecStart=/usr/local/bin/ferrixd -c /etc/ferrixd/ferrixd.toml
Restart=on-failure
RestartSec=2
# Creates /run/ferrixd (owned by ferrixd) for the [control] socket.
RuntimeDirectory=ferrixd
RuntimeDirectoryMode=0750
# ferrixd needs nothing beyond its config, its state dir, and sockets:
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/ferrixd
PrivateTmp=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectControlGroups=true
# AF_UNIX: the [control] socket (and local logging); AF_INET/6: everything else.
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
MemoryDenyWriteExecute=true
CapabilityBoundingSet=
# Only if [tls.acme] binds port 80 directly:
# AmbientCapabilities=CAP_NET_BIND_SERVICE
# CapabilityBoundingSet=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.targetsystemctl daemon-reload
systemctl enable --now ferrixd
journalctl -u ferrixd -fMemoryDenyWriteExecute=true works because the WASM host is an interpreter — no JIT pages needed. The default ports are all above 1024, so no capabilities are required — unless built-in ACME binds its HTTP-01 responder to port 80 directly (uncomment the two capability lines, or forward port 80 to an unprivileged http_bind instead).
The control socket is created mode 0600 and owned by the service user, so run ferrixd ctl as that user:
sudo -u ferrixd ferrixd -c /etc/ferrixd/ferrixd.toml ctl status4. Certificate renewal
The simplest option is to let ferrixd do it: [tls.acme] obtains and renews certificates itself.
With certbot (or any other ACME client), ferrixd watches the certificate and key files ([tls] reload_interval_secs, default 60 s) and installs a renewed pair on its own — no restart, no dropped connections. A deploy hook only has to put the files in place; ferrixd ctl reload-certs makes it take effect immediately instead of within the minute:
#!/bin/sh
# /etc/letsencrypt/renewal-hooks/deploy/ferrixd
install -o root -g ferrixd -m 640 \
/etc/letsencrypt/live/irc.example.org/privkey.pem /etc/ferrixd/privkey.pem
install -o root -g ferrixd -m 644 \
/etc/letsencrypt/live/irc.example.org/fullchain.pem /etc/ferrixd/fullchain.pem
# Optional — otherwise the file watch picks it up within reload_interval_secs.
sudo -u ferrixd ferrixd -c /etc/ferrixd/ferrixd.toml ctl reload-certs
# A bad PEM fails the reload and leaves the previous certificate armed,
# so the listener never goes dark.An established outbound S2S link keeps the certificate it handshook with until it reconnects. REHASH rebuilds the TLS client configuration for every outbound link, so the reloaded certificate is presented on the next (re)connect — whether that is the automatic reconnect loop after a drop, an operator CONNECT, or a SQUIT + CONNECT forcing it immediately.
Docker Compose
Release images are published to the GitHub Container Registry for linux/amd64 and linux/arm64, with the web client already inside:
docker pull ghcr.io/josunlp/ferrixd:latest # or a version: :1.4.1, :1.4, :1To use it with the repository's compose file, replace build: . with image: ghcr.io/josunlp/ferrixd:1.4.1. To build locally instead, the repository's docker-compose.yml is production-usable as-is:
git clone https://github.com/josunlp/ferrixd && cd ferrixd
docker build -t ferrixd .
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD":/etc/ferrixd ferrixd gen-config
$EDITOR ferrixd.toml # set [persistence] path = "/var/lib/ferrixd/ferrixd.db"
docker compose up -d
docker compose logs -fWhat the compose file gives you: the 6697 port mapping, the config bind-mount (read-only), a named volume on /var/lib/ferrixd, a healthcheck, and graceful shutdown on docker stop (SIGTERM = Ctrl-C). Add your real certificates as extra read-only mounts and reference them from the config. For the web client, add a "8443:8443" port mapping and a [web] section (bind = "0.0.0.0:8443", client = true; the image's /usr/share/ferrixd/web is the default root). For ferrixd ctl inside a container, use a [control] socket on the data volume (/var/lib/ferrixd/ctl.sock) and run docker compose exec ferrixd ferrixd ctl status.
Utility commands run through the same image:
docker compose exec ferrixd ferrixd check
docker run --rm -it ferrixd hash-passwordFirewalling
| Port | Who needs it |
|---|---|
6697/tcp | the world (or your users) |
8443/tcp ([web]) | the world, if you serve the web client or uploads |
80/tcp ([tls.acme]) | the CA's validation servers, if you use built-in ACME |
6667/tcp | nobody — keep plaintext off or loopback-only |
6666/tcp (link_bind) | linked peers only — allowlist their addresses |
9090/tcp (metrics) | Prometheus only — bind loopback/private, never public |
8080/tcp ([admin]) | nobody — loopback only; reach it over SSH |
Backup
Everything durable is the SQLite file. With WAL mode (ferrixd's default), a consistent online backup is:
ferrixd ctl backup /backup/ferrixd-$(date +%F).db(It uses SQLite's online backup API on a background thread while the server keeps running; without a [control] endpoint, sqlite3 … ".backup …" does the same from outside.)
The config directory (/etc/ferrixd) completes the picture, plus:
- the
[admin] overridesfile (e.g./var/lib/ferrixd/overrides.json) if you use runtime switches — without it, a restored server falls back to the config file's values; - the uploads directory if you host files locally. Its
index.dbis a live SQLite database in WAL mode, so don't copy it with a plain file copy while the server runs: either stop the server and copy the whole directory, or take an online backup of the index (sqlite3 /var/lib/ferrixd/uploads/index.db ".backup /backup/uploads-index.db") and then copy the upload files.
Restore = stop, put everything back, start.
Upgrades
curl -fsSL https://raw.githubusercontent.com/josunlp/ferrixd/main/scripts/install.sh | sh -s -- update
systemctl restart ferrixdThe installer replaces the binary atomically (safe while running), the restart picks it up.
For a rolling restart of one server in a network, drain it first:
ferrixd ctl drainDraining refuses new connections (they get an ERROR asking them to try another server), tells every connected client the server is restarting, waits up to [control] shutdown_grace_secs for them to leave, disconnects the rest and shuts down gracefully — your service manager then starts the new binary. For Docker: rebuild/pull the image, docker compose up -d. Watch ferrixd_clients recover and skim the log for anything new.
Pre-flight checklist
- [ ]
ferrixd checkpasses as the service user - [ ] TLS: real certs, renewal hook refreshes the PEMs and triggers
REHASH - [ ]
[persistence]on, database on durable storage, backup cronjob (ferrixd ctl backup) - [ ]
[control]socket configured, so you can back up and drain - [ ]
[metrics]on loopback, Prometheus scraping, an alert or two - [ ]
[[operators]]usepassword_hash, one block per human - [ ] plaintext listener absent (or loopback with a reason)
- [ ]
link_bindfirewalled to peers (if federating) - [ ] rate limits reviewed for your audience (Limits & Defaults)
- [ ]
[admin](if used) on loopback or withtls = true - [ ]
[web]/[filehost](if used):public_urlcorrect, upload quota and retention chosen, storage on durable disk