# CoreScope — split containers: the UI in its own web container and the # server in the usual image. # # The web container (Dockerfile.web, Caddy) serves the static UI and forwards # /api and /ws to the server, so both share one origin: no CORS settings. With # user management on, set the server's userManagement.publicBaseUrl to the web # container's public origin (scheme and port included): logins and other # writes are checked against it. The server container is unchanged and still # serves everything, the classic UI included, on port 3000 inside the compose # network; publish it too if you want to reach that directly. For per-IP # limits, the server trusts the web container's fixed address: see networks. # # Usage: CORESCOPE_IMAGE=ghcr.io/kpa-clawbot/corescope:edge \ # docker compose -f docker-compose.split.yml up -d --build # Docs: docs/deployment.md, "Deployment modes" # # Variables (shell or .env): # CORESCOPE_IMAGE required: the server image of the same version as this # checkout, which the web image is built from. :edge on # master, :vX.Y.Z on a release tag. There is no default, so # a release server is never paired with a newer UI unasked. # DATA_DIR the server's data directory. Default ./data # HTTP_PORT default 80; HTTPS_PORT default 443 (TCP and UDP) # SITE_ADDRESS :80 (default), or a domain name for automatic HTTPS, which # needs the default ports: certificate issuance and the # HTTP/3 advertisement both assume 80 and 443 # GIT_COMMIT the UI's cache buster; default the build time # CHANNEL static (default), or beta, next, dev for a badge # MQTT_BIND where the server's built-in broker is published. Default # 127.0.0.1: it accepts anonymous clients, so set 0.0.0.0 # only to let gateways on a network you trust publish to it. # MQTT_PORT default 1883 # SPLIT_NET the compose network's /24, as its first three octets. # Default 172.30.83, which puts the web container at # 172.30.83.200. Change it only if Docker reports that the # pool overlaps another network, and update the server's # trustedProxies to match. services: corescope: image: ${CORESCOPE_IMAGE:?set CORESCOPE_IMAGE to the server image of this checkout's version, e.g. ghcr.io/kpa-clawbot/corescope:edge on master or :vX.Y.Z on a release tag} ports: - "${MQTT_BIND:-127.0.0.1}:${MQTT_PORT:-1883}:1883" volumes: - ${DATA_DIR:-./data}:/app/data environment: - DISABLE_CADDY=true - DISABLE_MOSQUITTO=${DISABLE_MOSQUITTO:-false} restart: unless-stopped healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/healthz"] interval: 30s timeout: 5s retries: 3 web: build: context: . dockerfile: Dockerfile.web args: GIT_COMMIT: ${GIT_COMMIT:-} CHANNEL: ${CHANNEL:-static} image: corescope-web:latest ports: - "${HTTP_PORT:-80}:80" - "${HTTPS_PORT:-443}:443" # HTTP/3: Caddy advertises it on 443 when SITE_ADDRESS is a domain. - "${HTTPS_PORT:-443}:443/udp" volumes: - web-caddy-data:/data environment: - BACKEND=corescope:3000 - SITE_ADDRESS=${SITE_ADDRESS:-:80} networks: default: # The one address the server's trustedProxies lists; see networks. ipv4_address: "${SPLIT_NET:-172.30.83}.200" depends_on: - corescope restart: unless-stopped networks: # A fixed subnet gives the web container a fixed address, so the server's # webSocket.trustedProxies and userManagement.trustedProxies can list it # alone (172.30.83.200 by default) and still match after a recreate. Never # list the whole subnet: it holds the gateway address too, and a client # that reaches a published port 3000 through Docker's proxy arrives from # there, so its own X-Forwarded-For would be believed. default: ipam: config: - subnet: "${SPLIT_NET:-172.30.83}.0/24" # Automatic addresses come from the lower half, so no container # can take the web container's. ip_range: "${SPLIT_NET:-172.30.83}.0/25" volumes: # Caddy's TLS certificates when SITE_ADDRESS is a domain name. web-caddy-data: