Skip to content

docs: recommend Cloud Registry deployment settings - #60

Merged
uniqueg merged 3 commits into
mainfrom
docs/cr-deployment-settings
Nov 1, 2026
Merged

uniqueg merged 3 commits into
mainfrom
docs/cr-deployment-settings

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Makes the Cloud Registry page (docs/services/cloudregistry.md) recommend the 16 settings that the maintainer decided for the ELIXIR On-Cloud deployment, each with a short justification and exact keys or commands, in the page's existing sections rather than as a list at the end:

  • Configuration: service types controlled (max_unused_service_types left at its default); environments prod, test (plus NEXT_PUBLIC_SERVICE_ENVIRONMENTS=prod,test for the UI); new sections "Service URL schemes" (https only, the default), "Services per user" (20) and "Invitations" (defaults); "Audience": one LS Login client per front end (registry UI, Krini, dashboard), each ID in audience.
  • Exposure: "Exposing the API" blocks /admin/, either with an Ingress of your own for /ga4gh/registry/v1/ only (chart Ingress and Route off), or with the chart's Ingress and a block at the proxy (example for ingress-nginx with server-snippet). New "Rate limits": writes 10/min with a burst of 5, all requests 300/min, per client IP (example for ingress-nginx: limit-rpm plus a write-only limit_req zone in the controller's http-snippet), and how to apply it without the chart's Ingress. "Network policies": app policy enabled, ingress controller as the only peer.
  • Values file values-prod.yaml: collects the settings (network policy, audience with three placeholders, environments, controlled; max_services_per_user: 20 commented out as rc1-only).
  • Replicas: new section: 2 replicas with the default Gunicorn settings, plus a warning that the chart can't set replicas yet (see open questions).
  • Verification: new "Verifying the chart and the image" (required on every install and upgrade, gh attestation verify for chart and image, 0.6.0); Installation and Upgrades now install the verified chart file.
  • Backups: new section: volume snapshots if the storage offers them, otherwise a daily mongodump CronJob to an S3-compatible bucket outside the cluster via rclone, kept 14 days, with the NetworkPolicy that MongoDB's policy needs for the job; a one-time restore test (dump and snapshot) and a real restore.
  • Front end: image from a recorded commit of ai-post-deploy until UI releases exist, then the signed release image pinned by digest; hardening (readOnlyRootFilesystem, runAsNonRoot with runAsUser: 1000, as the image's user bun isn't numeric, all capabilities dropped, emptyDir on /app/.next/cache); 2 replicas without sticky sessions; an example Deployment.
  • Checks: registration rules in the service info, /admin/ blocked, write rate limit, app NetworkPolicy.

