# Cloudhal self-hosted (docs/guides/self-host.md): Studio, the API and the MCP endpoint in one # container, every file on the `cloudhal-data` volume. Copy .env.example to .env, then # docker compose up -d Studio on http://localhost:8787 # docker compose --profile caddy up -d + Caddy with automatic TLS for CLOUDHAL_BASE_URL # (Studio) and CLOUDHAL_SITE_URL (the built site) services: cloudhal: image: ghcr.io/cloudhal-dev/cloudhal:${CLOUDHAL_TAG:-latest} restart: unless-stopped # Bound to this machine unless CLOUDHAL_BIND says otherwise; with the caddy profile the proxy # is the way in. ports: - "${CLOUDHAL_BIND:-127.0.0.1}:${CLOUDHAL_PORT:-8787}:8787" environment: # The origin browsers open Studio at, which sign-in is tied to (.env.example). No default on # purpose: empty, sign-in accepts the browser's own address and the log warns; behind a proxy # (CLOUDHAL_BEHIND_PROXY=1) it is required, and Studio refuses to start without it. - CLOUDHAL_BASE_URL=${CLOUDHAL_BASE_URL:-} - CLOUDHAL_BEHIND_PROXY=${CLOUDHAL_BEHIND_PROXY:-0} - CLOUDHAL_INIT=${CLOUDHAL_INIT:-blog} - CLOUDHAL_SITE_NAME=${CLOUDHAL_SITE_NAME:-My site} # The public site's origin: `site-build` writes its host into canonical links, the sitemap # and feeds (cloudhal.json `domains.site`); with the caddy profile Caddy serves the site there. - CLOUDHAL_SITE_URL=${CLOUDHAL_SITE_URL:-} # Rebuild the public site on every publish, and once at start (#150); `off` when the site is # built elsewhere (CI, another host). `site-build` by hand or from cron works either way. - CLOUDHAL_SITE_BUILD=${CLOUDHAL_SITE_BUILD:-on} - CLOUDHAL_AUTOMATIONS=${CLOUDHAL_AUTOMATIONS:-on} - CLOUDHAL_TRUSTED_ORIGINS=${CLOUDHAL_TRUSTED_ORIGINS:-} # Remote MCP clients (RFC-0044; docs/guides/mcp-oauth.md): `off` turns OAuth, metadata # documents or dynamic registration off; the host list limits where clients come from. - CLOUDHAL_MCP_OAUTH=${CLOUDHAL_MCP_OAUTH:-on} - CLOUDHAL_MCP_CIMD=${CLOUDHAL_MCP_CIMD:-on} - CLOUDHAL_MCP_DCR=${CLOUDHAL_MCP_DCR:-on} - CLOUDHAL_MCP_CLIENT_HOSTS=${CLOUDHAL_MCP_CLIENT_HOSTS:-} - CLOUDHAL_MCP_REDIRECT_SCHEMES=${CLOUDHAL_MCP_REDIRECT_SCHEMES:-} # Secrets. A name without a value is passed through from .env or the shell only when it is # set there, so an unset BETTER_AUTH_SECRET leaves the container with the secret it created # on the volume (/data/.cloudhal/auth-secret). Never set it to an empty value. - BETTER_AUTH_SECRET # The first owner's setup token; empty: one is generated at each start while there is no # account, and the setup link is printed to the logs. - CLOUDHAL_SETUP_TOKEN=${CLOUDHAL_SETUP_TOKEN:-} - CLOUDHAL_AI_TOKEN - CLOUDFLARE_ACCOUNT_ID volumes: - cloudhal-data:/data caddy: profiles: [caddy] image: caddy:2.11 restart: unless-stopped depends_on: - cloudhal ports: - "80:80" - "443:443" - "443:443/udp" environment: - CLOUDHAL_BASE_URL=${CLOUDHAL_BASE_URL:-} - CLOUDHAL_SITE_URL=${CLOUDHAL_SITE_URL:-} # Both origins are required for this profile. They are checked here, when Caddy starts, rather # than with `:?` interpolation, which would fail `docker compose up` for everyone who never # uses Caddy. command: - sh - -c - | if [ -z "$$CLOUDHAL_BASE_URL" ] || [ -z "$$CLOUDHAL_SITE_URL" ]; then echo "caddy: the caddy profile needs CLOUDHAL_BASE_URL and CLOUDHAL_SITE_URL in .env (https://… origins)" >&2 exit 1 fi exec caddy run --config /etc/caddy/Caddyfile --adapter caddyfile volumes: - ./Caddyfile:/etc/caddy/Caddyfile:ro # the built site at /data/dist (from 0.6.4 a symlink to /data/site/current, the newest # build; /data/site/previous is the one before), read-only here - cloudhal-data:/srv/cloudhal:ro - caddy-data:/data - caddy-config:/config volumes: # The installation. Named outright, so that this stack, `docker run -v cloudhal-data:/data …` and # the guide's backup commands share one volume whatever the compose project is called. A stack # created with the compose file of 0.6.3 has `_cloudhal-data` (`docker volume ls`): set # CLOUDHAL_VOLUME to that name in .env to keep it (the guide, "Backup and restore"). A second # stack on the same host must set a CLOUDHAL_VOLUME of its own: one volume, one container. cloudhal-data: name: ${CLOUDHAL_VOLUME:-cloudhal-data} caddy-data: caddy-config: