Skip to content
Search docs
Search the docs and jump to the section
Sign in

Self-hosting

A private, single-server installation with Docker Compose, or a deployment on Coolify. Neither is hardened.

Requirements

  • A Linux server with Docker Engine and Docker Compose v2.
  • A copy of the repository⁠ (opens in a new tab).
  • gVisor (runsc) registered as a Docker runtime for code execution. On Debian or Ubuntu the install script adds it (using sudo); on other distributions install it first. The install script requires it even if sandboxes will run on Daytona or Docker Cloud Sandboxes instead (chosen later in Admin → Sandboxes).
  • An AI provider account and API key, added in the web app after setup.

Node and pnpm run inside the image; they are not required on the host. The first build needs internet access. No provider keys or local .env files are copied into the image.

Install

From the repository directory on the server:

deploy/install.sh

The script checks Docker, installs gVisor if Docker has no runsc runtime, runs docker compose -f deploy/compose.yaml up -d --build, waits for the web app and prints how to reach it and the setup code. It is safe to run again, and running the compose command yourself does the same without the checks.

The build generates and retains internal secrets, starts Postgres, applies the schema, replaces development database passwords, and starts the web app and worker. It does not seed a development user.

The web listener is bound to 127.0.0.1:5231, not a public interface. There are no DNS, reverse proxy or existing website changes. Postgres has no published port.

From your own computer, keep this tunnel running:

ssh -N -L 127.0.0.1:5231:127.0.0.1:5231 your-server

Open http://localhost:5231. Use that exact hostname and port: this recipe configures them as the authentication origin and builds the web image for that origin.

A public domain instead

deploy/install.sh --domain werker.example.com

This builds the web image for https://werker.example.com and starts a Caddy container that gets and renews the certificate. It needs a DNS record for the domain pointing at the server, and ports 80 and 443 free: a server already running a reverse proxy (Coolify, Traefik, nginx) should route the domain to 127.0.0.1:5231 there instead. The domain is remembered in deploy/.env, which holds no secrets. This path has only been checked as far as the compose configuration; no certificate has been issued with it yet.

First use

  1. Get your setup code on the server (the install script prints it):

    docker compose -f deploy/compose.yaml exec web node deploy/start.ts setup-code
  2. Enter it on the setup screen and choose your email and password. This creates the first instance administrator and a workspace. Setup closes once an account exists; public signup remains off. Adding more people is in users and access.

  3. Open Admin → Connections, choose Connect on a model provider and paste its API key (connections). The web app can store the key but not read it back.

  4. Check Admin → Models for provider availability, then use New to describe some work.

The worker uses this server's Docker socket for gVisor sandboxes. Sandbox networking starts disabled; resource and network settings are under Admin → Sandboxes. Only the trusted worker receives the Docker socket, never the generated-code containers.

Supported providers, credential handling and the classifier binding are in connections.

What runs

ServiceWhat it does
configureRuns once, generates the install's secrets and gives each service only its own.
postgresPostgres 17. No published port.
migrateRuns once, applies the database schema.
webThe web app. Listens on 127.0.0.1:5231.
workerRuns the work and controls Docker for sandboxes.
proxyOptional Caddy reverse proxy, started only with --domain.

Which service holds which secret

configure generates every secret once and hands each service only its own, on separate volumes:

  • web: its database passwords, the session-signing secret, the setup code and a public key. It holds nothing that decrypts stored credentials.
  • worker: its database password and the master key. Only the worker opens stored credentials, so Test connection and model checks run there; a test reports "No worker answered" when the worker is down (how credentials are sealed).
  • postgres: its own password.
  • configure and migrate, which run and exit: all of them.

Operations

docker compose -f deploy/compose.yaml ps
docker compose -f deploy/compose.yaml logs --tail=100 web worker
docker compose -f deploy/compose.yaml restart web worker
docker compose -f deploy/compose.yaml stop
docker compose -f deploy/compose.yaml up -d

Docker restarts the long-running services after a reboot. The configure and migrate containers are one-time jobs; an exited status with code 0 is normal.

Data and backups

Persistent Docker volumes:

  • werker-selfhost_postgres: accounts, connections, workflows and runs.
  • werker-selfhost_secrets: generated database passwords, authentication secret, master key and setup code. Treat this volume as credentials.
  • werker-selfhost_projects: the files agents keep (projects).

Preserve all four. Losing the secrets volume loses access to encrypted provider keys and the database. Do not use down -v unless you intend to destroy the installation. The secrets-web, secrets-worker and secrets-postgres volumes are copies rewritten from secrets on every start; caddy holds certificates Caddy can get again.

To back up, stop the services and archive the four volumes together:

docker compose -f deploy/compose.yaml stop
for volume in postgres runs secrets projects; do
  docker run --rm -v werker-selfhost_$volume:/from:ro -v "$PWD":/to \
    alpine tar czf /to/werker-$volume.tar.gz -C /from .
done
docker compose -f deploy/compose.yaml up -d

The archives contain every credential. Restoring is the reverse into empty volumes of the same names; it has not been rehearsed, and there is no scheduled backup. Schema changes are numbered migrations, applied on start; upgrading an install has not been rehearsed. Do not reset a populated installation to work around that.

On Coolify

How Werker's own instance was set up, on Coolify 4.7.10, on 2026-11-30 and again on another server on 2026-12-01. Coolify builds the repository with Railpack. These steps replace the install script.