Versions: the page stays "last checked against v0.6.0" with its 0.6.0 URLs. max_services_per_user and invitations exist only from 1.0.0rc1 (git log v0.6.0..dev: elixir-cloud-aai/cloud-registry#286, elixir-cloud-aai/cloud-registry#274) and are marked from 1.0.0rc1, with a warning box: 0.6.0 validates config.custom with extra="forbid" (FOCA FOCABaseConfig), and the chart's schema doesn't check config.custom, so the pods would crash on startup. url_schemes, environments, service_types and max_unused_service_types exist in 0.6.0 (controlled from 0.5.0).

Also points the front end links to the UI's documentation on Read the Docs: the README sections that the page linked (#docker, #login, #sessions-and-logout, …) moved there (elixir-cloud-aai/cloud-registry-ui#118), so the anchors were broken.

No secrets, tokens or real client IDs: placeholders only.

Sources: cloud-registry dev (574d569) and v0.6.0 (docs/configuration.md, docs/access-control.md, docs/operations.md, deployment/README.md, values.yaml, values.schema.json, cloud_registry/service_models/custom_config.py), foca-common chart 0.2.0 (_deployment.tpl), cloud-registry-ui ai-post-deploy (a791ca7: Dockerfile, src/app/auth/api/*, src/lib/login-flow.ts, docs/operator-guide), oven/bun Dockerfile (user bun = UID 1000).

Light lane: docs only, one page, no logic; reviewed the diff myself.

Verification

  • mkdocs build --strict (Python venv, mkdocs[i18n], mkdocs-material, pillow, cairosvg, as in the deploy workflow): passed. The repo has no PR CI (its workflows run on pushes to main only) and no link check.
  • All internal anchors of the built page resolve; no unresolved reference links.
  • The anchors of all new external links exist on the fetched pages (v0.6.0 deployment/#server, configuration/#service-url-schemes; latest configuration/#services-per-user, access-control/#invitations; UI docs user-guide/registering/#known-limitations, operator-guide/deployment/#verifying-images, #docker, #registry, login/#sessions-and-logout, #copying-the-access-token, admins/#admin-mode).
  • Sessions: the UI keeps the login state (state, PKCE verifier, nonce) and the session (tokens, provider, admin mode) in cookies only; the server-side maps are caches (OIDC discovery, approvals support). So 2 replicas need no sticky sessions.
  • Sourcery: check passed; 4 threads answered and resolved: restore now restarts the app only after a successful mongorestore, dumps noted as not point-in-time (single server, no oplog; snapshots for exact copies), own Ingress noted as the stricter allow list (9d1ad24); emptyDir ownership declined (emptyDir is world-writable, no fsGroup needed). mkdocs build --strict passed again after the fixes.
  • Not run against a cluster: the CronJob, the NetworkPolicies, the ingress-nginx snippets and the UI Deployment with a read-only root file system are untested examples.

Follow-up (not blocking)

  • Replicas of the registry (decision 10): the chart (0.6.0 and dev/1.0.0rc1, via foca-common 0.2.0) hard-codes replicas: 1 and has no values key. The page recommends 2 replicas but says the deployment runs 1 until the chart can set it. A values key (e.g., cloudRegistry.replicas, plus a PodDisruptionBudget) would need an issue in foca (library chart) and cloud-registry.

Closes #59

🤖 Generated with Claude Code

Summary by Sourcery

Document a secure, verifiable, and recoverable production deployment profile for the Cloud Registry and its front end.

New Features:

  • Add comprehensive Cloud Registry deployment recommendations covering configuration, API exposure, rate limiting, network policies, replicas, backups, front-end hardening, and operational checks.
  • Document chart and image verification, restore testing, and version-specific configuration guidance for installations and upgrades.

Bug Fixes:

  • Update Cloud Registry UI links to the current Read the Docs documentation so operator guidance no longer points to broken README anchors.

Enhancements:

  • Consolidate the recommended production settings and commands in the Cloud Registry deployment documentation, including safe placeholders for client identifiers and deployment values.

Documentation:

  • Expand the Cloud Registry operations guide with ELIXIR On-Cloud recommendations, verified installation procedures, backup and restore guidance, and front-end deployment examples.

Tests:

  • Add documented verification checks for registration rules, API protection, rate limiting, and NetworkPolicy behavior.

Make the Cloud Registry page recommend the settings decided for the
ELIXIR On-Cloud deployment, each with a short justification, in the
existing sections: service types `controlled`, environments `prod` and
`test`, `https` service URLs, at most 20 services per user and default
invitations (both from 1.0.0rc1, marked as such), blocking `/admin/`,
rate limits, the app's NetworkPolicy, 2 replicas, backups, required
signature checks, and the front end's image, hardening, replicas and
one LS Login client per front end.

Also point the front end links to the UI's documentation, where the
README sections moved.

Closes #59

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The documentation now provides a version-aware, production-oriented Cloud Registry deployment guide covering recommended configuration, ingress and network security, release verification, hardened front-end deployment, backups and restore testing, and operational checks, while noting the chart's current replica limitation.

Sequence diagram for verified Cloud Registry installation

sequenceDiagram
    actor Operator
    participant GitHub
    participant RegistryImage
    participant Helm
    participant Kubernetes

    Operator->>GitHub: gh release download
    Operator->>GitHub: gh attestation verify
    GitHub-->>Operator: Verified chart
    Operator->>RegistryImage: gh attestation verify
    RegistryImage-->>Operator: Verified image
    alt verification succeeds
        Operator->>Helm: helm install
        Helm->>Kubernetes: Create Cloud Registry resources
        Kubernetes-->>Operator: rollout status
    else verification fails
        Operator-->>Operator: Do not install
    end
Loading

Sequence diagram for Cloud Registry backup and restore testing

sequenceDiagram
    actor Operator
    participant CronJob
    participant MongoDB
    participant OffsiteStorage
    participant RestoreMongoDB
    participant Registry

    CronJob->>MongoDB: mongodump
    CronJob->>OffsiteStorage: rclone copy
    CronJob->>OffsiteStorage: rclone delete
    Operator->>OffsiteStorage: Download backup
    Operator->>RestoreMongoDB: mongorestore
    Operator->>RestoreMongoDB: mongosh
    Operator->>Registry: curl service list
    Operator->>Operator: Compare restored and live data
Loading

File-Level Changes

Change Details Files
Expanded the Cloud Registry deployment guidance with recommended production configuration and version-aware settings.
  • Documented recommended audiences, environments, URL schemes, controlled service types, per-user limits, and invitation defaults.
  • Added a 0.6.0 compatibility warning for settings introduced in 1.0.0rc1 and consolidated applicable values in a production values example.
  • Updated UI documentation links to Read the Docs and aligned front-end environment configuration.
docs/services/cloudregistry.md
Added operational security guidance for ingress exposure, request limiting, network isolation, replicas, and front-end hardening.
  • Documented API-only exposure options and /admin/ blocking, including ingress-nginx examples.
  • Added per-client-IP read/write rate-limit recommendations and ingress-nginx configuration examples.
  • Recommended the app NetworkPolicy, explained the current single-replica chart limitation, and added a hardened two-replica UI Deployment example.
docs/services/cloudregistry.md
Strengthened release verification and lifecycle procedures.
  • Added gh attestation verify commands for the chart and image and changed installation and upgrade examples to use verified local chart archives.
  • Added guidance for traceable pre-release UI images and signed, digest-pinned release images.
  • Expanded post-install checks for registration rules, API blocking, rate limits, and NetworkPolicy behavior.
docs/services/cloudregistry.md
Added backup, restore, and disaster-recovery procedures for MongoDB.
  • Recommended volume snapshots or daily external mongodump backups retained for 14 days.
  • Added a credential-safe CronJob example using rclone, required MongoDB NetworkPolicy access, and pinned-image guidance.
  • Documented dump and snapshot restore tests plus a production restore procedure that restarts the app only after a successful restore.
docs/services/cloudregistry.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 05:31

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 4 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docs/services/cloudregistry.md" line_range="653" />
<code_context>
+        annotations:
+          # Applies to the whole host, also to other apps on it
+          nginx.ingress.kubernetes.io/server-snippet: |
+            location /admin/ { return 404; }
+    ```
+
</code_context>
<issue_to_address>
**Other Ingress paths remain public**

When an operator chooses the chart's Ingress option, the chart Ingress forwards paths other than `/admin/` to the app, including paths outside `/ga4gh/registry/v1/`, so endpoints beyond the stated allowlist remain reachable.

Configure the Ingress to forward only the allowed API paths and reject all other paths.
</issue_to_address>

### Comment 2
<location path="docs/services/cloudregistry.md" line_range="1040" />
<code_context>
+          mountPath: /app/.next/cache
+      volumes:
+      - name: next-cache
+        emptyDir: {}
+```
+
</code_context>
<issue_to_address>
**Non-root workloads cannot write volumes**

When these manifests run with the default `emptyDir` ownership and no ownership adjustment, the UI process running as UID 1000 cannot write its cache, and the backup containers running as UID 999 cannot write their temporary config or archive, so the UI cache fails and backups are not produced.

Configure writable ownership, such as an appropriate `fsGroup`, for the UI and backup volumes.

Also at `docs/services/cloudregistry.md:1248-1249`.
</issue_to_address>

### Comment 3
<location path="docs/services/cloudregistry.md" line_range="1316-1320" />
<code_context>
+
+```bash
+kubectl scale deploy/cloud-registry --replicas=0 -n <namespace>
+kubectl exec -i deploy/cloud-registry-mongodb -n <namespace> -- sh -c 'mongorestore \
+  -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" \
+  --authenticationDatabase admin --gzip --archive --drop' \
+  < cloud-registry-<timestamp>.archive.gz
+kubectl scale deploy/cloud-registry --replicas=1 -n <namespace>
+```
+
</code_context>
<issue_to_address>
**Failed restore restarts app**

When `mongorestore` fails after changing the database, `mongorestore` can exit after `--drop` has removed or replaced some collections, but the shell continues to the final `kubectl scale` command; the app then serves a partially restored database.

Make the restore sequence stop on failure and only scale the app back up after a successful restore.
</issue_to_address>

### Comment 4
<location path="docs/services/cloudregistry.md" line_range="1212-1216" />
<code_context>
+            - |
+              set -e
+              printf 'password: "%s"\n' "$MONGO_PASSWORD" > /tmp/mongodump.yaml
+              mongodump --config /tmp/mongodump.yaml \
+                --host cloud-registry-mongodb --port 27017 \
+                --username "$MONGO_USER" --authenticationDatabase serviceStore \
+                --db serviceStore --gzip \
+                --archive="/backup/cloud-registry-$(date -u +%Y%m%dT%H%M%SZ).archive.gz"
+            securityContext:
+              readOnlyRootFilesystem: true
</code_context>
<issue_to_address>
**Backup can mix database states**

When a service is written while the CronJob traverses the database, `mongodump` reads collections at different times without using an oplog, so the archive can combine inconsistent states and cannot provide a consistent point-in-time recovery.

Use a backup method that provides a consistent point-in-time snapshot, or pause writes while the dump runs.
</issue_to_address>

Linked issues

#59 docs: recommend Cloud Registry deployment settings · 8 of 8 met

# Requirement Status Notes
1 Recommend service types controlled, leave max_unused_service_types at its default, and set environments to prod and test. ✅ Met The Service types and Service environments sections give the recommendations and explain them; the values example includes both settings.
2 Recommend https service URLs, at most 20 services per user, and default invitation settings. ✅ Met The Service URL schemes, Services per user, and Invitations sections document these choices; the latter two are marked as available from 1.0.0rc1.
3 Block /admin/, enable the app NetworkPolicy with the ingress controller as peer, and recommend ingress rate limits per client IP. ✅ Met The exposure and Network policies sections provide the requested configurations and examples, including 10 writes per minute with a burst of 5 and 300 requests per minute overall.
4 Recommend two registry replicas with default Gunicorn settings, backups, restore testing, and signature verification on every install and upgrade. ✅ Met The Replicas, Backups, Verifying the chart and the image, Installation, and Upgrades sections cover these recommendations and procedures, including the chart's current replica limitation.
5 Document the front-end image source, hardening, two replicas, and one LS Login client per front end in the registry audience. ✅ Met The Front end guidance and Deployment example cover these recommendations, and the Audience section lists separate client IDs for the UI, Krini, and dashboard.
6 Mark 1.0.0rc1-only settings, retain the page's 0.6.0 version and chart URLs, and warn against putting unsupported settings in a 0.6.0 values file. ✅ Met The warning and values-file comments identify the rc1-only settings and explain that 0.6.0 rejects unknown config.custom keys; the page retains its 0.6.0 references.
7 Use placeholders only, with no secrets, tokens, or real client IDs. ✅ Met The examples use placeholders for client IDs, namespaces, hosts, and credentials; no real secrets or tokens are included.
8 State each decided setting with its reason and exact keys or commands, and pass mkdocs build --strict. ✅ Met The recommendations include justifications and configuration keys or commands; the pull request's verification notes report that mkdocs build --strict passed.

Sourcery assessment

Approval pending. 4 findings to address first.

Blocking findings: docs/services/cloudregistry.md:653, docs/services/cloudregistry.md:1040, docs/services/cloudregistry.md:1320, docs/services/cloudregistry.md:1216


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/services/cloudregistry.md Resolved
Comment thread docs/services/cloudregistry.md Resolved
Comment thread docs/services/cloudregistry.md Resolved
Comment thread docs/services/cloudregistry.md Resolved
Stop the restore before restarting the app if mongorestore fails, note
that dumps of the single MongoDB server are not point-in-time copies,
and say that an Ingress of your own is the stricter way to expose only
the API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg

uniqueg commented Nov 1, 2026

Copy link
Copy Markdown
Member Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="docs/services/cloudregistry.md" line_range="1232" />
<code_context>
+                drop: [ALL]
+            volumeMounts:
+            - {name: backup, mountPath: /backup}
+            - {name: tmp, mountPath: /tmp}
+          containers:
+          - name: upload
</code_context>
<issue_to_address>
**Uploader can read database password**

When the rclone container or image is compromised, the dump container writes `MONGO_PASSWORD` to `/tmp/mongodump.yaml`, and both containers mount the same `tmp` volume at `/tmp`; a compromised rclone container can read the MongoDB password and use it to access the production database.

Use separate temporary volumes for the dump and upload containers so the uploader cannot access the MongoDB credential file.

Also at `docs/services/cloudregistry.md:1254`.
</issue_to_address>

### Comment 2
<location path="docs/services/cloudregistry.md" line_range="1015" />
<code_context>
+      containers:
+      - name: cloud-registry-ui
+        # The recorded build (see "UI version"); for releases, pin the digest
+        image: <registry>/cloud-registry-ui:<commit>
+        ports:
+        - name: http
</code_context>
<issue_to_address>
**Retagged UI image runs**

When an actor with write access to the UI image registry overwrites the commit tag after it was pushed, kubernetes resolves `image: <registry>/cloud-registry-ui:<commit>` when starting a pod; after a registry writer moves that tag, a new pod on a node without the old image runs the replacement rather than the recorded build, allowing attacker-controlled UI code to make authenticated API requests as users.

Pin the pushed UI image by digest in the Deployment example, including for builds made before UI releases exist.
</issue_to_address>

Linked issues

#59 docs: recommend Cloud Registry deployment settings · 7 of 7 met

# Requirement Status Notes
1 Recommend the registry settings: controlled service types with the unused-types limit at its default, prod/test environments, HTTPS-only service URLs, a 20-services-per-user limit, and default invitation settings. ✅ Met The page explains these settings and their keys; it marks the user limit and invitations as 1.0.0rc1-only.
2 Block /admin/, enable the app NetworkPolicy with the ingress controller as peer, and recommend per-client-IP rate limits. ✅ Met It gives chart and custom-Ingress approaches, ingress-nginx examples for 10 writes/minute with burst 5 and 300 requests/minute, and explains applying the rate limits without the chart Ingress.
3 Recommend two registry replicas with default Gunicorn settings, backups and a tested restore, and signature verification on every install and upgrade. ✅ Met The page recommends two replicas while disclosing the chart limitation, documents snapshot and CronJob backup options plus restore steps, and directs operators to verify chart and image signatures.
4 Document the front-end image source, hardening, two replicas, and a separate LS Login client per front end listed in the registry audience. ✅ Met The page covers recorded commits until releases exist, signed release images pinned by digest, container hardening, a two-replica Deployment example, and separate audience entries.
5 Keep the page and chart references at 0.6.0, and warn against adding 1.0.0rc1-only settings to a 0.6.0 deployment. ✅ Met The warning identifies the strict config validation and the values-file example comments out the rc1-only user limit.
6 Use placeholders only; include no secrets, tokens, or real client IDs. ✅ Met The examples use placeholders and refer to credentials stored in Secrets.
7 Pass mkdocs build --strict. ✅ Met The PR verification reports that the strict build passed.

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: docs/services/cloudregistry.md:1232, docs/services/cloudregistry.md:1015


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/services/cloudregistry.md Resolved
Comment thread docs/services/cloudregistry.md Resolved
Use separate scratch volumes for the dump and upload containers, so the uploader cannot read the MongoDB password file, and pin the UI image by digest in the Deployment example and the build instructions.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 1e54d9d into main Nov 1, 2026
1 check passed
@uniqueg
uniqueg deleted the docs/cr-deployment-settings branch November 1, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: recommend Cloud Registry deployment settings

1 participant