Docs

Quick start

Installing a federation on a Linux machine with a domain, up to the first sign-in from the app.

The ready-made stack starts with one command: the federation server, PostgreSQL, Keycloak for sign-in, Caddy with a Let's Encrypt certificate, TURN and the call media server. Everything runs in Docker Compose on one machine.

Before you start, check the requirements: a domain pointing at the machine, and open ports.

Get the source

git clone https://github.com/serezhia/chat_playground.git comon
cd comon
git checkout v0.2.4   # the latest release, see the changelog

The server images are built from this source when you start the stack. Dart and Flutter are not needed on the host: the build runs inside Docker.

Prepare the state

python3 tools/mvp-stack.py prepare \
  --host chat.example.org --port 443 --listen 0.0.0.0 --public-tls
  • --host is the federation's domain. It becomes the address of the federation and of its sign-in service, so choose it now: changing it later is a move.
  • --public-tls gets a Let's Encrypt certificate. It needs port 443 and a DNS record pointing at the machine. Without it, Caddy issues a certificate from its own authority, which apps from the stores do not trust.
  • --listen 0.0.0.0 listens on every interface (the default is local only).

The command creates the state directory .local/mvp/: configuration, random passwords and keys, Compose files. Only its owner can read it. Do not publish it or put it in Git, and do not run prepare again over an existing state: it refuses.

Start it

python3 tools/mvp-stack.py up

up builds the images, creates the database, applies migrations, starts every service and checks that the federation answers. The first build takes a few minutes. Afterwards, check the state with:

python3 tools/mvp-stack.py check

check asks /health, /ready, the federation document /.well-known/comon-federation and the sign-in service.

Create people in Keycloak

Open https://chat.example.org/identity/admin/ and sign in as operator. The password is in .local/mvp/stack.env on the KEYCLOAK_ADMIN_PASSWORD line; do not forward it or paste it into logs.

  1. Choose the comon realm.
  2. Create users and give them initial passwords (Users › Add user, then Credentials).
  3. Create a permanent Keycloak administrator and delete the temporary operator, as the Keycloak documentation advises.

Self-registration and password reset in Keycloak stay off until you set them up.

Sign in from the app

Install Comon (apps), choose "Add federation" and enter chat.example.org. The app checks the address and opens Keycloak's sign-in page in the system browser.

  • On the first sign-in the app asks for a federation cloud password: it is needed to sign in on new devices (more).
  • The first person to finish sign-up becomes the federation's owner. The owner sees the "Manage Federation" section in settings.

What next

Sending video

The ready-made stack builds the server without ffmpeg, so video can be watched but not sent. To turn sending on, in .local/mvp/compose.yaml change the build of the federation service and add an option:

  federation:
    build:
      context: ./server-context
      dockerfile: Dockerfile.video
    command:
      # … the other options unchanged
      - --video-validator-config=/config/video-validator.json

The Dockerfile.video image has ffmpeg in an isolated sandbox and a ready /config/video-validator.json. If push notifications are on, add the same line to compose.push.yaml too: it repeats the whole server command. Then run up again.

Changing options

The server's options are the command of the federation service in .local/mvp/compose.yaml (and in compose.push.yaml, if present). Add an option from the reference and run up. On upgrades up adds to these files only what the new version needs; after an upgrade, check that your options are still there.

Script commands

CommandWhat it does
prepareCreates a new state. Refuses when the directory is not empty.
upBuilds and starts the stack, applies migrations, updates the files for the current version, checks.
checkChecks /health, /ready, the federation document and sign-in.
stopStops the stack; data stays.
configValidates the Compose files.
preflightChecks the database before an upgrade (upgrading).
backup, restoreBackups and restore.
export-clientWrites client.json with public settings for your own app build.
enable-push, admit-installationPush notifications.
enable-turn-tlsTURN over TLS.
enable-transcriberVoice transcription.
enable-bridge, bridge-loginBridges.

Common options: --state <directory> (default .local/mvp) and --project <name> (the Docker project, default comon-mvp). One comon-mvp project runs per machine: do not run two states at once.

On this page