Docs / Self-hosting

TLS and event delivery

Enable HTTPS and outbound event delivery with optional Docker Compose profiles.

Overview

The base stack runs Postgres and the app. The app listens on 127.0.0.1:3000. Two optional Compose profiles add services:

  • tls adds Caddy for HTTPS on ports 80 and 443. Caddy obtains its own certificate.
  • events adds Outpost, Redis and RabbitMQ for outbound event delivery to webhooks and queues.

Compose starts a profile only when you name it. Name yours once in deploy/.env, and every plain docker compose -f deploy/docker-compose.yml up -d on the other pages starts it too:

COMPOSE_PROFILES=tls,events

List only the profiles you use. Add events only after you start it once with the steps below. Its first start must come after the app’s migration. The VPS installer writes this line for --domain and --with-events. Without this line, add --profile tls or --profile events to every command that starts the stack. A plain up -d recreates the app but leaves Caddy and Outpost on their old settings.

TLS

You need a domain that points to the server. Ports 80 and 443 must accept internet connections.

  1. Set the address

    Add the following settings to deploy/.env.

    OCMGR_PUBLIC_HOST=ocmgr.example.com
    OCMGR_PUBLIC_URL=https://ocmgr.example.com
    OCMGR_TRUST_PROXY=1

    These settings specify the domain, public URL and one trusted proxy.

  2. Start Caddy

    Start the TLS profile.

    docker compose -f deploy/docker-compose.yml --profile tls up -d

    Caddy waits for a healthy app before it requests a certificate. The first certificate can take a minute.

  3. Check HTTPS

    Check the health endpoint. Run doctor.

    curl -s https://ocmgr.example.com/healthz
    docker compose -f deploy/docker-compose.yml exec -T app ocmgr doctor --json

    The public_url, trusted_proxy, cookie_security and agent_auth checks should pass. A failed check’s hint identifies problems with DNS, the firewall or the certificate.

Disable the profile if you use another proxy, such as nginx. Point that proxy at 127.0.0.1:3000. Set the same three variables. Serve Datum at the root of a host or subdomain.

Agents cannot connect through a path such as https://example.com/ocmgr.

Event delivery

Datum records changes in its event log regardless of this profile. Integrations can read the log through polling without a delivery service. The events profile sends events to the webhooks and queues in Event destinations.

Outbound webhooks require this profile. Until it runs, Settings → Destinations reports that webhook delivery is off. The How to switch it on ↗ link opens this page.

Datum continues recording events while delivery is off. Delivery starts automatically when the profile runs. Earlier events require an owner to publish that history.

The following steps generate secrets in deploy/.env and start the required containers.

  1. Generate the secrets

    Run doctor --init with --with-events.

    docker run --rm --user "$(id -u):$(id -g)" -v "$PWD/deploy:/env" \
      --entrypoint ocmgr ocmgr:local \
      doctor --init --with-events --out /env/.env --json

    The command adds six secrets and the delivery service address. It preserves existing values.

  2. Restart the app first

    Restart the app.

    docker compose -f deploy/docker-compose.yml up -d app

    At startup, the app creates a database login for the delivery service. This login accesses only the service’s own schema.

  3. Start the profile

    Start the events profile.

    docker compose -f deploy/docker-compose.yml --profile events up -d

    A check container prevents startup if any secret is missing. Its output names the missing secret.

  4. Check event delivery

    Run doctor.

    docker compose -f deploy/docker-compose.yml exec -T app ocmgr doctor --json

    The outpost check verifies connectivity, credentials and the service’s restricted database role.

Back up OUTPOST_AES_SECRET with your other keys. It encrypts destination credentials and signing secrets. Losing it requires you to configure every destination again.

Topics the delivery service accepts

The Compose file sets the delivery service’s TOPICS list. It includes every event topic, an mcp. copy of each native topic for agent subscriptions, mcp.member.sent and mcp.organisation.sent.

mcp.member.sent and mcp.organisation.sent let an owner send a member or an organization to an agent subscription. Without them, agents cannot subscribe to member.sent or organisation.sent, and sends to a subscription fail.

Keep the TOPICS value from the current deploy/docker-compose.yml if you edit your copy or run the delivery service elsewhere.

Where events can go

The delivery service uses a separate egress proxy. The proxy rejects private, loopback, link-local and cloud metadata addresses at every hop. It permits public internet destinations.

Set OCMGR_EGRESS_PRIVATE=allow to permit destinations on your network. The service retains delivery logs for 30 days.

FAQ

Do I need the events profile?

You need it only to send events to webhooks or queues. Polling, Slack routing and CRM sinks work without it.

Can I add a profile later?

Yes. You can add or remove either profile on an existing installation. Removing events stops delivery. Datum continues recording events.

The VPS installer has flags for these. Are they the same?

Yes. install.sh --domain enables tls and sets the three address variables. --with-events enables events. See Deploy to a VPS, Render or Fly.