Docs

Team & admin

Self-hosting

Running Comity on your own single host with Docker Compose, for Enterprise pilots.

4 min readUpdated

On this page

Important

Self-hosting is available for Enterprise pilots, set up together with us. There is no self-serve installer, license or high-availability setup. Contact hello@comity.so to discuss a self-hosted deployment.

This page describes what the deployment consists of, so you can judge whether it fits your infrastructure.

What runs

Everything runs from one Docker Compose file on one Linux host (sized for 2 GB RAM plus 2 GB swap):

Service Role
postgres PostgreSQL 18. On an internal Compose network with migrate, api and worker only: not published, and caddy can't reach it.
migrate Applies database migrations on every start; api and worker start only after it succeeds.
api The REST API, MCP endpoint and webhooks receiver (port 8080, internal).
worker Background jobs: expiry sweeps, event partitions, notification delivery, GitHub and Notion sync, Stripe usage reports.
caddy TLS termination on ports 80/443 with automatic Let's Encrypt certificates; compresses JSON responses; serves the CLI tarball under /cli/.

Every container runs with no-new-privileges; the server processes run as an unprivileged user with no Linux capabilities and a read-only root filesystem.

The web dashboard (sign-in, browser login approval for comity login, Messages, Settings) is not part of this Compose stack; its address is configured with WEB_URL. Plan where it runs with us. Without it, developers sign in with tokens created by the admin command (comity login --token cmt_…).

The domain's DNS must point straight at the host (no proxying CDN in front): Caddy obtains its own certificate, takes the client IP (rate limits, audit logs) from the connection rather than from any forwarding header, and long-lived MCP and SSE streams must pass through unbuffered.

Configuration

A provisioning script writes /opt/comity/.env once with random database passwords and a master key. The server reads:

Variable Required Default Purpose
DATABASE_URL yes Superuser/owner connection, given to migrate and the admin commands only
SYS_DATABASE_URL yes System role comity_sys (bypasses row-level security, not a superuser: sign-in, background sweeps); Compose passes it to api and worker as their DATABASE_URL, and they refuse to start on a superuser
SYS_DB_PASSWORD yes Password migrate sets on comity_sys
APP_DATABASE_URL yes Application role comity_app, subject to row-level security
COMITY_MASTER_KEY yes 32 bytes, base64. Wraps every org's data key.
PUBLIC_URL for GitHub App, Notion, Slack DMs The API's public URL
WEB_URL https://comity.so Dashboard origin (CORS, invite and device-login links)
PORT / HOST 8080 / 0.0.0.0
LOG_LEVEL info
RESEND_API_KEY, EMAIL_FROM for email Email sign-up, password reset and invite emails
GITHUB_OAUTH_CLIENT_ID, GITHUB_OAUTH_CLIENT_SECRET for GitHub login
STRIPE_* no Billing; off unless STRIPE_SECRET_KEY is set
NOTION_CLIENT_ID, NOTION_CLIENT_SECRET for Notion A Notion public connection with the redirect URI <PUBLIC_URL>/v1/notion/callback, Read content and optionally Update content, no user information. Unset: Notion is off
NOTION_API_URL https://api.notion.com For tests and stand-ins only
SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, SLACK_SIGNING_SECRET for the Slack app Your Slack app (manifest and setup): redirect URL <PUBLIC_URL>/v1/slack/callback, interactivity <PUBLIC_URL>/v1/slack/interactivity, events <PUBLIC_URL>/v1/slack/events. Unset: no one-click Slack install and no DMs; channel posts work with a pasted incoming-webhook URL
SLACK_API_URL https://slack.com For tests and stand-ins only
EGRESS_ALLOW_PRIVATE false Allow webhook, Slack, SSO identity provider and GitHub Enterprise Server URLs on private networks (and plain http)
TURNSTILE_SITE_KEY, TURNSTILE_SECRET_KEY no Cloudflare Turnstile on sign-up, password reset, demo requests and repeated failed logins; off when unset
BACKUP_AGE_RECIPIENT, BACKUP_S3_* no Encrypted off-host backups (below)
COMITY_DOMAIN Caddy's site address

Caution

Back up COMITY_MASTER_KEY off the host and never change it in place. Losing it, or replacing it without re-wrapping the org keys, makes all encrypted content unreadable, including in backups.

First org

The server has an admin command instead of an admin UI. Bootstrapping prints the owner's token once:

Terminal
docker compose run --rm migrate node dist/server/admin.js bootstrap --org acme --name "Acme Inc" --email owner@acme.example

Other admin commands: create-member, create-token, and set-plan --org <slug> --plan <free|team|business|enterprise> [--developer-limit n|unlimited] [--repo-limit n|unlimited] (custom limits apply to Enterprise only).

Developers then install the CLI your server ships (the same package as on npm, at your server's version) and point it at your server:

Terminal
npm i -g https://comity.example.com/cli/comity-cli.tgz
comity login --server https://comity.example.com

comity update reads the release manifest from your server (/cli/latest.json), not from npm, so self-hosted machines update from your host and stay on its version. The CLI downloads the tarball, checks it against the manifest's sha256 and installs it only when they match. The tarball bundles all its dependencies, so installing it needs no access to the npm registry.

Backups

A systemd timer runs a pg_dump daily at 03:17 UTC to /opt/comity/backups/ and keeps 14 days. With BACKUP_AGE_RECIPIENT (an age public key whose private key stays off the host) and BACKUP_S3_ENDPOINT, BACKUP_S3_REGION, BACKUP_S3_BUCKET, BACKUP_S3_PREFIX, BACKUP_S3_ACCESS_KEY_ID and BACKUP_S3_SECRET_ACCESS_KEY set, each dump is encrypted and also uploaded to that S3-compatible bucket; until then the job logs that the upload was skipped, and unencrypted dumps are never uploaded. Give the bucket a 14-day expiry rule. deploy/restore-test.sh restores a backup into a throwaway container and checks it; run it monthly. A backup is only restorable together with the master key that was active when it was taken.

Every deploy rebuilds the images from freshly pulled base images (docker compose build --pull, docker compose pull postgres); rebuild monthly even without a release so the containers get OS patches.

Try Comity now.

Start free →

npm i -g comity-cli && comity login && comity init