Before you start

  • Docker 29.10.1 on the server, as tested.
  • A domain for the app, such as app.example.com, with a DNS record pointing at the server.
  • A GitHub source in Coolify (Sources), a GitHub App with access to the repository or your fork of it. A push to the branch then redeploys. For a repository in an organisation, install the App on the organisation.
  • A key for Daytona or Docker Cloud Sandboxes. The app's container has no Docker socket, so gVisor sandboxes do not run there (sandboxes).

1. Add the database

Add a PostgreSQL 17 database to a project, and press Start. The app cannot start without it. From its General page, copy the internal Postgres URL, not the public one.

2. Add the app

Add the repository from your GitHub source and change the build pack from Docker Compose.

SettingValue
Branchmain
Build packRailpack
Base directory/
Build commandpnpm --filter @werkerai/app build
Start commandpnpm start
Port3000
Domainhttps://app.example.com
Persistent volume/app/data

The volume holds run files and projects.

3. Make the secrets

In your own terminal. It prints them and saves nothing:

for n in 1 2 3; do echo "HEX $n: $(openssl rand -hex 24)"; done
for n in 1 2; do echo "BASE64 $n: $(openssl rand -base64 32)"; done

4. Add the environment variables

# Available at build time and at runtime
ORIGIN=https://app.example.com
# Build time: projects need Git in the running container
RAILPACK_DEPLOY_APT_PACKAGES=git
# Runtime only
WERKER_OWNER_DATABASE_URL=<the internal Postgres URL>
WERKER_DATABASE_URL=postgresql://werker_app:<HEX 1>@<HOST>
WERKER_AUTH_DATABASE_URL=postgresql://werker_auth:<HEX 2>@<HOST>?options=-c%20search_path%3Dauth
WERKER_SETUP_CODE=<HEX 3>
WERKER_AUTH_SECRET=<BASE64 1>
WERKER_SECRET_KEY=<BASE64 2>
WERKER_SANDBOX_NAMESPACE=prod

Untick build time for the ones under "Runtime only".

  • WERKER_OWNER_DATABASE_URL is the database's own administrator. Paste the internal URL whole and unchanged. Its password is Coolify's, and matches none of the others.
  • <HOST> is everything after the @ in that URL, with the port and database name and without any ? part. If Coolify shows postgres://postgres:abc@xyz123:5432/postgres, it is xyz123:5432/postgres.
  • <HEX 1> and <HEX 2> are new passwords, used only here. pnpm start makes the tables and the two database users, and gives the users these passwords.
  • WERKER_SECRET_KEY encrypts stored provider keys. Keep a copy outside Coolify: without it they cannot be read.

5. Deploy and make your account

  1. Press Deploy, or push to the branch.
  2. Open https://app.example.com/setup. There is nothing to run on the server: the setup code is the WERKER_SETUP_CODE you put in Coolify.
  3. Choose your email and password. Do this soon after deploying, as setup stays open until an account exists.

6. Set it up in the app

  1. Admin → Sandboxes: choose Daytona or Docker Cloud Sandboxes and press Save, then add its key. The default is a Docker socket this container does not have, and its check fails with spawn docker ENOENT.
  2. Admin → Connections: add a model provider (connections).
  3. Admin → Email, if you want it: email.
  4. New: run something small. That tests the worker and the sandbox.

On 2026-11-30 a sandboxed run worked this way, and runs, connections and a project survived a redeploy. No run has been checked on the server set up on 2026-12-01.

7. Keep it running

  • Health check (the app's Healthcheck page): HTTP GET, port 3000, path /api/health, start period 30 seconds, then Enable and confirm.
  • Memory limit (Resource Limits): Werker's own is 4 GB.
  • Backups (the database's Backups page): add a schedule such as 0 3 * * *, and under Retention set how many to keep; 0 keeps them all. Run Back up now once and see that it succeeds.
  • A backup on the same server is lost with it, so add S3 storage. It does not hold /app/data, and provider keys in it cannot be read without WERKER_SECRET_KEY.

The limit and health check apply from the next deploy.

Moving to another server

Set up the new one beside the old, then point the domain at it. To stop the old application deploying on a push, set it to Manual deployments only (Advanced).

  • To reuse an emptied database instead, drop the public and auth schemas, then CREATE SCHEMA public and GRANT USAGE ON SCHEMA public TO PUBLIC. Without the grant the app cannot see its tables. This was rehearsed on a throwaway database.

How it differs from the Docker install

  • Web and worker run in one container, and both get every variable, including the master key and the database owner's URL.
  • pnpm start does not pass the stop signal on, so a redeploy cuts off running work.

What is not ready

  • A complete AI run on a fresh install has not been run with the install script. Install, first-administrator setup, and saving and testing a connection have. On Coolify a sandboxed run worked on 2026-11-30.
  • Public HTTPS from the install script: --domain has not issued a real certificate.
  • Upgrades and restore have not been rehearsed, and the Docker install has no scheduled backup or automatic upgrade.
  • Account recovery: there is no email or password recovery.
  • Postgres restarting stops the web app and worker, instead of them reconnecting.
  • One worker machine only: a run cannot move between machines.
  • Server size: no minimum has been established. The tested VPS is Ubuntu 24.04 on ARM64 with 8 GB RAM.

/api/health is not proof that an AI run works. A first run still needs a valid provider key, model access and, for code in Docker, a working gVisor runtime.

The Docker installation gives its sandboxes, cleanup labels and optional gateway their own names, so they do not collide with another Werker worker on the same Docker host.

This page as markdown apps/site/src/content/docs/self-hosting.md