RunR — Production Install Guide (Docker Compose)
Single-host installation with Docker Compose, including air-gapped environments. The images are built once from a release checkout (compose/build.sh) into one archive; the host that runs RunR loads this prebuilt archive and needs no internet access.
Requirements#
- Docker Engine 24+
- Docker Compose v2
- At least 4 GB RAM, 2 CPUs
- For HTTPS (section 7): a DNS name for the console and Caddy 2 on the host
1. Choose the modules#
On a machine with internet access, check out the release you install and create the Compose settings file .env:
git clone --branch v0.7.5 https://github.com/BRF-Tech/runr.git
cd runr
cp compose/.env.example compose/.env
The optional modules are switched on and off in compose/.env. The UI is built with the modules selected here and the API containers enable the same ones, so set them before you build; after a change, build and load the images again.
| Variable | Module | Default |
|---|---|---|
TENANCY_ENABLED |
Multi-tenancy | false |
AUTH_PROVIDER_ENABLED |
Sign-in through OAuth / OpenID Connect / SAML providers (SSO) | false |
TICKET_ENABLED |
Support tickets | true |
BILLING_ENABLED |
Billing: monthly bills per project for an external invoicing system (billing); currency and webhook in api.env |
false |
An environment variable of the same name takes precedence over .env, for the build as for docker compose.
2. Build and load the images#
Build all images into one archive:
REVERB_KEY=<your reverb key> bash compose/build.sh # → compose/runr-images.tar
REVERB_KEY is baked into the UI build and must match REVERB_APP_KEY in api.env (default runr-prod-key).
Built on the target machine itself, the images are already in its Docker: continue in the compose/ directory with step 3. For another machine (an air-gapped host, for example), copy the compose/ directory — docker-compose.yml, Caddyfile, .env, api.env.example, the new runr-images.tar and, for HTTPS, Caddyfile-host and Caddyfile-wildcard — to it and load the images there:
docker load -i runr-images.tar
Verify the loaded images:
docker images | grep -E "runr-|postgres|redis"
Expected output:
runr-api latest ...
runr-ui latest ...
ghcr.io/brf-tech/runr/reqs/postgres 17-alpine ...
ghcr.io/brf-tech/runr/reqs/redis 7-alpine ...
3. Configure the environment#
In the compose/ directory (the docker compose commands below run there, too):
cp api.env.example api.env
.env — Compose-level settings#
| Variable | Description | Default |
|---|---|---|
PORT |
Port the gateway publishes on the host; 127.0.0.1:8080 publishes it on the loopback interface only (HTTPS, section 7) |
80 |
DB_NAME |
PostgreSQL database name | runr |
DB_USER |
PostgreSQL user | runr |
DB_PASS |
PostgreSQL password | Change it! |
TENANCY_ENABLED, AUTH_PROVIDER_ENABLED, TICKET_ENABLED, BILLING_ENABLED |
Modules (step 1); the values the images were built with |
api.env — Laravel application settings#
Fields you must change:
| Variable | Description |
|---|---|
APP_KEY |
Laravel encryption key (generated below) |
APP_URL |
URL the console is reached at |
FRONTEND_URL |
Same as APP_URL |
SANCTUM_STATEFUL_DOMAINS |
Host of APP_URL, with the port when it is not the scheme's default |
DB_PASSWORD |
Must be the same as DB_PASS in .env |
REVERB_APP_KEY |
WebSocket key (random string; the same value as REVERB_KEY at build time) |
REVERB_APP_SECRET |
WebSocket secret (random string) |
The first administrator account (step 5):
| Variable | Description | Default |
|---|---|---|
ADMIN_USERNAME |
User name, without @ (the account signs in with it or with ADMIN_EMAIL) |
admin |
ADMIN_EMAIL |
E-mail address | admin@example.com |
ADMIN_PASSWORD |
Password; empty: the migrator generates one and prints it once | empty |
Billing (only read with BILLING_ENABLED=true in .env, billing):
| Variable | Description | Default |
|---|---|---|
BILLING_CURRENCY |
ISO 4217 currency of every price and bill | USD |
BILLING_WEBHOOK_URL |
Where billing events are POSTed for your invoicing system; empty: they are kept for GET /api/billing/events only |
empty |
BILLING_WEBHOOK_SECRET |
Signing key of the X-RunR-Signature header (at least 16 characters) |
empty |
For a host with the address 10.0.0.10 and the default PORT=80:
APP_URL=http://10.0.0.10
FRONTEND_URL=http://10.0.0.10
SANCTUM_STATEFUL_DOMAINS=10.0.0.10
With PORT=8080 they are http://10.0.0.10:8080 and 10.0.0.10:8080. The values for HTTPS are in section 7.
4. Generate APP_KEY#
docker compose run --rm api php artisan key:generate --show
Paste the printed base64:... value into the APP_KEY= line of api.env.
5. Start the services and create the administrator#
docker compose up -d
On the first start, run the migrator:
docker compose run --rm migrator
It migrates the database and, while the installation has no administrator, creates the first one from ADMIN_USERNAME, ADMIN_EMAIL and ADMIN_PASSWORD. With an empty ADMIN_PASSWORD it generates a password and prints it at the end of its output, only this once:
Administrator account created: admin (admin@example.com)
Password (generated, shown only this once): <password>
The migrator runs after every update (see Updating); once an administrator exists it leaves the accounts and their passwords alone.
Check the service status:
docker compose ps
All services should be running (healthy).
6. Access#
Open APP_URL in a browser — with the example above http://10.0.0.10 — and sign in with the administrator account: its user name (ADMIN_USERNAME) or e-mail address (ADMIN_EMAIL) in the E-mail or user name field, and its password.
7. HTTPS#
A Caddy on the host terminates TLS and forwards the requests to the gateway, which then listens on the loopback interface only. Caddy obtains a Let's Encrypt certificate for the console domain automatically, or serves a certificate you provide (internal CA, air-gapped host). The example uses runr.example.com for the console and fn.example.com as the function domain of a region. A region's function domain is <region name>.<base domain> (the base domain is set in Settings → Platform → Base Domain): fn.example.com is a region fn with the base domain example.com.
DNS: an
Arecord forrunr.example.compointing at the host. For the function domain of a region on this host (step 5 below), a wildcard record*.fn.example.compointing at the host, too..env: the gateway on the loopback interface, where Caddy reaches it:PORT=127.0.0.1:8080api.env: the console URL, and two proxies in front of the API (Caddy and the gateway), so the API records the client's address; the session cookie of the Horizon dashboard is then sent over HTTPS only:APP_URL=https://runr.example.com FRONTEND_URL=https://runr.example.com SANCTUM_STATEFUL_DOMAINS=runr.example.com TRUSTED_PROXY_HOPS=2 SESSION_SECURE_COOKIE=trueApply both files:
docker compose up -d --force-recreate.Console certificate: in
Caddyfile-host, replacerunr.example.comwith your domain. For Let's Encrypt nothing else is needed: the domain must resolve to the host and ports 80 and 443 must be reachable from the internet. For your own certificate, uncomment thetlsline and set the paths of the certificate chain and its private key.Function domain — for a region whose ingress only this host reaches, such as a kind cluster created with
compose/kind-setup.sh. InCaddyfile-wildcard:replace
*.fn.example.comwith your wildcard domain;set the
tlsline to a wildcard certificate for it. Let's Encrypt issues wildcard certificates only through the DNS challenge, with a Caddy built with your DNS provider's module (DNS challenge);replace
172.19.0.5with the address of the region's Traefik load balancer: the IP address the region page lists under DNS Configuration, orkubectl --context kind-runr -n knative-serving get service traefik \ -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
The wildcard domain is the region's function domain, the one the region page lists under DNS Configuration; projects are then served at
https://<project>.fn.example.com.A region in another cluster serves its function domain through that cluster's ingress: point the wildcard record at it and give the region its certificate under Function-domain TLS on the region page.
Install the configuration on the host and reload Caddy:
sudo cp Caddyfile-host /etc/caddy/Caddyfile # console cat Caddyfile-host Caddyfile-wildcard | sudo tee /etc/caddy/Caddyfile >/dev/null # console + function domain sudo systemctl reload caddyCheck:
curl -s https://runr.example.com/api/versionprints the version, and the console opens athttps://runr.example.com.
With the Auth Provider module, the callback URL to register with an OAuth or OpenID Connect provider is https://runr.example.com/oauth/<provider>/callback.
Service architecture#
┌─────────────────┐
│ Gateway :80 │
│ (Caddy + SPA) │
└──────┬──────────┘
│
┌────────────┼────────────┐
│ │ │
/api/* /mcp /git/* /ws/* /* (SPA)
/oauth/*/callback │
/horizon /storage/* │
│ │
┌─────▼──────┐ ┌───▼────┐
│ API │ │ Reverb │
│ (Octane) │ │ (WS) │
└─────┬──────┘ └────────┘
│
┌────────┼────────┐
│ │ │
┌────▼───┐ ┌──▼───┐ ┌──▼───────┐
│Horizon │ │Redis │ │PostgreSQL│
│(Queue) │ │ │ │ │
└────────┘ └──────┘ └──────────┘
│
┌────▼─────┐
│Scheduler │
│ (Cron) │
└──────────┘
Common tasks#
View logs#
docker compose logs -f # all
docker compose logs -f api # API only
docker compose logs -f horizon # queue worker only
Run migrations (after an update)#
docker compose run --rm migrator
Reset the database (WARNING: deletes all data)#
docker compose run --rm -e CONTAINER_ROLE=migrator-fresh migrator
The reset database gets a new first administrator from api.env (step 5).
Restart Horizon (after queue configuration changes)#
docker compose restart horizon
Horizon dashboard#
Horizon (<APP_URL>/horizon, served by the API through the gateway) shows the queues of the whole installation — running, failed and completed jobs — and retries or deletes jobs. It is open to the people who operate the installation: platform administrators (multi-tenant edition) and, in the single-tenant edition, the holders of platform.manage — the Owners, and custom roles that include it. The console signs in with API tokens, which a browser does not send to /horizon, so such an administrator opens the dashboard with a single-use sign-in link:
| From | Command |
|---|---|
| The host | docker compose exec api php artisan runr:horizon-link (--user=<name or e-mail>, default the oldest administrator; --minutes=<1–60>, default 5) |
| The API | curl -X POST https://runr.example.com/api/horizon/link -H "Authorization: Bearer $TOKEN" with a console session or an unscoped API token of the administrator; the answer is {"url": …, "expires_at": …} |
The command builds the link from APP_URL. Opening the link signs the browser in to Horizon: the link works once and only until it expires, and every later Horizon request checks the account again — removing the administrator flag, the Owner role or platform.manage, or disabling the account, ends the access at once. Behind HTTPS (section 7) SESSION_SECURE_COOKIE=true sends the dashboard's session cookie over HTTPS only. POST /api/horizon/link is recorded in the audit log as horizon.link.create; the link itself is never logged.
Stop the services#
docker compose down # stop (data is kept)
docker compose down -v # stop + delete volumes (WARNING!)
Updating#
- Back up the database:
docker compose exec -T postgres pg_dump -U runr runr > runr-backup.sql - Build the images of the new release (step 2, with the same module toggles in
compose/.env), copy the newrunr-images.tarto the machine and load the images:docker load -i runr-images.tar - Take
docker-compose.ymland theCaddyfileof the new release (new routes such as/oauth/<provider>/callbackand/horizongo through the gateway to the API); keep your.envandapi.env.APP_KEYmust stay the same: environment variables and other secrets are stored encrypted with it. Settings that are new inapi.env.exampletake their defaults until you add them toapi.env— for exampleADMIN_USERNAME,ADMIN_EMAILandADMIN_PASSWORD(the first administrator, created only while the installation has none, step 5), and behind the HTTPS proxyTRUSTED_PROXY_HOPS=2andSESSION_SECURE_COOKIE=true(section 7). The upgrade notes list what each release changes. - Stop the application, run the migrations with the new image, start the new release:
The migrator also migrates the tenant schemas whendocker compose stop gateway api horizon scheduler reverb docker compose run --rm migrator docker compose up -dTENANCY_ENABLED=true, so the new release never serves requests against an old schema. - Bring the existing regions up to the new release (their Knative and Traefik settings, the Traefik image, the registry sync; idempotent,
--dry-runshows the changes first):
Exit code 0: every region is at the new release; 1: a step failed or still waits, 4: a region's cluster did not answer — the output names them, run the command again once they are fixed (it continues where it stopped). The console shows the result in the region's status (General tab) anddocker compose exec api php artisan region:reconcile/api/versioninregion_reconcile. - Move the values of project secret variables that are still in the database into their regions (from 0.6.0 on; idempotent and resumable,
--dry-runlists them). Once the new release is confirmed, finalize the move, after which 0.5.10 must not be started again (upgrade notes):docker compose exec api php artisan secrets:move-to-region docker compose exec api php artisan secrets:move-to-region --finalize
Upgrading from 0.4.x#
- Access: every existing user keeps what they could do. The administrator account becomes Owner, every other user of a single-tenant install becomes Admin; tenant members keep their tenant role (
memberbecomes a custom Member role with the same permissions); API tokens keep working, tokens with 0.4.x scopes get the matching permissions. Details: Roles and permissions. - Secrets at rest: the migrations encrypt the stored environment variables (and the other secret columns) with
APP_KEY— see Security. Keep a copy ofAPP_KEYwith your database backups. - Real-time clients: every broadcast channel is private now; custom WebSocket clients authorize through
POST /api/broadcasting/auth(Security).
bash runtime/ci.sh test-upgrade (add --tenancy for a multi-tenant install) runs this procedure from the previous release (--from=REF, default main) on PostgreSQL: it creates an administrator, members, projects with environment variables and a code version, API tokens and settings, upgrades with the images of the checkout and checks sign-in, access, tokens, the encryption at rest and the settings.
Troubleshooting#
| Problem | Solution |
|---|---|
| API health check fails | docker compose logs api; usually APP_KEY is empty |
| Database connection error | Check that the DB passwords in .env and api.env match |
| WebSocket does not connect | REVERB_APP_KEY in api.env must equal the REVERB_KEY used at build time |
| 502 Bad Gateway | The API container is still starting; wait 30 s or check the logs |
| Port conflict | Change PORT in .env |
| A module's pages are missing in the console | The UI was built with other module toggles: build and load the images again (step 2) |
| The migrator prints no administrator password | An administrator already exists, ADMIN_EMAIL belongs to another account (in any letter case) or ADMIN_USERNAME contains @ (the migrator says which) |