Docs / Self-hosting

Doctor

Check your self-hosted installation with ocmgr doctor.

Overview

ocmgr doctor checks your installation. Run it after installation, upgrades or configuration changes. Run it when you investigate a problem.

Doctor runs every check, even after a failure. Each result reports ok, failed or skipped. Doctor skips checks for services you have not configured, such as email or backups. Failed and skipped results include a hint, and every result has a docs_url with more information.

Basics

Run it

Run doctor with either text or JSON output.

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

--json prints one object with ok, checks and summary. Each entry in checks has name, status, ok, detail, hint and docs_url. The command returns a non-zero exit status if any check fails. Scripts and agents can use this status to stop after a failure.

Other things doctor does

  • ocmgr doctor --init --out <file> writes a configuration file. --with-events adds secrets for event delivery. --public-url sets the public address. See Install with Docker.
  • ocmgr doctor --verify-restore <database-url> --manifest <file> checks a manually restored database. See Backups and restore.

What each check means

Settings and database

Check What it checks How to fix it
env Validates configuration values without printing them. Also rejects OCMGR_JUDGMENT_FAKE on a public instance. Correct the named value. Run doctor --init for missing values. Remove OCMGR_JUDGMENT_FAKE from public instances.
env_credentials Warns when the app and worker ignore configured connector variables, such as GITHUB_TOKEN. This warning does not change the exit status. Store credentials on the connection.
postgres Checks connectivity and requires Postgres 16 or newer. Check DATABASE_URL. Check the db container’s health.
db_password Rejects passwords that Datum publishes, such as change-me. Generate a password with doctor --init. For an existing database, change it with ALTER ROLE. Update POSTGRES_PASSWORD. Update DATABASE_URL.
extensions Checks for pg_trgm, pgcrypto and unaccent. Run create extension if not exists <name> as a superuser.
migrations Compares database migrations with the image. Run ocmgr migrate. The app also runs migrations at startup.
app_role Checks the app role and its inability to bypass row-level security. Run ocmgr migrate. Remove BYPASSRLS if the role has it.
rls Checks each workspace table’s row-level security and isolation policy. Restore the policies for the tables in the report. Manual changes usually cause this failure.
data_dir Checks that /data exists and the app user can write there. Correct the volume’s ownership.

Reaching the instance

Check What it checks How to fix it
public_url Requests OCMGR_PUBLIC_URL/healthz. Skips the check without this variable. Check DNS, the firewall and the proxy.
trusted_proxy Sends an external request to check OCMGR_TRUST_PROXY against the actual proxy configuration. Set the value in the hint. Use 1 behind one proxy. Leave it unset without a proxy.
egress_private Reports the outbound network policy. Warns if queue destinations remain available under deny. Set OCMGR_EGRESS_PRIVATE to the required policy.
link_host Asks each domain in OCMGR_LINK_POOL_HOSTS for its /healthz and checks it answers as this instance’s link domain. Skips when tracked links are off, the default. With links on and no pool hosts, reports ok because links use the instance host. Point the domain’s DNS at this instance and give it a certificate. Set OCMGR_PUBLIC_URL if the hint asks for it.

Signing in and agents

Check What it checks How to fix it
auth_secret Checks the secret’s length and rejects published values. Skips the check without a secret. Run doctor --init to generate a secret.
smtp Validates SMTP_URL. Without it, the app logs sign-in links. Set SMTP_URL before other users need email sign-in.
cookie_security Checks the public URL scheme against the address users access. Set the URL that users access. Use HTTPS behind a TLS proxy.
auth_role Checks that the sign-in role accesses only its own tables. Run ocmgr migrate to restore missing grants. Revoke extra grants that the report identifies.
agent_auth Checks HTTPS, the host root, external discovery documents and signing keys. Serve Datum at the host root over HTTPS. Allow /.well-known through the proxy.
signing_key Checks whether the current sign-in secret can unlock the key for agent tokens. Restore the previous OCMGR_AUTH_SECRET. See Credentials and security if you lost it.

Credentials, sources and pieces

Check What it checks How to fix it
vault Checks whether OCMGR_MASTER_KEYS can decrypt each workspace’s credentials. Restore the missing master key. Never replace an existing database’s keys with newly generated keys.
github_token, slack_bot_token Checks environment tokens with the vendor, including permission to read email addresses. Skips absent tokens. Issue a GitHub token with read:user. For Slack, reinstall the app with users:read.email.
pieces Checks installed pieces, package integrity and write access to their directory. Run ocmgr pieces list --json. Run ocmgr pieces install --json.
judgment Checks TYPESAFE_API_KEY with TypeSafe without sending community data. Skips the check without a key. Check the key.

Backups, events and billing

Check What it checks How to fix it
backup_target Checks backup availability, encryption and external storage. Requires a backup under 48 hours old. Skips the check without backup configuration. Configure Backups and restore.
backup_role Checks whether the backup role can read all workspaces. Checks that no other role has this access. Run the hint’s three statements as a superuser on managed Postgres.
restore_ready Checks whether a restore test could run. Normally skips the check without a private key. Rejects a key on the backup server. Keep the private key outside this machine.
outpost Checks connectivity, credentials and the delivery service’s restricted database role. Skips the check without OUTPOST_URL. Follow TLS and event delivery.
billing_polar Checks hosted billing configuration. Skips self-hosted instances. No action applies to self-hosted instances.

FAQ

Doctor skips every check. Does my installation have a problem?

A skipped check has nothing to inspect. New installations skip email, backups, event delivery and source tokens until you configure them.

Does doctor change anything?

Only --init changes files. It writes the configuration file. Other checks only read data.

Where do the docs links in the output go?

Each link opens the corresponding section of docs/setup.md in the repository. That guide explains each check in more detail.