how-to deployer

Runbook — External Docs Portal (docs.opengov.systems)

Summary

The external docs portal publishes operator, administrator, integrator, and security documentation at https://docs.opengov.systems. It runs as a standalone static web application on Coolify, separate from the opengov runtime image. A merge to main that edits allowlisted documentation triggers a rebuild and polls /version.txt until the new content serves live.

How the Build Works

FileRole
docs/portal/manifest.yamlExplicit allowlist of external pages, sections, and metadata.
scripts/docs/generate_reference_docs.pyGenerates four code-owned reference pages under docs/reference/_generated/.
scripts/docs/stage_portal_content.pyStages allowlisted Markdown, strips internal markers, and rewrites links.
scripts/docs/check_docs_portal.pyChecks manifest rules, links, anchors, redaction denylist, and L-8 compliance.
deploy/docs-site/DockerfileBuilds Hugo and Pagefind assets and serves them via nginx-unprivileged.
deploy/docs-site/nginx.confServes static assets on port 8080 with strict security headers.
deploy/docs-site/40-docs-password.shEnables optional HTTP basic auth when DOCS_SITE_PASSWORD is non-empty.
deploy/docs-site/digest.shComputes deterministic SHA-256 digests for staged and site trees.
scripts/docs_site_deploy.shQueues a Coolify deploy and polls /version.txt until digests match.
.github/workflows/docs-site.ymlRuns scripts/docs_site_deploy.sh on main when portal sources change.

version.txt holds two lines: staged <sha256> and site <sha256>. The deploy script stages the checkout into a temporary directory and computes the same two digests before polling Coolify. This workflow never writes the sandbox deploy-window marker.

Local Preview and Checks

  1. Run make docs-generate to refresh generated reference pages.
  2. Run make docs-check to test the manifest, links, and redaction rules.
  3. Run make docs-serve to stage content and start hugo server locally on port 1313.

One-Time Coolify Setup

The host administrator configures the Coolify application once:

  1. Open Coolify and create a new application from the OpenGov repository on branch main.
  2. Set the build pack to Dockerfile and the base directory to /.
  3. Set the Dockerfile location to /deploy/docs-site/Dockerfile.
  4. Set the container port to 8080 and the domain to https://docs.opengov.systems.
  5. Set the health check path to /version.txt.
  6. Leave automatic deploy on push disabled.
  7. Leave DOCS_SITE_PASSWORD empty for public access, or set a password for preview gating.
  8. Deploy the application once from the Coolify console.
  9. Save the application UUID in the GitHub repository variable COOLIFY_DOCS_APP_UUID.

Verifying a Live Deploy

Run these three checks against the deployed host:

  1. Check /version.txt returns HTTP 200 with staged and site SHA-256 digests.
  2. Check the Content-Security-Policy header includes script-src 'self' 'wasm-unsafe-eval'.
  3. Open the homepage in a browser and search with the search box to test Pagefind WebAssembly loading.

Troubleshooting

  1. If stage_portal_content.py fails on markers, check `` pairs in the named source file.
  2. If check_docs_portal.py fails on a denylist term, wrap internal notes in strip markers or replace placeholders.
  3. If docs_site_deploy.sh times out waiting for /version.txt, inspect the Coolify build log for checksum or stage errors.