Skip to content

Hub Installation

The hub is the central server hosting the backend API and the frontend.

Prerequisites

  • Docker and Docker Compose
  • An external Docker network named caddy
bash
docker network create caddy

docker-compose.yml

yaml
services:
  caddy-manager-api:
    image: cletus/caddy-manager-api:latest
    restart: unless-stopped
    environment:
      DATABASE_URL: /data/caddy-manager.db
      CADDY_API_URL: http://caddy:2019
      BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
      FRONTEND_URL: https://cadmin.example.com
    volumes:
      - caddy_manager_data:/data
      - /var/log/caddy:/var/log/caddy:ro
    networks:
      - caddy

  caddy-manager-ui:
    image: cletus/caddy-manager-ui:latest
    restart: unless-stopped
    environment:
      - VITE_API_URL=https://api.cadmin.example.com
    networks:
      - caddy

volumes:
  caddy_manager_data:

networks:
  caddy:
    external: true

Environment Variables

Backend (API)

VariableDescriptionExample
DATABASE_URLPath to the SQLite database/data/caddy-manager.db
CADDY_API_URLCaddy admin API URLhttp://caddy:2019
BETTER_AUTH_SECRETSession secret (required)A long random string
FRONTEND_URLFrontend URL (for CORS)https://cadmin.example.com

Frontend (UI)

VariableDescriptionExample
VITE_API_URLBackend API URLhttps://api.cadmin.example.com

First Launch

  1. Start the services:
bash
docker compose up -d
  1. Create the administrator account:
bash
docker compose exec caddy-manager-api node dist/db/seed.js

WARNING

Change the default password after the first login.

Reverse Proxy

Cadmin must be accessible behind a reverse proxy for HTTPS. Example Caddy configuration:

nginx
cadmin.example.com {
    reverse_proxy caddy-manager-ui:80
}

api.cadmin.example.com {
    reverse_proxy caddy-manager-api:3001
}