Install the server

Run the Flaq Messaging Server with Docker Compose: download and configure it, choose how people reach it, run the setup wizard and bring in the first people.

5 min read

The Messaging Server keeps your group's encrypted messages and files and passes them on live. It runs as three containers from the published images: the server itself, PostgreSQL for its data, and Redis for carrying events between its web processes. This guide goes from an empty machine to people chatting.

What you need#

  • A Linux machine with Docker Engine 24 or newer and the Compose plugin. docker compose version should print a version. Docker's own install guide covers each distribution.
  • One CPU and 1 GB of memory carry a group of a few hundred people. Add disk for the files people send.
  • For a server on your own domain: the domain, and a reverse proxy for HTTPS. For a server at home: nothing more.

1. Download and configure#

Make a directory for the server, download the compose file and the example settings, and give the database a password of its own:

mkdir flaq && cd flaq
curl -O https://raw.githubusercontent.com/hyprlab/flaq/main/server/docker-compose.yml
curl -o .env https://raw.githubusercontent.com/hyprlab/flaq/main/server/.env.example
sed -i "s/^POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=$(openssl rand -hex 24)/" .env

Set the database password now, before the first start. The database is created with it, and changing it later means changing it inside the database too. Everything else in .env is optional and listed in Settings.

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 in .env until the stable 1.0.0 is out, then set it back to latest.

The server listens on port 8105 of the host. If 8105 is taken, change the left side of "8105:8000" in docker-compose.yml.

2. Choose how people reach it#

The apps reach a server in one of two ways. Pick one; you can add the other later.

With your own domain At home, through Flaq Connect
People add it by Its address, chat.example.com An invite link, https://connect.flaq.dev/your-name#k=…
You need A domain, and HTTPS through a reverse proxy Nothing: no domain, no certificate
Ports TCP 443 on the proxy UDP 4433, forwarded on the router if you can
The home address Public, as for any website Given only to people with an invite link, or to nobody with a relay

Follow the guide for the one you choose, then come back for the setup wizard:

Why HTTPS or localhost

Browsers only let a page derive the sign-in secret from a password on a secure origin: HTTPS, or localhost. Opened over plain HTTP from another machine, not even the setup wizard can create the admin account.

3. The setup wizard#

Start the server, if the guide you followed hasn't already:

docker compose up -d

The first visit to the server in a browser opens the setup wizard. It:

  1. creates your account, the first admin (there is no default account or password);
  2. asks whether people may sign up from the app, and how large an upload may be;
  3. makes the #general and #random channels.

It ends in the admin console at /admin. All of this can be changed there later. After setup, / is the server's public page, which says which server this is and how to join it from the app.

At home: open Flaq Connect in the console and tick List this server on Flaq Connect, as At home with Connect describes, to get the invite link.

4. The first people#

  1. Get the app. Download the AppImage from flaq.dev, make it executable (chmod +x Flaq-*.AppImage) and open it. See Get the app.
  2. The admin signs in to the app once, with the account the wizard made. That is when the admin's encryption keys are made. Until then, nobody can share a conversation's keys with them.
  3. Everyone else pastes the server's address or the invite link where the app asks for one, then creates an account, or signs in to one the admin made on the People page. With sign-up off, only the admin adds people.

There is nothing else to set up for encryption: each person's keys are sealed by their own password.

Email is optional

With a mail server set under Server settings > Email in the console, people who forget their password ask the app for a link that sets a new one. Send yourself the test message there to check it. Links in the email open the address the console was open at when you saved it, so save it from the server's public address. Without a mail server, an admin sets a new password on the People page.

5. Check it#

docker compose ps                         # flaq healthy, flaq-db healthy
curl -s http://localhost:8105/healthz     # {"ok":true,"version":"..."}
docker compose logs -f flaq               # what it is doing

/healthz answers once the server can reach its database, without signing in, and docker ps shows the container as healthy or not.

Keep it#

  • Back up the database and the flaq-data volume. The volume holds server-key.pem, the server's identity: restored without it, the server looks like a different one to every app, and its invite links stop working.
  • Update with docker compose pull && docker compose up -d. Migrations run by themselves.

Backups and updates has the commands.

A small install without PostgreSQL#

For a handful of people, Flaq also runs as a single container on SQLite. Drop the flaq-db and flaq-redis services from the compose file, and the DATABASE_URL, REDIS_URL and depends_on lines. It then runs one web process, which still holds hundreds of connections.