Skip to content

Install

One compose file and two generated secrets. Everything else is entered in the browser. A host with no route to the internet installs from the release’s air-gap bundle instead: see installing without internet access.

  1. Clone the deploy repository into a directory named caddy-proxy-manager:

    Terminal window
    git clone https://github.com/CaddyProxyManager/deploy.git caddy-proxy-manager
    cd caddy-proxy-manager

    Keep that name. Compose names the project after the directory and the volumes after the project, so a different directory is a different, empty installation.

    It holds docker-compose.yml, .env.example and the few files they mount, one commit per release, with the images pinned to that release, so what you deploy stays on it until you pull. The managed CrowdSec container is included too, but stays off until you turn it on.

    Without git, download caddy-proxy-manager-<version>-deploy.tar.gz from the latest release instead and unpack it into that directory: it holds the same files.

    The deploy repository has four release channels:

    Branch Releases Database
    main Stable Bundled PostgreSQL
    next Stable and prereleases Bundled PostgreSQL
    nodb Stable External PostgreSQL; no bundled server
    nodb-next Stable and prereleases External PostgreSQL; no bundled server

    The clone starts on main. To choose another channel, switch branches before continuing, for example git switch nodb or git switch nodb-next.

  2. Generate SESSION_SECRET in .env:

    Terminal window
    echo "SESSION_SECRET=$(openssl rand -base64 32)" >> .env

    On main and next, also generate the bundled database password:

    Terminal window
    echo "POSTGRES_PASSWORD=$(openssl rand -base64 32)" >> .env

    On nodb and nodb-next, configure an external PostgreSQL server instead:

    Terminal window
    echo 'POSTGRES_HOST=db.example.com' >> .env
    echo "POSTGRES_PASSWORD=$(openssl rand -base64 32)" >> .env

    Replace the host with your server address. The default port, user, and database are 5432, cpm, and cpm; set POSTGRES_PORT, POSTGRES_USER, POSTGRES_DB, and POSTGRES_SSL to override them. These branches require an external PostgreSQL server; SQLite is not supported in production. Compose refuses to start without the host and password. Finish with chmod 600 .env to keep credentials private.

    SESSION_SECRET is also the key every secret in the database is encrypted under: DNS provider credentials, imported private keys, agent secrets. It cannot live in the thing it encrypts, so generate it once and keep it. To rotate it, put the old value in SESSION_SECRET_PREVIOUS for one restart, which re-encrypts everything under the new one; changing it without that makes them unreadable. A backup is sealed with a passphrase instead, so it restores onto an instance with a different one.

  3. Start it:

    Terminal window
    docker compose up -d

    On main and next, this also starts the postgres service the app keeps its data in. On nodb and nodb-next, the app connects to the external PostgreSQL server you configured.

    Caddy itself does not start yet. It sits behind a compose profile, and the agent starts it once the two are paired. An unpaired host answering 80 and 443 with a default page would be worse than one not listening at all.

  4. Open http://localhost:3000 and follow first run. Every URL redirects there until setup is finished; there is no administrator to sign in as until you create one.

Everything else is a field on the first run setup page, and afterwards on Settings: the base URL, OAuth, analytics, GeoIP, the dashboard host. Those values are stored in the database rather than in a file, encrypted at rest where they are secrets, and they win over anything .env says.

Prefer that over writing variables by hand. Setup makes you sign in before the rest of the configuration is entered, so a mistyped password shows up immediately rather than at the end. It shows the exact OAuth callback URL to register, which is derived and hard to guess. A credential saved there reaches docker compose in the environment of the command the agent runs, instead of sitting in plaintext on the host for as long as the file exists.

.env.example is the reference for everything else: every variable that exists, what it defaults to, and whether Settings owns it. Read it when you need something setup does not cover: a PostgreSQL server other than the bundled one, a larger connection pool, a private CA for the agent, a deployment with no agent at all. Append the one line you need; there is no reason to carry the rest.

Port What
3000 The dashboard and API. Published so you always have a way in
80 / 443 Caddy, once it is running
2019 Caddy’s admin API. Bound only on the internal caddy-admin network, which web and the agent share and nothing can publish

Pull, then restart on the images the new compose file names:

Terminal window
git pull
docker compose pull
docker compose up -d

main and nodb carry stable releases only. Use next or nodb-next to follow prereleases too; every release is also a tag, so git checkout v3.6.1 pins one.

Settings reports when a newer release is published to the registry you pull from. It can be switched off; the only other requests the app makes to the internet on its own are the CRS plugin registry check and the GeoIP downloads, each with a switch of its own.

Put them in docker-compose.override.yml beside docker-compose.yml, never in the tracked files. Compose merges it over the base file, the agent applies it when it starts Caddy, and git ignores it along with .env, so git pull never stops on a conflict.

docker-compose.override.yml
services:
web:
ports: !override
- "127.0.0.1:3000:3000"

An install unpacked from a release archive becomes a clone in place, keeping its directory and so its data. Fetch first, and diff your compose file against the release you are on to find what you changed:

Terminal window
git init -b main
git remote add origin https://github.com/CaddyProxyManager/deploy.git
git fetch origin --tags
git show v3.6.1:docker-compose.yml | diff - docker-compose.yml # your release

Move every difference into docker-compose.override.yml, then take the repository’s files:

Terminal window
git checkout -f -B main origin/main
docker compose pull
docker compose up -d

.env and the override are untouched: neither is tracked. Every release from 3.0.0 on is a tag.

