Architecture
A self-hosted instance is one supervisor, fluxerd, and its processes. The container image, the systemd service and the Helm chart run the same release.
What runs
Заголовок раздела «What runs»These are the parts in the current release. fluxerd ps lists them on your instance, and fluxerd logs <part> shows one part’s output.
fluxerdstarts, watches and restarts every other part, and runs the edge (Caddy) and the message queue (NATS) inside itself.postgresis PostgreSQL with all of Squad’s data, version 17 in the container image, and on the systemd route the newest PostgreSQL 14 or later on the machine at install. SetFLUXER_POSTGRES_URLto use your own PostgreSQL 14 or later instead.apiis the HTTP API and the worker.gatewaykeeps the WebSocket connections that apps hold open for live updates.media-proxyresizes and serves images, video and other media.rustis eight services in one process, such as users, messages, link previews, push, the admin panel and the web app files. An older instance runs each service as its own part, such asusersorunfurl, untilrexctl migrate --migrate=rustmoves all eight services into the onerustprocess.FLUXER_UNFURL_ENABLED=falseturns link previews off, and the link preview service doesn’t run then.meilisearchis message and member search. To turn search off, setFLUXER_SEARCH_ENGINEtonone. To use your own Meilisearch instead, setFLUXER_MEILISEARCH_BUNDLED=false, andmeilisearchdoesn’t run.livekitis the voice and video server.FLUXER_LIVEKIT_ENABLED=falseturns it off.valkeykeeps the cache and rate limits on older installs. A new instance keeps them in PostgreSQL, andvalkeydoesn’t run there. It also doesn’t run whenFLUXER_KV_URLpoints at your own Valkey.seaweedfsandseaweedfs-filerstore uploads on older installs. A new instance keeps uploads in its data folder withFLUXER_STORAGE_BACKEND=filesystem, and SeaweedFS doesn’t run there. It also doesn’t run whenFLUXER_S3_ENDPOINTpoints at your own S3-compatible storage.
In the container image, tini runs first and starts fluxerd. Every part listens only on 127.0.0.1 inside, except the edge and the voice server.
Ports inside the instance
Заголовок раздела «Ports inside the instance»These ports are fixed and bound to 127.0.0.1.
A service already on one of them stops that part of Squad from starting.
| Port | Part |
|---|---|
| 14222 | Message queue (NATS) |
| 15432 | PostgreSQL |
| 17700 | Search (Meilisearch) |
| 17880 | Voice server API (LiveKit) |
| 18080 | API |
| 18081 | Gateway |
| 18082 | Media proxy |
| 18083, 18084 and 18085 | Admin panel, web app files and push |
| 18090 to 18094 | Snowflakes, users, messages, GIFs and link previews |
| 16379 | Valkey, only on installs that still use it |
| 18333 and 19333 to 19335 | SeaweedFS, only on installs that still use it |
FLUXER_LOOPBACK_ADDRESS=127.0.0.2 moves them all to another loopback address, and rexctl gives each extra instance on a machine its own. Commands such as fluxerd ctl and fluxerd users talk to the fluxerd that runs with their data folder, over sockets in its runtime folder, which is /run/fluxer, or /run/fluxerd/fluxer with the rexctl unit.
Where data is kept
Заголовок раздела «Where data is kept»The database, uploads, search index, certificates, passwords and keys are all in /var/lib/fluxer, and so are the backups.
- With Docker, that is the volume
fluxer-data. - On Kubernetes, it is the PersistentVolumeClaim
data-fluxer-0, ordata-<release>-fluxer-0for a release name withoutfluxer. - Under systemd, settings are in
/etc/fluxer/fluxer.envand releases in/opt/fluxer/releases/<version>, and/opt/fluxer/currentis the running one. - When rexctl manages Squad, it keeps its record of the install in
.rexctl/state.jsonin the instance folder, which is/opt/fluxeras root and~/fluxerfor any other account. Never edit that file by hand.
The data folder has secrets.env with Squad’s passwords and keys, modes.env with choices made on the first start, and VERSION with the release that last ran on the data.
Backups include all of them.
Bundled or proxy mode
Заголовок раздела «Bundled or proxy mode»FLUXER_EDGE_MODE decides how traffic gets in.
bundled, the default, listens on ports 80 and 443 and gets its own certificate. Pick it when nothing else on the machine uses those ports.proxyserves plain HTTP on 8080 and trustsX-Forwarded-Forfrom private addresses. Pick it when you already run nginx, Caddy, Traefik or a load balancer, and point that proxy at Squad with one of the configs there.tunnelis likeproxy, for Cloudflare Tunnel on a machine with no public address.
Keeping data elsewhere
Заголовок раздела «Keeping data elsewhere»By default every file is on the one volume.
Three parts can move out, and Squad’s backups then leave them out.
- The database can go to your own PostgreSQL 14 or later, such as a CloudNativePG cluster, with
FLUXER_POSTGRES_URL. Back it up with your database’s own tools. - Uploads can go to an S3-compatible store with the file storage settings. Back them up with your store’s versioning or replication.
- Search can go to your own Meilisearch. Squad can build the index again from the database at any time, so it needs no backup of its own. Use your own Meilisearch has the steps.
The message queue, certificates, passwords and keys always stay on Squad’s volume and in Squad’s backups.
Use your own Meilisearch
Заголовок раздела «Use your own Meilisearch»Set these three settings in fluxer.env:
FLUXER_MEILISEARCH_BUNDLED=falseFLUXER_SEARCH_URL=https://search.example.comFLUXER_SEARCH_API_KEY=your-meilisearch-keyWith rexctl, set them in one command:
rexctl config set FLUXER_MEILISEARCH_BUNDLED=false FLUXER_SEARCH_URL=https://search.example.com FLUXER_SEARCH_API_KEY=your-meilisearch-keyOn Kubernetes, set FLUXER_MEILISEARCH_BUNDLED and FLUXER_SEARCH_URL under config, and put FLUXER_SEARCH_API_KEY in the Secret that existingSecret points to.
FLUXER_SEARCH_URLis the address the API uses to connect to your Meilisearch. Inside the container,127.0.0.1andlocalhostare the container itself, so use an address the container can connect to.FLUXER_SEARCH_API_KEYis your Meilisearch master key, or an API key with access to every action and index. Squad creates and updates its own indexes, so a search-only key isn’t enough.- Squad refuses to start while
FLUXER_MEILISEARCH_BUNDLEDisfalseandFLUXER_SEARCH_URLis empty.
After the switch, your Meilisearch starts with no index. Run rexctl search reindex, or open “Search Index” in the admin panel and choose “Reindex everything”. Search shows partial results until it finishes. If you later set FLUXER_MEILISEARCH_BUNDLED=true again, reindex once more.
Availability
Заголовок раздела «Availability»An instance is one process tree in one container, pod or service, and it can’t run as two copies. Squad locks its data folder so that a second copy can’t start on it, and the gateway keeps live connections in memory. The Helm chart runs one replica and has no PodDisruptionBudget, because one on a single pod would only block node drains.
- An upgrade takes Squad offline while it backs up the database, stops and starts the new release, usually for a few minutes. The apps reconnect by themselves.
- A restart or node drain takes Squad offline while it stops, for up to 130 seconds, and then it starts again on the same or another node.
- After a lost disk, or a lost zonal volume on Kubernetes, Squad stays down until you restore a backup onto a new volume.
You lose at most what was posted since the last backup, or since the last VolumeSnapshot on Kubernetes. There is no point-in-time recovery for the bundled database.
With your own PostgreSQL that has replicas and point-in-time recovery, such as a CloudNativePG cluster, the database gets those, while the search index, certificates and keys stay on Squad’s volume and come from Squad’s backups, unless search runs on your own Meilisearch.
Connections Squad makes
Заголовок раздела «Connections Squad makes»These are the outgoing connections in the current release. Inside the instance, the parts connect to each other only on 127.0.0.1.
On by default
Заголовок раздела «On by default»- The edge connects to Let’s Encrypt (
acme-v02.api.letsencrypt.org) on TCP 443 in bundled mode to get and renew the certificate. Proxy and tunnel mode don’t. - The voice server connects to
stun.l.google.comandstun1.l.google.comon UDP 19302 while voice is on, to find the machine’s public address. To use your own STUN server, pointFLUXER_LIVEKIT_STUN_PRIMARYandFLUXER_LIVEKIT_STUN_SECONDARYat it. - Link previews and the media proxy connect to the pages and media people link to, on TCP 80 and 443. List hosts to skip in
FLUXER_API_UNFURL_IGNORED_HOSTS. Every part looks up host addresses through the machine’s DNS resolver on port 53.
Only when you set them up
Заголовок раздела «Only when you set them up»These use TCP 443 unless it says otherwise.
fluxerdasksfluxer.devfor/releases.jsononce a day to see whether a newer release is out, but only when you turn the check on withFLUXER_UPDATE_CHECK=true. The request has nothing about your instance.- The push service connects to the push relay,
push.fluxer.com, after an admin accepts its notice in the setup wizard or the admin panel. - The push service connects to
fcm.googleapis.com,oauth2.googleapis.comand Apple’s APNs hosts if you setFLUXER_PUSH_FCM_ENABLEDorFLUXER_PUSH_APNS_ENABLEDwith your own app credentials. - The API, worker and Rust services connect to your own PostgreSQL, usually on TCP port 5432, when you set
FLUXER_POSTGRES_URL. - The API and worker connect to your SMTP server for email, usually on TCP port 587.
- The API connects to your OpenID Connect provider when you set up single sign-on.
- With uploads in S3, the API, worker and media proxy connect to that store.
- With
FLUXER_MEILISEARCH_BUNDLED=false, the API and worker connect to your own Meilisearch atFLUXER_SEARCH_URL. - The GIF service connects to Klipy’s API for GIF search when you set a Klipy API key.
- Link previews connect to the YouTube Data API (
www.googleapis.com) when you set a YouTube API key for YouTube links. - When you turn on
FLUXER_BREACHED_PASSWORD_CHECK_ENABLED, the API connects toapi.pwnedpasswords.comto refuse passwords from known breaches. - The worker connects to URLhaus, PhishTank and MalwareBazaar to check posted links and uploads against block lists when you turn on
FLUXER_BLOCKLIST_FEEDS_ENABLED.
Getting Squad is a separate step from running it.
Docker pulls the image from ghcr.io, the systemd and rexctl installs download from github.com and fluxer.dev, and Helm pulls the chart from ghcr.io.
The push relay
Заголовок раздела «The push relay»The official Squad apps for iOS and Android get notifications through Apple and Google, and only we can send to them there. When an admin accepts the push relay notice, which says what the relay keeps and where it runs, your instance sends each notification for those apps to the push relay at push.fluxer.com, which passes it to Apple or Google. Leave the relay off and the official mobile apps get no notifications from your instance, while browsers and the desktop app still get notifications from it.
Each device with the app makes its own key pair and keeps the private key. Your instance encrypts each notification to that key with standard Web Push encryption and pads it to a fixed size before it sends it to the relay. Only your instance and the device the notification is for can read what it says. Squad, Apple and Google pass it on without being able to read it, because none of them has the private key that the device holds.
All three can still see that a notification was sent, when it was sent and the device it’s for. The relay also sees your instance’s network address, its VAPID key and contact email, and whether the notification is a message, a call or a cleared notification. Apple and Google see the app, the priority and the expiry time, but not which instance sent it. If the iOS app can’t decrypt a notification in time, it shows “New message” instead.
Behind a proxy or on a locked-down network
Заголовок раздела «Behind a proxy or on a locked-down network»Set HTTP_PROXY, HTTPS_PROXY and NO_PROXY as settings. Squad adds localhost and 127.0.0.1 to NO_PROXY by itself. Link previews, the media proxy, the push service, the GIF service and the edge use the proxy. The API and worker, the gateway and the voice server don’t, and neither does STUN, which is UDP.
The edge gets its certificate through HTTPS_PROXY, but Let’s Encrypt still has to connect to the machine on ports 80 and 443 from the internet to check your domain.
If those ports can’t be opened to the internet, use proxy or tunnel mode.
Where everything has to go through a proxy, set FLUXER_LIVEKIT_NODE_IP and point both STUN settings at a STUN server on your network, and allow the API and worker to connect directly to your SMTP server, SSO provider and S3 store, and to api.pwnedpasswords.com, URLhaus, PhishTank and MalwareBazaar when you turn those checks on. With no internet access at all, Squad runs, but link previews, images from other sites, GIF search and notifications to the official mobile apps don’t work.
When your network inspects TLS or your SSO provider or mail server uses a certificate from your own authority, give Squad that CA certificate. The API and worker load it from FLUXER_NODE_EXTRA_CA_CERTS, and the other parts from SSL_CERT_FILE.
Both take a path inside the container, and the file has the usual public authorities and yours, as the system bundle /etc/ssl/certs/ca-certificates.crt does.
docker run ... -v /etc/ssl/certs/ca-certificates.crt:/etc/fluxer/ca.pem:ro \ -e FLUXER_NODE_EXTRA_CA_CERTS=/etc/fluxer/ca.pem -e SSL_CERT_FILE=/etc/fluxer/ca.pem ...Mount the host’s bundle after you add your authority to it, or a file of your own.
Add your authority to the system bundle with update-ca-certificates, then restart Squad. Squad uses that bundle by default.
extraVolumes: - name: ca configMap: name: corporate-caextraVolumeMounts: - name: ca mountPath: /etc/fluxer/ca readOnly: trueextraEnv: - name: FLUXER_NODE_EXTRA_CA_CERTS value: /etc/fluxer/ca/ca.pem - name: SSL_CERT_FILE value: /etc/fluxer/ca/ca.pemHealth checks
Заголовок раздела «Health checks»fluxerd healthpasses when every part is ready, and the image’s own health check and the chart’s readiness probe use it.fluxerd health --livepasses whenfluxerdresponds, ready or not, and the chart’s startup and liveness probes use it.GET /_healthover HTTP returnsOKfrom Squad’s edge in every mode once it is up.
Point an uptime monitor at /_health from outside the machine.