> ## Documentation Index
> Fetch the complete documentation index at: https://www.gitaudience.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install GitAudience with Docker Compose or on your own PostgreSQL, and set the environment variables it reads at startup.

GitAudience ships as one Docker image, `notifuse/gitaudience`, that holds the server, the background worker and the console. The reference `compose.yaml` runs it with PostgreSQL 18. For a first install step by step, follow the [quickstart](https://www.gitaudience.com/docs/quickstart.md); this page is the reference.

## What runs

The image has three entry points. The compose file starts each as its own service, from the same image:

| Service    | Runs                  | Notes                                                                                                                |
| ---------- | --------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `migrate`  | `gitaudience migrate` | Creates or updates the database schema, then exits. `api` and `worker` start only once it has finished successfully. |
| `api`      | `gitaudience api`     | The API uses derived signing keys from the shared master secret.                                                     |
| `worker`   | `gitaudience worker`  | The worker encrypts GitHub App credentials with the shared master secret.                                            |
| `postgres` | PostgreSQL 18         | Its data lives in the `gitaudience_pg_data` volume. Not published on any port.                                       |

Run exactly one `api` and one `worker`. The limits on sign-in attempts and the result of the [limit check](https://www.gitaudience.com/docs/self-hosting/licence.md) are kept in each process's memory, so a second copy would not share them.

## Requirements

- Docker Engine and Docker Compose v2.
- A domain name and a reverse proxy with TLS in front of port 3000. `PUBLIC_URL` must be an `https://` address; `http://` is accepted only for `localhost` and `127.0.0.1`, because the session cookie is `Secure`.
- An SMTP server. The `api` sends sign-in codes and invitations through it, and the `worker` sends alerts.
- Outbound access to GitHub (`api.github.com`), to your SMTP server and to `check.gitaudience.com`. Without `check.gitaudience.com`, every project stays under the free limit: see [Licence and limits](https://www.gitaudience.com/docs/self-hosting/licence.md#verification).

## Install with Docker Compose

Put the deployment files in an empty directory:

```text
gitaudience/
├── compose.yaml
├── backup.sh
└── postgres/
    ├── roles.sql
    └── initdb/
        └── 10-roles.sh
```

Create `.env` next to `compose.yaml` with the [required variables](#required-variables), then start:

```bash
docker compose up -d
```

GitAudience uses one non-superuser account that owns its dedicated PostgreSQL 18 database. Give migrate, API and worker the same connection settings. The bootstrap administrator `postgres` remains available only through the local Unix socket, without a password or network login.

> [!WARNING]
>
> PostgreSQL reads `POSTGRES_PASSWORD` when initialising an empty volume. Editing `.env` does not change an existing password: change the account password in PostgreSQL first, then update the configuration.

The compose file names its project `gitaudience`, so the database volume is `gitaudience_pg_data` wherever the directory sits. `docker compose down -v` deletes it, with all your data.

### Behind a reverse proxy

Send every path of your domain to port 3000. One process serves the console, `/api` and `/mcp` at the same origin, so the proxy has a single target.

`TRUST_PROXY` tells the `api` how many proxies sit in front of it, so it reads the visitor's IP address from the right `X-Forwarded-For` entry. The reference compose file sets it to `1`. Set it to the number of proxies you run.

The compose file publishes port 3000 on every interface of the server. `API_PORT` changes the port on the server side. When the proxy runs on the same server, set `API_BIND=127.0.0.1` so that port 3000 only answers on the server itself.

## Deploy on Coolify

1. Create a **Docker Compose** application from `https://github.com/Notifuse/gitaudience`. Set **Base Directory** to `/deploy` and **Docker Compose Location** to `/compose.coolify.yaml`. This loads the PostgreSQL initialisation files from `deploy/postgres`.
2. Assign your HTTPS domain to the `api` service on container port `3000`, for example `https://audience.example.com:3000` in the Coolify domain field. Set `PUBLIC_URL` to the public address `https://audience.example.com`.
3. In **Environment Variables**, set `ROOT_EMAIL`, `SECRET_KEY` (generate it with `openssl rand -base64 32`), `SMTP_HOST`, `SMTP_PORT` and `SMTP_FROM_EMAIL`. Set `SMTP_USERNAME` and `SMTP_PASSWORD` if your relay uses authentication. Use your provider’s port, typically `587` for STARTTLS or `465` for implicit TLS. `SMTP_PORT` must be available when Coolify resolves the Compose file.
4. Coolify generates `SERVICE_PASSWORD_POSTGRES`. On first boot with an empty volume, PostgreSQL uses it for the `gitaudience` account shared by `migrate`, `api` and `worker`. Keep that value with the database volume and back up `SECRET_KEY`.
5. Check that the selected `GITAUDIENCE_VERSION` tag exists on [Docker Hub](https://hub.docker.com/r/notifuse/gitaudience/tags), then deploy. Check that `migrate` exits with code `0`, `/health` returns `200`, and your owner email receives a sign-in code.

## Use your own PostgreSQL

GitAudience uses one non-superuser account that owns its dedicated PostgreSQL 18 database. Give migrate, API and worker the same connection settings. The bootstrap administrator `postgres` remains available only through the local Unix socket, without a password or network login.

For an external database, have its administrator create one non-superuser owner and a dedicated database. The migrations create the trusted extensions `pg_trgm` and `btree_gin` under that owner. Remove the PostgreSQL service and the structured connection settings from the application services, then set the same URL on all three:

```bash
DATABASE_URL=postgres://gitaudience:<percent-encoded-password>@<host>:5432/gitaudience
```

The reference Compose file passes `PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER` and `POSTGRES_PASSWORD` separately. Use these structured settings or `DATABASE_URL`, never both. Special characters in the password are supported; percent-encode credentials when writing a URL yourself. Keep `$` literal according to your environment-file quoting rules.

## Environment variables

GitAudience checks its variables at startup. A missing or invalid variable stops the process with a message that names the variable, never its value. An empty variable counts as missing.

### Required variables

| Variable            | Service                                | What it is                                                                                                                                                                                                                |
| ------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PUBLIC_URL`        | `api`, `worker`                        | The address of the console, such as `https://audience.example.com`. `https://` only, except for `localhost` and `127.0.0.1`. See [Changing the domain](https://www.gitaudience.com/docs/self-hosting/changing-domain.md). |
| `ROOT_EMAIL`        | `api`                                  | The first owner. At every start, GitAudience makes sure this address is an owner who cannot be removed.                                                                                                                   |
| `SECRET_KEY`        | `api`, `worker`                        | The API and worker share `SECRET_KEY`. The API derives separate keys for sign-in and GitHub callback signatures; the worker encrypts GitHub App credentials with the unchanged master key.                                |
| `SMTP_HOST`         | `api`, `worker`                        | Your SMTP server.                                                                                                                                                                                                         |
| `SMTP_PORT`         | `api`, `worker`                        | Its port, such as `587` or `465`.                                                                                                                                                                                         |
| `SMTP_FROM_EMAIL`   | `api`, `worker`                        | The sender address of GitAudience's emails.                                                                                                                                                                               |
| `POSTGRES_PASSWORD` | `postgres`, `migrate`, `api`, `worker` | Password of the single application account `gitaudience`, shared by migrate, API and worker.                                                                                                                              |

The reference Compose file passes `PGHOST`, `PGPORT`, `PGDATABASE`, `PGUSER` and `POSTGRES_PASSWORD` separately. Use these structured settings or `DATABASE_URL`, never both. Special characters in the password are supported; percent-encode credentials when writing a URL yourself. Keep `$` literal according to your environment-file quoting rules.

> [!WARNING]
>
> Keep `SECRET_KEY` with your backups. Without it, the `worker` can't read the secrets of your GitHub Apps: it logs an error that names the cause, and the only way out is to disconnect each App in Settings › **GitHub Apps** and connect it again.

### Optional variables

| Variable                         | Service         | Default                                   | What it does                                                                                                                                                                       |
| -------------------------------- | --------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GITAUDIENCE_IMAGE`              | compose         | `notifuse/gitaudience:v1.5.0`             | The image and its version, such as `notifuse/gitaudience:<version>`.                                                                                                               |
| `GITAUDIENCE_VERSION`            | compose         | `v1.5.0`                                  | Docker image release tag when GITAUDIENCE_IMAGE is not overridden.                                                                                                                 |
| `SMTP_USERNAME`, `SMTP_PASSWORD` | `api`, `worker` | empty                                     | SMTP login. Give both or neither: without them, mail is sent without authentication; one without the other stops the start.                                                        |
| `SMTP_FROM_NAME`                 | `api`, `worker` | `GitAudience`                             | The sender name.                                                                                                                                                                   |
| `SMTP_USE_TLS`                   | `api`, `worker` | `true`                                    | `true`: TLS from the first byte on port 465, STARTTLS required on any other port. `false`: no TLS at all, even if the server offers STARTTLS, for a local relay.                   |
| `TRUST_PROXY`                    | `api`           | `1` in the compose file, `0` in the image | Number of proxies in front of the `api`.                                                                                                                                           |
| `API_PORT`                       | compose         | `3000`                                    | The port published on the server.                                                                                                                                                  |
| `API_BIND`                       | compose         | —                                         | Host interface for the published port; use 127.0.0.1 when the reverse proxy runs on the same host.                                                                                 |
| `LOG_LEVEL`                      | all             | `info`                                    | `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`.                                                                                                                    |
| `RELEASE_CHECK_ENABLED`          | `api`           | `true`                                    | `false` disables update checks from an owner’s browser through `check.gitaudience.com`. Requests send the installed version, browser language and timezone. Disabled in demo mode. |

The image also reads a few variables that the reference compose file does not pass:

| Variable                       | Service         | Default                                        | What it does                                                      |
| ------------------------------ | --------------- | ---------------------------------------------- | ----------------------------------------------------------------- |
| `PORT`                         | `api`           | `3000`                                         | The port the `api` listens on inside the container.               |
| `GITHUB_URL`, `GITHUB_API_URL` | `api`, `worker` | `https://github.com`, `https://api.github.com` | The GitHub addresses, changed only to test against a fake GitHub. |

## Signing in without email

If SMTP fails, or a user can't receive codes, an administrator with access to the server can create a one-time sign-in link:

```bash
docker compose exec api gitaudience login-link you@example.com
```

The link works once, for 15 minutes, and only for an active user. Open it in a browser, not in a chat app, whose link preview would use it up. The logs never contain the link or the address.

## Health check

`GET /health` answers `200` with `{"status":"ok"}` when the `api` reaches its database within 2 seconds, and `503` with `{"status":"unavailable"}` otherwise. It needs no session and returns nothing else. The compose file uses it as the health check of the `api` container. The `worker` has no health route.

## Demo configuration

Use the dedicated demo Compose file in `deploy/demo/`. It provides automatic public access without a sign-in code, read-only data and a daily reset at 04:00 UTC. Supply `POSTGRES_PASSWORD` and `PUBLIC_URL`; `DEMO_MODE=true` is set by Compose. `DEMO_SEED` defaults to `1` and `DEMO_RESET_CRON` to `0 4 * * *`. Do not supply `SECRET_KEY`, `ROOT_EMAIL` or SMTP settings. Never enable demo mode on a database containing real data.
