Install and operate

Put one executable and one PostgreSQL database on your servers and stand them in front of your Git server. The optional GitHub or GitLab gate needs access to the configured API.

Requirements

  • A Linux x86_64 server and PostgreSQL.
  • JDK 17 to check behavior in Java repositories. Analyzers run as isolated subprocesses.
  • An isolated executor for cases. It must be able to start a container from a Java 17 image the operator pinned.
  • A path outside the database for the signing key, and a separate path for exporting the record's copy.
  • A dedicated OurDoc service account on your Git server. It must be the only account that can write the protected branch.

Steps

1. Database. Set OURDOC_DATABASE_URL to the table owner's connection and apply the migrations.

ourdoc admin migrate

2. Systems and repositories. Register each business system and its repositories.

ourdoc admin register-system --system-id payments --name Payments
ourdoc admin register-repository --system-id payments --repository-id payments-git --name payments --approval-config installation.json

3. Installation file. In installation.json, set authentication, the policy profile per system, the signing key and the record export interval. For Git, set per repository the address of your server and the service account's credential file, the protected branch and its current tip, the check depth (files or behavior), the case executor and any standing plans.

4. Server. Start the server under the runtime role. It listens on 127.0.0.1:8080 by default, with TLS terminated in front of it.

ourdoc serve --approval-config installation.json

5. Git server. Your Git server's administrator restricts writes to the protected branch to the OurDoc service account alone, and tests that an ordinary developer cannot write it directly. Start with the file-level check, and turn on the behavior check after watching how far it reaches on the real repository.

Configure the GitHub PR gate

Enable the gate per entry in git_gateway.repositories. After installation the operator sets up branch protection, the service account and the webhook on GitHub. Reserve writes to the protected branch for the OurDoc service identity.

  • Set github.api_base_url and github.web_url to https://api.github.com and https://github.com. For GitHub Enterprise Server, use the corresponding URLs such as https://ghe.example/api/v3 and https://ghe.example. GitHub API requests go only to the configured API base. Git authentication follows the separate upstream configuration.
  • Set owner, repository and provider_repository_id to the GitHub owner, repository name and stable numeric repository ID. In authors, map stable numeric GitHub user IDs to existing OurDoc human IDs with the Author role in that system.
  • Store the raw API token of a dedicated GitHub service account in token_file. Grant the token pull request read, commit status write and issue comment write permissions for the repository.
  • Store a random secret of at least 32 bytes in secret_file and use the exact file contents as the GitHub webhook secret. Send pull request events as JSON POST requests to /api/v1/github/{system}/{repository}/webhook on the OurDoc HTTPS origin, using the registered OurDoc IDs. OurDoc verifies the HMAC-SHA256 signature and processes opened, synchronize and reopened.

See how to submit and resubmit a GitHub PR.

Configure the GitLab MR gate

For GitLab Self-Managed Free, add a gitlab object to the matching entry in git_gateway.repositories. Each repository route can use one provider, GitLab or GitHub.

  • Set api_base_url and web_url to the same GitLab instance, for example https://gitlab.example/api/v4 and https://gitlab.example. API requests go only to the configured address. For a private CA, set the optional ca_file to a PEM CA bundle.
  • Set project_path to the full path, such as namespace/subgroup/project. Set project_id to the stable numeric project ID. In authors, map numeric GitLab user IDs to installed OurDoc human identities with the Author role in that system.
  • Store a project or group access token with the api scope in token_file. Give it the Developer role or another role that can write external commit statuses and MR notes.
  • Use a separate Git credential for upstream, which points to the same project. Reserve writes to the protected branch for the OurDoc service identity. See GitLab deploy key permissions.
  • Store a random secret of at least 32 bytes in secret_file and use the exact value as the project webhook's Secret token. Keep TLS verification enabled and turn on Merge request events. GitLab sends JSON via HTTP POST to /api/v1/gitlab/{system}/{repository}/webhook on the OurDoc HTTPS origin, using the registered OurDoc IDs. OurDoc checks X-Gitlab-Token against the configured secret.

See how to submit and resubmit a GitLab MR.

The first administrator

In the authentication file, list the operator's account identifier, display name, sign-in key hash and the systems they run. At startup the server grants that account only the administrator role for those systems and signs the grant into the record. The administrator grants author, approver and auditor roles separately.

Checks while running

/healthz answers whether the server is up. Check the record with ourdoc admin verify-ledger and the stored snapshot packs with ourdoc admin verify-store. If OurDoc stops, reads still go straight to your server, so only merges stop.

Configure Subversion hooks

Configure each repository UUID, dedicated token file, and mapping from authenticated SVN authors to OurDoc Authors in svn_gateway.repositories. Install the pre-commit and post-commit hooks on the SVN server and point them at OurDoc's HTTPS origin. See SVN submission and retry.

Configure a post-integration test

Set post_integration_test on the repository's git_gateway.repositories entry. Specify a test command registered in case_runner with the json_line_v1 report format. See post-integration results and rollback drafts.