Skip to content

feat: deliver the database credential an edge derives, as itself or to the environment - #462

Merged
ExtraToast merged 4 commits into
mainfrom
feat/378-edge-credentials
Oct 16, 2026
Merged

ExtraToast merged 4 commits into
mainfrom
feat/378-edge-credentials

Conversation

@ExtraToast

Copy link
Copy Markdown
Contributor

Summary

The slice of #378 that #448 needs. An edge to a database now derives its Process's login, and the project file can hand it to the environment:

dependsOn:
  - application: platform-postgres
    surface: postgres
    credentials: {delivery: env, rotation: {tolerates: restart}}
PGUSER=${dependency:platform-postgres.username}
PGPASSWORD=${dependency:platform-postgres.password}
  • What every edge to a database derives. Every edge to a Process whose engine owns databases derives the consuming Process's credential, as chapter 10 already said and nothing rendered. Its role is the project's data role, or its owner role where the Application migrates itself (migration: self). It is read from database/creds/<role>, which the catalog's Vault roles issue (feat: apply the database catalog in the cluster by its engine's method #459). Delivered self (the default), the Process reads it from the Secret Store and its token is mounted.
  • credentials.delivery. The edge's credentials gains delivery: self | env. Delivered env, the render emits a VaultDynamicSecret (database mount, creds/<role>, untracked by Flagger, restart targets as for a static secret). The two new coordinates, username and password, read it as secretKeyRefs.
  • Refusals.
    • A credential coordinate on an edge that does not deliver env, or one used as part of a value, is E_UNRESOLVED_PLACEHOLDER.
    • An env credential that tolerates a reload is E_ENV_CANNOT_RELOAD.
    • delivery: file on an edge is a schema refusal.
  • Rules that grew.
    • A Process with such an edge now orders its unit after estate-vso-secrets.
    • A Process with such an edge also needs a secretStore (E_NO_SECRET_STORE).
  • Both implementations, the oracles and the spec.
    • The worked knowledge platform's hindsight-api takes its login as env.
    • auth's and hindsight-worker's processes now hold the derived self credential.
    • Chapters 10 and 30, ADR 0026, CONTEXT.md and REQ-062 say so.

Left on #378: delivery: file for an edge credential, the 10-minute static refresh, dropping injector annotations, chapter 17's no-token rule, and the ADR 0030 rewrite.

Verification

  • npm run verify passes. New tests cover:
    • the dynamic secret and its variables;
    • the derived role, data under a changelog and owner under self;
    • each refusal;
    • which edges reach a database.
  • Stryker on the new credential code leaves no survivor.
  • ./mvnw clean verify under emf/ passes: both implementations render the knowledge-platform and auth trees byte for byte.

Part of #378. Unblocks #448.

@ExtraToast ExtraToast added type: feature New user-facing or operator-facing capability. area: deploy homelab-deploy, deploy-v2, manifests, and rollout flow. labels Oct 16, 2026
@ExtraToast
ExtraToast enabled auto-merge (squash) October 16, 2026 11:23
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Shape

bucket files additions deletions
production code 19 +458 -78
tests 5 +244 -14
specification 5 +39 -7
decision records 1 +4 -2
documentation 3 +10 -2
examples 20 +83 -27

Coverage

Baseline: main @ 4ec2ea2.

metric this branch main diff
statements 99.57% 99.57% 0.00
branches 98.43% 98.40% +0.03
functions 100.00% 100.00% 0.00
lines 99.53% 99.52% +0.01

Lines this pull request changed: 49/49 covered (100.00%).

@ExtraToast
ExtraToast merged commit ae4fbfc into main Oct 16, 2026
21 checks passed
@ExtraToast
ExtraToast deleted the feat/378-edge-credentials branch October 16, 2026 12:42
ExtraToast added a commit to JorisJonkers-dev/grimoire that referenced this pull request Oct 16, 2026
## Summary

grimoire publishes an Intent Fragment on each release, as the Project
`grimoire`, so the estate path can deliver it into `grimoire-system`
(#74).

- **`deploy/grimoire.project.yml`:**
- One Process on `grimoire.jorisjonkers.dev`, `audience: authenticated`
(forward-auth, as today), `migration: self`.
- `cutover: interrupted`, since one replica owns every live Session
through a Postgres advisory lock, as the old Deployment's `Recreate`
did.
- Its edge to `platform-postgres` delivers the owner role's rotating
login to the environment (JorisJonkers-dev/deploy-kit#462), from the
role the estate path's catalog writes. The catalog adopts the existing
`grimoire_db` from `grimoire_user`, so the old path keeps working until
its route moves.
- It reads the S3 pair, the VAPID pair and the OIDC client secret where
the old path keeps them, `secret/data/platform/grimoire`. Garage's
bootstrap and auth-api read the same document, so it does not move.
- **`deploy/env/grimoire/base.env`:** the live Deployment's environment,
with hosts, the login and the secrets as placeholders.
`GRIMOIRE_DATABASE_URL` names only the database; pgx takes host, port
and login from `PGHOST`, `PGPORT`, `PGUSER` and `PGPASSWORD`. Garage's
endpoint stays a literal until a Project declares Garage.
- **`publish.yml`:** writes the fragment's images lock share and calls
Publish Fragment v0.27.0 (deploy-kit 0.18.0).
- **Image user:** the image runs as `65532:65532` instead of
`nonroot:nonroot`: the same user, as numbers, which the images lock
records.

The old path is unchanged until the estate admits grimoire and
fleet-infra moves the route.

## Verification

- deploy-kit 0.18.0 accepts the project file and its env alone, and
beside the estate's data project and auth's project file (`accepted (8
read)`), so the `platform-postgres` and `auth` edges resolve.
- `actionlint` passes.

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

Labels

area: deploy homelab-deploy, deploy-v2, manifests, and rollout flow. type: feature New user-facing or operator-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant