Documentation
Running it in production
There are two profiles. Profile A is one process, SQLite, local media and a TLS reverse proxy. Profile B is several processes, PostgreSQL and S3. This page covers the parts I would check before putting other people's accounts on it: permissions, backups, networking and what happens when something fails.
Profile A: one process
One littleFedi process, SQLite in WAL mode, local owned media, one TLS reverse proxy, encrypted off-host backups. This is the profile almost everyone wants.
Start with at most 100 local accounts, 50 concurrent streams, 10 inbound activities per second sustained, 40 MiB uploads, and a queue that returns to its normal depth within an hour. These are conservative limits and have not been benchmarked. Record a 24-hour staging soak before you raise them.
The default objective is a 24-hour recovery point and a four-hour recovery time. Backups run daily. Do not consider a release fit for your users until you have personally restored one inside four hours.
Host requirements
Start with a dedicated service account and a private data directory. The
executable is static; the SQLite fallback also needs sqlite3
for backups, as explained below.
- An unprivileged service account that owns nothing but its own data.
- A private data directory, mode
0700, owned by that account, holding the database,media/andbackups/. - A root-owned binary, mode
0755, that the service account cannot replace. - A configuration file, mode
0640, readable by the service group and writable only by root. - A secrets file beside it, mode
0640, holding the MFA encryption key, the optional signing-key encryption key, the media proxy secret and the SMTP password asKEY=valuelines. Quote values containing shell metacharacters: the service scripts source this file. Keep secrets out of command arguments. - A descriptor limit of at least 65536, applied by whatever mechanism the platform provides.
- A service definition that starts the process as that account, stops it with
SIGTERM, allows at least 45 seconds for shutdown, and restarts it after a failure where the service manager supports that. - A reverse proxy terminating TLS in front of the loopback listener.
Platforms differ in how much they add on top. The systemd unit confines the
filesystem, the temporary directory and kernel interfaces; SMF drops privileges
and pairs with zones; the BSDs rely on the account, the directory modes and, on
FreeBSD, jails. The deployment does not depend on those extras, only on the list above. Service files and firewall examples are in
packaging/ in the download. Adjust their paths and limits for
your machine before installing them.
Identity bootstrap
- Keep
registrations = false,require_admin_mfa = falseandrequire_email = truefor the bootstrap. - Create the administrator with an explicitly verified email using the local CLI. Sign in, enroll TOTP, and store the recovery codes offline.
- Set
require_admin_mfa = true, restart, and confirm that web, admin, API, OAuth and streaming access all still work. - On an upgraded instance, run
admin email-verification-reportbefore turning verified email on. - Keep registration closed for launch. If you enable invitations later, keep approval and verified email required.
Protecting signing keys
The database holds the private keys your accounts use to sign federation requests. Without encryption, a stolen database or backup gives someone those keys too. littleFedi can seal them with AES-256-GCM using a separate key held in the service environment.
Generate a key with openssl rand -base64 32 and save the output
as LITTLEFEDI_FEDERATION_KEY_ENCRYPTION_KEY in the private service
environment file. Keep a separate, secure copy. Stop the service and take a
backup before converting the keys. Leave room on disk for database compaction,
then run these commands as the service account with that environment loaded:
./littlefedi --config littlefedi.toml admin keys status
./littlefedi --config littlefedi.toml admin keys encrypt
./littlefedi --config littlefedi.toml admin keys status
Restart with the same key in the service environment. New keys are sealed
when written; admin keys encrypt converts existing ones. Take a
fresh backup and try a restore with the separate encryption key available.
Losing the encryption key means losing the ability to sign as those accounts. The database backup cannot replace it. Older backups, snapshots and database logs may still contain plaintext keys; encrypting the live database does not rewrite them.
To change the encryption key, stop the service, run
admin keys decrypt with the old key, load the new one, run
admin keys encrypt, then restart. Keep traffic stopped throughout
and replace the old backups only after checking the new ones.
DNS, TLS and network
- Point A and AAAA at the proxy and test both families. If IPv6 is not routed and firewalled correctly, do not publish AAAA at all.
- Permit inbound TCP 80 and 443 only. Keep 8080, metrics, pprof, the database and SSH administration off the public network. Allow outbound 443, the SMTP submission port, DNS and NTP.
- The
packaging/directory has firewall examples for pf, npf, ipfilter and nftables. Adapt them before loading them. - Use an automated ACME client, alert at 21 days to expiry, and test renewal with the client's own dry run.
proxy_uriis the exact public HTTPS origin.trusted_proxiesis loopback only in this topology.
The installation guide has complete Caddy and nginx examples, including the WebFinger redirect for split domains.
Start and smoke test
curl --fail http://127.0.0.1:8080/health
curl --fail http://127.0.0.1:8080/readyz
curl --fail https://social.example.com/.well-known/nodeinfo
Then confirm, by hand:
- HSTS and CSP headers are present.
- Login and MFA work.
- A post with media publishes and renders.
- WebSocket and SSE reconnect after an interruption.
- The administrator SMTP test arrives.
- A remote follow works in both directions.
- The queue drains.
Then reboot the machine once and repeat all of it. If everything comes back up on its own, the service setup is right.
The process writes structured lines to stdout, and the service manager decides where they land: the journal, syslog, or an SMF service log. Configure that transport's retention and forward alerts without forwarding private request content.
Upgrade and rollback
Drain proxy traffic, stop littleFedi, take an off-host encrypted backup and copy
it away, install the new root-owned binary, start one process so migrations run
exactly once, then restore traffic and watch /readyz and the queue
age.
On SQLite, migration 007 drops and recreates four reply and quote indexes. Allow time for the first startup on a large database, especially on an SD card. Check the logs before deciding a slow startup has failed. Later starts skip migrations already applied.
For any migration that changes schema or data, rollback means stopping the new binary and restoring the pre-upgrade backup. Never start an older binary against a database whose newer migrations have already executed. There is no supported path back from that.
Profile B: PostgreSQL and S3
Use the PostgreSQL/S3 binary when several processes need to share an instance. About 500 local accounts and 100 streams is a starting load to try in staging, rather than a capacity guarantee. The database, storage provider and follower graph all matter.
background_maintenance = false
[db]
dsn = "postgres://littlefedi:secret@db/littlefedi?sslmode=require"
[streaming]
backend = "postgres"
[media]
backend = "s3"
cache_remote = "off"
[media.s3]
bucket = "littlefedi-media"
private_bucket = "littlefedi-archives"
region = "eu-west-1"
[backup]
enabled = false
include_media = false
[blog]
enabled = false
Every process shares the same PostgreSQL DSN, the same streaming backend and the
same buckets. Exactly one process runs with
background_maintenance = true. If that process stops, request
handling, queues, actor refresh and streaming continue; housekeeping pauses until
it comes back. The role is set by hand, so the cluster needs no leader election to decide who runs the sweeps.
The media bucket serves public files. Account exports and imports use
private_bucket, which must be a different bucket with public
access disabled at the provider. Without it, archive operations fail. Back up
both buckets and give the application credentials only the access they need.
- The application rate limiter is per process, so the reverse proxy must apply a shared limit.
- Do not use the built-in media backup with S3. Use PostgreSQL-native or managed backups plus bucket versioning and provider replication, and restore the database and both buckets into an isolated environment before you rely on them.
- Static blogs are not part of Profile B. Their generated files and rebuild coalescing are process-local. Leave them off.
- Start one process first during an upgrade, wait for migrations and readiness, then roll the rest.
Before moving users onto this setup, run two processes against the actual storage provider for a day. Upload and delete media, check streaming between processes, restart workers with jobs queued, and restore a backup. With a test account, export and import an archive and confirm its object cannot be fetched anonymously from the private bucket. Those checks exercise the installation you will run.
Platform conventions
The service files in the download follow the conventions below. Check their paths against your installation, and make the configuration, environment and data directories before starting the service.
| Alpine | FreeBSD | illumos | Linux | NetBSD | OpenBSD | |
|---|---|---|---|---|---|---|
| Packages | apk | pkg | IPS / pkgin | distribution | pkgin | pkg_add |
| Service manager | OpenRC | rc.d | SMF | systemd | rc.d | rc.d, rcctl |
| Service account | littlefedi | littlefedi | littlefedi | littlefedi | littlefedi | _littlefedi |
| Configuration | /etc/littlefedi | /usr/local/etc/littlefedi | /etc/littlefedi | /etc/littlefedi | /usr/local/etc/littlefedi | /etc/littlefedi |
| Data | /var/lib/littlefedi | /var/db/littlefedi | /var/littlefedi | /var/lib/littlefedi | /var/db/littlefedi | /var/littlefedi |
| Firewall | nftables | pf | ipfilter | nftables, ufw | npf | pf |
| ACME | certbot, Caddy | acme.sh, certbot, Caddy | acme.sh, certbot, Caddy | certbot, Caddy | acme-client, certbot, Caddy | acme-client(1) |
| Logs | supervise-daemon | syslog, newsyslog | SMF log, logadm | journald | syslog, newsyslog | syslog, newsyslog |
| Descriptor limit | rc_ulimit | login class | project | LimitNOFILE | login class | login class |
| Restart on failure | yes | daemon(8) -R | SMF | systemd | no | no |
Ports to other systems are welcome. macOS and Windows binaries are built and published, but the download has no service files for them: they are development and evaluation targets, not deployment targets.
After installing a service file, test startup, shutdown and a reboot. Check the user it runs as and where the logs go. A process started successfully from your own shell can still fail under a service manager with a different PATH or environment.
Which SQLite driver you get
The default build embeds SQLite. Two drivers cover the supported platforms, and which one you get is decided at build time by the target, not by configuration. It matters, because one of them is much more limited.
| Driver | Platforms | Behaviour |
|---|---|---|
modernc.org/sqlite |
FreeBSD 386/amd64/arm/arm64; Linux 386/amd64/arm/arm64/loong64/ppc64le/riscv64/s390x; NetBSD amd64; OpenBSD amd64/arm64; macOS; Windows | Native translation of SQLite. No WASM arena or fallback pool cap. |
ncruces/go-sqlite3 |
illumos, NetBSD arm/arm64, and other targets without the native driver | SQLite in a WASM interpreter. Pool capped at two connections, or one on illumos and Solaris. Each connection has a 32 MiB arena limit. |
On fallback builds the Go soft memory limit is calculated from the SQLite
arena, cache budget and available host memory. Setting GOMEMLIMIT
overrides that automatic choice. The low_power preset still
selects one connection. PostgreSQL does not use this SQLite fallback.
Backups on fallback builds call an external sqlite3 executable.
Install it and make sure the service can find it, or set
LITTLEFEDI_SQLITE3 to its full path. Version 3.27 or newer uses
VACUUM INTO. Older versions use .backup, which can
keep restarting while the instance is busy. The native driver uses its own
online backup API and needs no external command.
Platforms and download variants
The full download set covers 40 targets across 12 operating systems with the current Go toolchain. Each comes in SQLite/local-media, SQLite/S3, PostgreSQL/local-media and PostgreSQL/S3 variants, all with blog support. The 32-bit ARM targets have separate ARMv6 and ARMv7 executables.
| Operating system | Architectures | Service files supplied |
|---|---|---|
| FreeBSD | 386, amd64, arm, arm64 | rc.d |
| Linux | 386, amd64, arm, arm64, loong64, mips, mipsle, mips64, mips64le, ppc64, ppc64le, riscv64, s390x | systemd; OpenRC for Alpine |
| NetBSD | 386, amd64, arm, arm64 | rc.d |
| OpenBSD | 386, amd64, arm, arm64, ppc64, riscv64 | rc.d |
| illumos | amd64 | SMF |
| macOS | amd64, arm64 | none; development and evaluation |
| Windows | 386, amd64, arm64 | none; development and evaluation |
| Solaris | amd64 | none |
| DragonFly BSD | amd64 | none |
| AIX | ppc64 | none |
| Plan 9 | 386, amd64, arm | none |
| Android | arm64 | none |
The ordinary binary, such as littlefedi-linux-amd64, uses
SQLite and local media. The other prefixes are littlefedi-s3,
littlefedi-postgres and littlefedi-postgres-s3.
Check SHA256SUMS in the binaries directory before installing.
From the source archive, make release builds a smaller common
set; make allreleases builds the full set for the installed Go
toolchain. For example, make allreleases TAGS="postgres s3" BINARY_PREFIX=littlefedi-postgres-s3
selects PostgreSQL and S3. Both release targets include blogs.
A binary being available only means it compiles. Test installation, federation, backup and reboot before trusting an unusual target with your data. Reports, including failures, are welcome at the issue tracker.
Monitoring and alerts
Keep /metrics on the monitoring network. The application alone
cannot observe every production dependency, so Profile A combines littleFedi
metrics with reverse-proxy, service-manager, filesystem, TLS and backup-tool
data.
| Signal | Initial condition | Source |
|---|---|---|
| Readiness | /readyz fails twice over 2 minutes | black-box probe |
| HTTP failures | 5xx ratio above 2% for 5 minutes | reverse-proxy metrics |
| Slow requests | p95 above 2 seconds for 10 minutes | littlefedi_request_duration_seconds |
| Queue backlog | depth grows for 15 minutes, or oldest claimed job older than 15 minutes | littlefedi_queue_depth, littlefedi_queue_age_seconds |
| Failed jobs | littlefedi_queue_failed_total increases | littleFedi metrics |
| Federation | failed deliveries above 10% of attempts for 15 minutes | delivery counters |
| Workers | configured is zero, or active is saturated with growing depth | worker-pool gauges |
| Database | connection waits rise, or in-use reaches maximum | database gauges |
| Disk | free space below 20% warning, below 10% critical | system metrics |
| Backup | newest verified off-host backup older than the RPO | backup tool |
| TLS | certificate expires within 21 days | black-box or ACME monitor |
| Media | repeated upload or object errors | structured logs, store probe |
| Mesh directory | /healthz fails twice, or publication failures continue for half the record TTL | probe and logs |
Label alerts with the instance and a runbook URL. Do not put email addresses, tokens, private statuses, job payloads, signatures or signed object URLs into an alert.
Before you go live, break things deliberately: stop the service, pause the workers, exhaust a staging filesystem threshold, age a backup marker, use an expiring test certificate. Confirm each alert reaches a real person.
Backup, restore, drill
The built-in backup includes a consistent database copy, a configuration copy, a manifest, and optionally owned media. The remote media cache is disposable and is not included.
littlefedi --config <config> backup now --media
littlefedi --config <config> backup restore /path/to/backup
Run both as the service account, never as root, and stop the service before a
restore. Copy the finished backup off-host with an encrypted tool such as
restic or borg, driven from a private credential file. The archive includes
docs/backup-restore.md for the backup format and commands.
Environment-only secrets are not in the configuration copy. Keep the MFA
key and any signing-key encryption key separately and include them in the
restore drill. On SQLite fallback platforms, check that the service can run
sqlite3; see the driver notes.
The restore drill:
- Provision a clean isolated host with no route to production peers or SMTP.
- Fetch and decrypt one off-host backup. Verify its checksum and manifest.
- Install the exact release binary and the private production configuration.
- Restore while littleFedi is stopped.
- Start once so migrations apply. Check
/healthand/readyz. - Sign in with a test account and MFA. Fetch timelines, profile images, status media, OAuth application records and queued jobs.
- With controlled network access, federate one test activity to a designated staging peer and confirm a signed response. Then cut the network again.
- Record the elapsed time and the newest restored object timestamp.
The drill fails if you miss the recovery time or recovery point objective, or if actor keys, media, OAuth applications or durable queued work are missing. Repeat it for every release candidate and quarterly after launch.
Runbooks
In every incident: declare an owner, record UTC timestamps, preserve redacted logs, protect user privacy, and announce impact through your status channel. Closing registration first costs nothing and does not take existing accounts offline.
- Failed migration
- Stop every process. Preserve the failed database and the logs. Do not edit schema rows by hand. If the failure is understood and the migration is transactional, retry once with the same binary; otherwise restore the pre-upgrade backup and the previous binary.
- Full disk
- Close registration and uploads at the edge, stop littleFedi before SQLite runs out of space, and find the growth without deleting database or WAL files. Remove only disposable remote media cache, or expired verified backups.
- Stuck or failed queue
- Check readiness, depth and oldest age by kind, peer failure rate, DNS and disk. Do not delete payloads just to clear the backlog. Fix the dependency and let durable retry recover. Delete a terminal job only after recording why abandoning its effect is safe.
- Compromised token, signing key or MFA key
- Close registration, drain writes, revoke the affected sessions and tokens. A compromised actor private key needs incident-specific federation coordination; do not silently replace database values. Rotate service, SMTP, object store, media proxy and backup credentials.
- Abusive instance or spam burst
- Close registration, apply a domain suspension, preserve reports, notify the moderation contact. Tighten edge rules temporarily. Do not silently auto-ban individual users from an unreviewed heuristic.
- SMTP outage
- Keep registration closed if verified email is mandatory. Existing verified users carry on. Check that the port matches the TLS mode, 587 for STARTTLS and 465 for implicit TLS, and do not bypass certificate verification on a public path to make the symptom go away.
- Media or object store outage
- Disable uploads at the edge, leave existing posts readable, and avoid deleting media rows. Restore the store, check a known object, then let queued export, import and cache jobs resume.
- Database outage
- Remove the instance from traffic. For SQLite check disk, permissions, WAL companions and filesystem health, and never copy a live main file without its proper backup mechanism. For PostgreSQL check pool saturation, server health, credentials and TLS before failing over.
- Emergency read-only
- There is none. Set
auth.registrations = false, restart in a controlled way, and use the edge to reject write paths. Keep health and status pages available. Record every temporary edge rule and remove it deliberately afterwards.
Checking compatibility
littleFedi speaks ActivityPub and the Mastodon client API. That covers the usual follows, posts, edits, deletions, polls, media and notifications, but clients use different corners of the API. Try the apps your users need before inviting them onto the server.
| Area | What to check |
|---|---|
| Federation | Follow in both directions, exchange posts and replies, edit one, then delete it. Check both servers. |
| Client login | Authorize the app, load a timeline, page back and fill a gap after reconnecting. |
| Media and polls | Upload an image with alt text, edit the description, create a poll and vote from the other side. |
| Notifications | Check mentions, favourites, boosts, streaming and a push while the app is closed. |
| littleMesh | For access from ordinary servers, repeat discovery and federation through the public gateway. |
Keep the software versions, date and results with your deployment notes. Report a failure at issues.littlefedi.org with the client or peer version and redacted logs. The known limits include deliberate differences from Mastodon; a compatible API does not mean identical behaviour.
Policy and retention
This is an operator checklist, not legal advice, and it needs jurisdiction-specific review before you accept users who are not yourself. Publish: who operates the server and under which jurisdiction; moderation, privacy, security and legal contact addresses; the rules; terms of service; and a privacy policy that explains how federation works.
That last one matters more here than on an ordinary web service. Profiles and posts are copied to independent servers you do not control, remote content is cached and proxied, deletions propagate as tombstones, and backups age out on their own schedule. The privacy policy should say this.
| Data | Starting retention |
|---|---|
| Access logs | 14 days |
| Failed or terminal jobs | 24 hours after the terminal state |
| Moderation and audit records | 2 years |
| Encrypted off-host backups | 7 daily and 4 monthly copies |
| User export archives | 24 hours, one successful download |
| Uploaded import archives | deleted after a successful import |
| Deleted-account tombstones | indefinite, minimal URI, type and date only |
| Deleted-status tombstones | 90 days |
| Remote statuses and media cache | 30 days unless still referenced |