Up to 3.6.1 the images were published as ghcr.io/silentspud/caddy-proxy-manager/{web,caddy,agent}; later releases are ghcr.io/caddyproxymanager/{web,caddy,agent}. The old images stay where they are, so nothing stops working. An install older than 3.6.1 is never told about a newer release, though, because it checks the old namespace. Moving to the deploy repository, as above, changes every image name at once.

The bundled database went from PostgreSQL 17 to 18 during the 3.0 release candidates. PostgreSQL does not read another major version’s data files, so this one upgrade is a dump and restore rather than a pull. It applies if your docker-compose.yml still says image: postgres:17-alpine.

Nothing is lost by getting the order wrong. The 18 service refuses to start on a volume that still holds a 17 cluster: it restarts with an error naming the version, and the data stays where it was. If you already updated the compose file, put the two old lines back for the first step: image: postgres:17-alpine, and the volume mounted at /var/lib/postgresql/data.

  1. With the old compose file, stop the app and dump its database from the 17 server:

    Terminal window
    docker compose stop web
    docker compose exec postgres sh -c 'pg_dump -U "$POSTGRES_USER" -d "$POSTGRES_DB" --format=custom --file=/tmp/cpm.dump'
    docker compose cp postgres:/tmp/cpm.dump ./cpm.dump

    The dump is copied out rather than redirected to a file, so it arrives intact from any shell. PowerShell’s >, for one, re-encodes what passes through it. Keep cpm.dump until you have signed in afterwards.

  2. Unpack the new release’s archive over the old files, then remove the containers and the 17 volume:

    Terminal window
    docker compose down
    docker volume rm caddy-proxy-manager_postgres-data

    down without -v leaves every other volume alone, certificates included. The database volume is named after the Compose project, which is the directory the compose file is in unless COMPOSE_PROJECT_NAME says otherwise; docker volume ls shows it.

  3. Start PostgreSQL 18, restore into it, and bring the rest back:

    Terminal window
    docker compose up -d --wait postgres
    docker compose cp ./cpm.dump postgres:/tmp/cpm.dump
    docker compose exec postgres sh -c 'pg_restore -U "$POSTGRES_USER" -d "$POSTGRES_DB" --exit-on-error /tmp/cpm.dump && rm /tmp/cpm.dump'
    docker compose up -d

    Accounts, hosts, certificates and settings come back as they were, and you sign in with the same password. Migrations that already ran are recorded in the dump, so none of them run again.

A server you run yourself (POSTGRES_HOST) is unaffected: the app supports 17 and 18 alike, and when to upgrade it is yours to decide.

.env and docker-compose.override.yml are deliberately untracked by the deploy repository, so your changes never conflict with a release. To version them anyway, make the deploy repository a submodule of a repository of your own. A parent repository cannot track a file inside a submodule, so the override lives in the parent, and COMPOSE_FILE tells Compose and the agent where:

my-config/ your repository
├── docker-compose.override.yml tracked here
└── caddy-proxy-manager/ the deploy repository, as a submodule
├── .env ignored by the submodule, never tracked
└── docker-compose.yml
  1. Add the submodule under the same directory name as a clone, since the name is the project’s:

    Terminal window
    git submodule add -b main https://github.com/CaddyProxyManager/deploy.git caddy-proxy-manager
  2. Create .env inside caddy-proxy-manager/ as in installation, and add the list of compose files to it:

    Terminal window
    echo "COMPOSE_FILE=docker-compose.yml:../docker-compose.override.yml" >> caddy-proxy-manager/.env

    Compose reads it from .env in place of looking for an override beside docker-compose.yml. On a Windows host, separate the two with ; instead.

  3. Let the agent see the parent. It recreates Caddy from the same list, resolved against its own mount of the project, where ../ leads outside the mount. Mount the parent and point the agent at the project inside it, in the override itself:

    docker-compose.override.yml
    services:
    agent:
    environment:
    COMPOSE_DIR: /config/caddy-proxy-manager
    volumes:
    - ..:/config:ro

    Without this the agent logs that it cannot find the override and recreates Caddy without your changes. A directory rather than the file alone: a single-file mount keeps the file an editor replaced on save, not the new one. The agent can read the whole parent, so keep nothing there it should not. An agent older than this release ignores COMPOSE_FILE.

  4. Run docker compose from caddy-proxy-manager/, where .env is.

Commit .env to neither repository in plaintext. SESSION_SECRET decrypts every secret in the database, and without it those cannot be recovered, so keep it in a password manager or encrypt it into the parent with sops or git-crypt. Only SESSION_SECRET and POSTGRES_PASSWORD need to be secret; anything else can sit in the override’s environment: blocks, though most settings live in the database by now.

To upgrade, move the submodule to the newest release and commit the new pointer, which records in your history which release each change ran on:

Terminal window
git submodule update --remote caddy-proxy-manager
git commit -am "Caddy Proxy Manager $(git -C caddy-proxy-manager describe --tags)"
cd caddy-proxy-manager
docker compose pull
docker compose up -d

On a new machine, git clone --recurse-submodules, then recreate .env: it is in no repository.

Before 3.0 the configuration lived in .env, and installing meant copying the whole reference over and editing it:

Terminal window
cp .env.example .env

It still works. Resolution order is stored value → .env → built-in default, so a variable set there is honoured and still beats the default. Once the same setting is saved in the app, the stored value wins and the line can be deleted.

A new install rarely needs it. Most settings live in the database, so a copied .env.example is mostly commented-out lines that duplicate what the setup page asks for anyway, and every secret written into it is a plaintext copy the Settings path would not have made. Use it when you provision unattended and no browser can reach the setup page: setting both ADMIN_USERNAME and ADMIN_PASSWORD seeds an administrator at startup and skips the flow entirely.