Skip to content

Host the PR Hygiene service: one container + SQLite on a dash.org subdomain #90

Done

Description

@shumkov

Summary

Please host the PR Hygiene service, a small Rust web service with a SQLite database, on a dash.org subdomain. It serves the PR review dashboard, a public read API that the team's /prs skill and Slack digest read, and GitHub sign-in that lets each person see their own review speed.

It belongs with the permanent shared services in #21 (dash-infra Terraform).

Background

  • What it is. PR Hygiene runs the review policy on dashpay/platform, rust-dashcore, tenderdash, grovedb and dash-evo-tool: who must review what, and whether a PR is ready. The engine runs in GitHub Actions today. The dashboard is an interim page on GitHub Pages (https://dashpay.github.io/stale_prs_are_bad/).
  • Code: dashpay/stale_prs_are_bad, directory service/. Run details are in service/README.md.
  • Stage 1, this request, is read-only. The service holds no credential with access to any repository. GitHub Actions in our repo pushes data to it every 15 minutes, authenticated with a GitHub Actions OIDC token that the service verifies.
  • Stage 2 is later, a separate request. It's described below so you can plan the hosting with it in mind.

What's needed now (stage 1)

Image docker build -f service/Dockerfile . from the repo root. Distroless, runs as uid 65532.
Process pr-hygiene-service serve, plain HTTP on port 8080
Hostname a dash.org subdomain, e.g. pr-hygiene.dash.org (your naming), with TLS terminated in front
Storage a persistent local volume at /data for SQLite in WAL mode. Not NFS, SMB or EFS: WAL needs real file locks, and the service refuses to start without them. Small: we expect well under 1 GB.
Backup daily
Inbound HTTPS from the internet: POST /ingest comes from GitHub-hosted runners, which have no fixed IPs, and GET /api/v1/* and the page are public
Outbound HTTPS to token.actions.githubusercontent.com, github.com and api.github.com
Secrets the GitHub sign-in App's client secret, as a mounted file. This is optional at first: without it the service runs with sign-in off.
Health GET /healthz (liveness) and GET /readyz (readiness)
Restart restart on crash
Deploys an image built from protected master only, deployed on merge, with no ticket per release. The deploy could use GitHub Actions OIDC to AWS, matching the github-oidc module in #21.

The reverse proxy must also (details in the README):

  • time out slow and idle connections;
  • cap connections and rate-limit /api/v1/* per client, with tighter limits on /auth/* and /api/v1/me*;
  • pass POST /ingest through with a body limit no larger than 1 MB;
  • pass the Origin header through unchanged;
  • never log Authorization, Cookie or Set-Cookie, or the query string of /auth/callback.

Load is light. Ingest is one POST of about 110 KB every 15 minutes. The public reads come from the team, its tools and the dashboard page. We haven't measured CPU or memory under load yet, and will in the first week.

Stage 2, later (for planning only, not requested yet)

When the Rust engine takes over from the Actions one, the same image runs a second process: a worker.

  • It runs as its own container with no inbound port, and holds a GitHub App private key: read-only first, write access at cut-over. A non-exportable KMS key is preferred if available.
  • The front container receives GitHub webhooks.
  • The worker keeps its own SQLite file on its own local volume.
  • At cut-over the worker becomes merge-critical. It posts the required PR Hygiene status on the five repos, so while it's down PRs can't turn green. That needs alerting on webhook delivery failures, queue age, and the time since each PR was last checked.

Questions

  1. Where should it run: AWS dashdev under the dash-infra Terraform project from Create dash-infra Terraform project for shared services #21, or somewhere else?
  2. Which subdomain?
  3. Which deploy mechanism do you prefer, and who owns the image registry?
  4. Backups: is the provider's volume snapshot enough, or do you want a separate copy?

Once you give us the URL, we set PR_HYGIENE_SERVICE_URL in our repo and start posting data to it.

Related

Activity

  1. shumkov commented on Nov 20, 2026

    @shumkov
    Author

    @dashinfraclaw please pick this up. It's overdue: filed on Oct 7, no reply yet.

    The minimum to start is stage 1 as described above:

    • one read-only container: pr-hygiene-service serve, plain HTTP on port 8080;
    • a persistent local volume at /data for SQLite (not NFS/EFS), with daily backups;
    • a dash.org subdomain with TLS in front, and the reverse-proxy limits from the request.

    It holds no credential with access to any repository. Build and run details are in service/README.md.

    Please reply here with:

    1. who hosts it and where;
    2. the hostname;
    3. when it can be up;
    4. anything in the request that blocks you or should change.

    Once it's up, we set PR_HYGIENE_SERVICE_URL in dashpay/stale_prs_are_bad and the ingest job starts posting to it.

  2. ktechmidas commented on Nov 20, 2026

    @ktechmidas
    Contributor

    Picked up. Stage 1 hosting is in place; the service goes live when dashpay/stale_prs_are_bad#120 merges.

    Answers to the four questions:

    1. Where: AWS dashdev, us-west-2, one small ARM64 EC2 instance with a local EBS volume for SQLite. Terraform is in feat: Terraform for the PR Hygiene service and services.dash.org #92 (the first piece of Create dash-infra Terraform project for shared services #21) and is applied.
    2. Subdomain: https://pr-hygiene.services.dash.org. services.dash.org is a new zone we run in Route 53. The host is up with a valid certificate and answers 502 until the first image is deployed.
    3. Deploys and registry: infra owns a private ECR repository. ci(service): build and deploy the service image from master stale_prs_are_bad#120 adds a workflow that builds from master, assumes an AWS role through GitHub OIDC (the production environment, restricted to master), pushes the image and triggers the deploy. The host waits for /readyz and rolls back if it does not come up. The environment and the role variable are already set, so merging that PR runs the first deploy. It needs a review from you or @QuantumExplorer.
    4. Backups: a daily VACUUM INTO copy to S3, expired after 90 days, rather than volume snapshots.

    nginx in front implements the README's proxy rules; the rate-limit numbers are starting points, so say if they should change. Sign-in stays off until the sign-in App exists. Once the first deploy is verified, set PR_HYGIENE_SERVICE_URL to the URL above (no trailing slash).

    Posted by Claude (infraclaw) on behalf of ktechmidas.

  3. shumkov commented on Nov 23, 2026

    @shumkov
    Author

    @dashinfraclaw a quick check, please, as we turn on live updates.

    The PR Hygiene caller workflow in the five governed repos (platform, rust-dashcore, tenderdash, grovedb, dash-evo-tool) now grants id-token: write, so the shared PR Hygiene job can post verdicts to pr-hygiene.services.dash.org, signed with its OIDC token. A side effect is that any step of that job could mint a GitHub OIDC token for any audience. The only code in the job is our shared workflow from dashpay/stale_prs_are_bad master, and no pull request code runs in it.

    Could you confirm that no AWS role, in dashdev or any other account, trusts the OIDC subject of those five repos with a wildcard, such as repo:dashpay/platform:*? If one does, please pin it to the exact workflow (job_workflow_ref) or environment. The pr-hygiene-deploy role is fine: it trusts only repo:dashpay/stale_prs_are_bad:environment:production.

  4. ktechmidas commented on Nov 23, 2026

    @ktechmidas
    Contributor

    Checked today across the three accounts in our AWS Organization (dashdev, dashevo, dashconsult). One role matched, and we are removing it.

    The match. oidc-role in dashdev trusts repo:dashpay/platform:*. It is a leftover of the 2023 self-hosted runner setup, last used in July 2024. It has no permission policies. Its only access is full control of one S3 bucket, the old runner cache, which is empty. So a token from any Platform workflow with id-token: write could take over an empty bucket and nothing else. We are deleting the role, removing it from the bucket policy, and deleting the AWS_ROLE_TO_ASSUME variable on dashpay/platform that points at it. No workflow reads that variable.

    This did not start with your change: release.yml, book.yml, tests-codeql.yml, tests-js-package.yml and tests-rs-nightly-long-running.yml on Platform already grant id-token: write.

    Everything else.

    • No role in any of the three accounts trusts rust-dashcore, tenderdash, grovedb or dash-evo-tool.
    • dashevo and dashconsult have no GitHub OIDC provider, so no role there can be assumed with a GitHub token.
    • Seven other roles in dashdev trust GitHub. Three are pinned to one environment: pr-hygiene-deploy and two for dash-network-go. Four static-site deploy roles each trust a whole repository: dashpay/data-contract-creator, dashpay/proposal-generator, dcginfra/dashmate-site and dcginfra/grovedb-site (the website repository, not dashpay/grovedb). None of them is one of the five.

    Posted by Claude (infraclaw) on behalf of ktechmidas.

  5. shumkov commented on Dec 1, 2026

    @shumkov
    Author

    Thanks @ktechmidas — the service is live at https://pr-hygiene.services.dash.org (deployed from master by #120), PR Hygiene pushes verdicts to it, and the OIDC check is done with the stale oidc-role removed. Closing; hosting follow-ups will come as new issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions