Docker Compose

Run the Wardn control plane on one machine with Docker Compose, for evaluation and development.

The Compose file runs the same shape as the wardn-tiny chart: one server running every role, the web app, and a Postgres container. It is the fastest way to see Wardn on your own machine. Read Self-hosting first for what each part does.

You need Docker with the Compose plugin, and a checkout of the Wardn repository, which holds the Compose file in deploy/compose/.

Compose is for evaluation and development. The database and the keys live in Docker volumes on one machine, with nothing backing them up. Use wardn-standard for anything you would miss.

Start it

Bring the stack up

cd deploy/compose
docker compose up

To build the images from your checkout instead of using published ones, run docker compose up --build. To pin a released version, set the image variables in .env to that version's tags.

Wait for the keys and the database

On the first start, a one-off keys container makes the two secrets the install needs and keeps them in the keys volume:

  • the Better Auth secret, which the web app signs sessions with and the server checks them with;
  • the secret store's master key, an age key that protects the secrets Wardn stores, such as repository credentials.

A later start finds them and keeps them. The server waits for Postgres to be healthy, runs its database migrations, and then the web app creates its sign-in tables and starts.

Check the server

curl http://localhost:8080/api/v1/health
# {"status":"ok"}
curl http://localhost:8080/api/v1/ready

/ready answers 200 once the database answers, every migration has run and the web app's sign-in tables exist. Until then it answers 503 and lists which check is not ready.

Create the first owner

The Compose file admits people only by invitation (WARDN_SIGNUP=invite), so nobody can sign up yet. Make the first owner with wardn admin create, open the setup link it prints, and choose a password at http://localhost:3002. For a trial nobody else can reach, set WARDN_SIGNUP=open in .env instead and anyone can sign up, each into a personal organization. From here, follow Connect a cluster and Deploy your first app.

What runs

ServiceImagePort on your machineProfile
keysghcr.io/future-pirate-king/wardn-toolsnone; runs once and exitsalways
postgrespostgres:18-alpinenonepostgres (on by default)
serverghcr.io/future-pirate-king/wardn-server8080 (API), 8443 (gateway)always
webghcr.io/future-pirate-king/wardn-web3002always
pgbounceredoburu/pgbouncernonepooler
jaegerjaegertracing/jaeger16686 (its UI)tracing

The Compose project is called wardn-eval, so its volumes are wardn-eval_keys and wardn-eval_postgres-data. The server sets APP_ENV=production, so it refuses a weak Better Auth secret even here.

Settings in .env

Compose reads deploy/compose/.env. Everything in it is optional. These are Compose variables: the Compose file turns them into the server's settings.

VariableDefaultWhat it does
COMPOSE_PROFILESpostgresOptional services to start, comma separated: postgres, pooler, tracing. Empty means you bring your own database.
WARDN_POSTGRES_URLthe bundled databaseBecomes POSTGRES_URL for the server and the web app.
WARDN_POSTGRES_DIRECT_URLemptyBecomes POSTGRES_DIRECT_URL. Set it when WARDN_POSTGRES_URL points at a pooler.
WARDN_PUBLIC_URLhttp://localhost:3002The address people open. Becomes the web app's base URL and the origin the server allows (CORS_ALLOWED_ORIGINS).
WARDN_GATEWAY_HOSTSlocalhost,127.0.0.1Becomes WARDN_GATEWAY_TLS_HOSTS: the names the gateway's generated certificate is valid for.
WARDN_LOG_LEVELinfoBecomes LOG_LEVEL.
WARDN_TRACES_ENDPOINTemptyBecomes WARDN_TRACES_ENDPOINT.
WARDN_API_PORT8080The port the API is published on.
WARDN_GATEWAY_PORT8443The port the gateway is published on.
WARDN_WEB_PORT3002The port the web app is published on.
WARDN_SERVER_IMAGEghcr.io/future-pirate-king/wardn-server:latestThe server image.
WARDN_WEB_IMAGEghcr.io/future-pirate-king/wardn-web:latestThe web app image.
WARDN_TOOLS_IMAGEghcr.io/future-pirate-king/wardn-tools:latestThe image that makes the keys.

Change .env, then run docker compose up -d again to apply it.

Use your own database

Empty the profile list and point Wardn at your database:

deploy/compose/.env
COMPOSE_PROFILES=
WARDN_POSTGRES_URL=postgres://wardn:[email protected]:5432/wardn?sslmode=require

The database must be Postgres 14 or newer, and the user must be able to create tables: the server migrates the schema when it starts. See Postgres.

Try the pooler

The pooler profile starts PgBouncer in transaction mode in front of the bundled database. Requests go through it; LISTEN, leases and migrations keep a direct connection, because a transaction pooler cannot hold a session for them.

deploy/compose/.env
COMPOSE_PROFILES=postgres,pooler
WARDN_POSTGRES_URL=postgres://wardn:wardn@pgbouncer:5432/wardn?sslmode=disable
WARDN_POSTGRES_DIRECT_URL=postgres://wardn:wardn@postgres:5432/wardn?sslmode=disable

See traces

deploy/compose/.env
COMPOSE_PROFILES=postgres,tracing
WARDN_TRACES_ENDPOINT=http://jaeger:4318

Open Jaeger at http://localhost:16686. Requests, database transactions and background jobs appear as spans. See Monitoring.

Connect a cluster to it

An operator dials the gateway on port 8443 and checks its certificate. Two things have to agree:

  1. A name the cluster can reach your machine by. For a local cluster this is often your machine's address on the Docker or local network.
  2. The certificate is valid for that name. Add it to WARDN_GATEWAY_HOSTS and restart the server.
deploy/compose/.env
WARDN_GATEWAY_HOSTS=localhost,127.0.0.1,192.168.1.20
docker compose up -d
wardn cluster connect --create --name laptop --gateway-url https://192.168.1.20:8443

The CLI talks to the API at WARDN_API_URL=http://localhost:3002. See wardn cluster connect for the other flags. The Quickstart shows the simpler route of running the control plane and the operator in the same kind cluster.

Add settings Compose does not list

The server's environment in the Compose file is fixed. To pass another setting, such as the GitHub App's, put a compose.override.yaml next to compose.yaml. Compose merges it automatically.

deploy/compose/compose.override.yaml
services:
  server:
    environment:
      WARDN_GITHUB_APP_ID: "123456"
      WARDN_GITHUB_APP_SLUG: my-wardn
      WARDN_GITHUB_APP_PRIVATE_KEY_FILE: /run/wardn/github-app.pem
      WARDN_GITHUB_WEBHOOK_SECRET: ${WARDN_GITHUB_WEBHOOK_SECRET}
      WARDN_PUBLIC_URL: http://localhost:3002
    volumes:
      - ./github-app.pem:/run/wardn/github-app.pem:ro

The server runs as user 10001, so the key file must be readable by it. GitHub can only deliver webhooks to an address it can reach; on a laptop, the one-minute poll picks up pushes instead. See GitHub App.

Stop, reset and update

CommandEffect
docker compose stopStops the containers and keeps everything.
docker compose downRemoves the containers and keeps the volumes, so the next up finds your data and keys.
docker compose down -vRemoves the volumes too: the database and the keys are gone for good.
docker compose pull && docker compose up -dUpdates to the images the variables name. Migrations run when the new server starts.

Read Upgrading before moving between versions, and Backup and restore to copy the data out.

Next

On this page