Backups and updates

What to back up (the database and the flaq-data volume with server-key.pem), how to update with docker compose pull, and the stable and beta channels.

3 min read

A Messaging Server is two things: its database and its data volume. Back up both, and keep server-key.pem with them. Updating is one command, and migrations run by themselves.

What to back up#

What Holds Without it
The database Accounts, conversations, the encrypted messages, settings Everything is gone
The data volume, flaq-data The uploaded files (sealed by the apps), the generated session key, and server-key.pem, the server's own key Files are gone, and the server looks like a different one to every app

server-key.pem is the server's identity. The apps know a server by the id made from its key, and refuse a server that answers with another. A server restored without its key looks like a different server to every app, and its invite links stop working.

A backup is as safe to store as the server

Both hold only ciphertext for messages and files. Nobody, the admin included, can read messages from a backup without a member's password.

Back up the database#

While the server runs:

docker exec flaq-db pg_dump -U flaq -Fc flaq > flaq-$(date +%F).dump

Restore into an empty database with pg_restore.

On a small install that runs on SQLite instead of PostgreSQL, this writes a consistent copy of the database while the server runs:

docker exec flaq flask backup /data/backup-$(date +%F).db

Back up the data volume#

Copy the flaq-data volume with the server stopped, or with any tool that snapshots volumes. Keep the copy together with the database dump from the same time.

Update#

From the server's directory:

docker compose pull && docker compose up -d

Migrations run by themselves at startup. A MAJOR version, such as 2.0.0, means an existing install needs something done by hand; the changelog says what.

The same command updates a Flaq Connect or a Flaq Relay, from its own directory.

Channels#

IMAGE_TAG in .env chooses which image to run:

IMAGE_TAG What it follows
latest The stable channel, the default
beta Previews of the next minor release, published between stable releases. Betas can break things: back up first
A version, such as 1.4.0 That version only, pinned

Switching back from beta to latest works as long as the beta didn't run a migration the stable can't read. The changelog says when one does.

While Flaq 1.0 is in beta

The images exist only as :beta and as versions such as :1.0.0-beta.2. Set IMAGE_TAG=beta until the stable 1.0.0 is out, then set it back to latest.

Change IMAGE_TAG, then run the update command above.

One version for everything#

The Messaging Server, the desktop app, Flaq Connect and Flaq Relay are released together on one version, with one changelog. The release notes on flaq.dev say what each release changed in every part. The desktop app updates itself through an AppImage updater; see Get the app.

Backing up Connect and the relay#

  • Flaq Connect: back up the connect-data volume, for its names, settings and admins, and its home accounts if it has them on. The servers' records come back by themselves, since each server sends its own again every few minutes.
  • Flaq Relay: the relay-data volume keeps each access key's traffic this month. The keys themselves are in its .env.

Keep the .env file of each part with its backup, and the certificates of Connect and the relay, or the means to get them again (Certificates).

Locked out#

An admin who forgot their password sets a new one inside the container:

docker exec -it flaq flask reset-password you@example.com

As any reset does, this starts new keys for that account; their history reopens once another member's app shares it.