GED → `/ged` routing + RBAC backend — coordinated rollout
Brouillon : cette page n'a pas encore été relue et peut être incomplète ou inexacte.
Runbook for shipping the GED path-standardization together with the GED RBAC backend it depends on. Read this before promoting to any environment.
Why these must ship together
Section intitulée « Why these must ship together »The /ged frontend build (agbale_frontend main, PR agbale_frontend#24) contains
two coupled changes:
- Base path — the SPA is built for
/ged(VITE_BASE_PATH=/ged) and calls its API at/ged/api. - RBAC menu — the left menu is permission-gated. The frontend loads the user’s
roles/permissions from
GET /api/me/. Those come from the Keycloak → RBAC role sync that only exists in the newerged_backend.
If you deploy the new GED frontend without the RBAC backend, GED breaks in two visible ways (both observed on the ephemeral test env before the backend was bumped):
- The header shows a generic “Utilisateur” instead of the logged-in user
(
/api/me/→ 404 on the old backend). - The left menu collapses to just Tableau de bord + Paramètres (no permissions → every gated item hidden).
SSO itself is unaffected — the routing works; this is purely a frontend/backend version-contract mismatch.
Versions to promote together
Section intitulée « Versions to promote together »| Component | Ship | Notes |
|---|---|---|
dowonou-deploy |
PR #53 | ingress /ged rewrite, portal at /, ged-backend FRONTEND_URL=https://<domain>/ged/login, Keycloak /ged/* redirects |
agbale_frontend |
PR #24 → main | VITE_BASE_PATH=/ged; already carries the RBAC menu code |
ged_backend |
≥ 1b82a2c (PR #20) |
must include the RBAC feature (see below) |
Dev already runs an RBAC-capable ged_backend (7a036fb, a descendant of 1b82a2c,
with /api/me/ and the KC→RBAC sync) and an RBAC-aware ged-frontend (bc6a47d, root
build). So on dev no backend/frontend capability bump is needed — the pending change
is purely the routing (/ged ingress + portal + FRONTEND_URL=/ged/login) plus the
/ged frontend build. For staging/prod, verify their ged_backend is ≥ 1b82a2c
before deploying the /ged frontend there; bump if not.
Required ged_backend commits (all in 1b82a2c):
b7eb1f1— sync Keycloak roles → RBAC at login0fad67a— fetch Keycloak roles viauserinfo/id_token1b82a2c(PR #20) — default “Utilisateur” full-access permissions- adds
MeView→GET /api/me/returningroles+permissions
Database migrations (0003–0006)
Section intitulée « Database migrations (0003–0006) »The RBAC backend adds four migrations; the container entrypoint runs
python manage.py migrate --no-input on startup:
0003_rbac_roles_permissions— create RBAC tables0004_seed_rbac— seed roles + permissions0005_assign_admin_role_to_existing_users— grant admin to privileged existing users0006_alter_activitylog_rbac_choices—AlterFieldonactivitylog(app-level choices)
Observed: dev’s shared
agbale_ged_dbis already migrated to RBAC — a clone of dev’s DB +migratereported “No migrations to apply”. This is expected: dev already runs the RBAC backend (7a036fb), which applied0003–0006when it was deployed. So on dev the migration step is a no-op.On staging/prod the migration will run for the first time — it creates tables, seeds, and assigns admin to existing privileged users. Take a DB backup first.
Keycloak
Section intitulée « Keycloak »Client agbale-ged needs the /ged redirect URI + web origin on each realm:
- Fresh realms — already in the realm-export files (PR #53:
deploy/docker/keycloak/realm-export.json,helm/agbale-platform/configs/keycloak-realm-export.json). - Existing realms (dev/staging/prod) — add at runtime:
(adds./deploy/scripts/preview-keycloak.sh add <domain> agbale-ged <kc_admin_pw>
https://<domain>/*, which covers/ged/*), or addhttps://<domain>/ged/*+ web originhttps://<domain>via the admin console.
FRONTEND_URL = https://<domain>/ged/login (set by PR #53) is GED’s redirect_uri source
and must be an allowed redirect on agbale-ged.
Rollout order (per env: dev → staging → prod)
Section intitulée « Rollout order (per env: dev → staging → prod) »- Back up the GED DB (staging/prod — first-time migration).
- Add the
agbale-ged/ged/*redirect URI on that env’s Keycloak. - Build the GED frontend for the env with
VITE_BASE_PATH=/ged(viabuild-env, #24). - In
environments/<env>/versions.yaml, bumpged-backend(→ RBAC image) andged-frontend(→/gedbuild) in the same change. helm upgradethe #53 chart. The backend entrypoint applies migrations (no-op on dev; first-time on staging/prod).- Smoke test (below).
- Communicate the URL change (GED moves to
/ged; old root deep links stop working) before prod.
Verification checklist
Section intitulée « Verification checklist »https://<domain>/→ the app-chooser portal (GED + AFCM cards).https://<domain>/ged→ GED loads (/ged/assets/…200); SSO round-trips back to/ged; header shows the real user (not “Utilisateur”).GET /ged/api/me/returnsroles+permissions; the menu matches the user’s role (admin → full menu).https://<domain>/afcm→ AFCM unaffected.- Old root GED URLs no longer serve GED (clean cutover).
Rollback
Section intitulée « Rollback »- Routing: revert #53, repoint
ged-frontendto the root build, remove the/gedredirect URIs. - RBAC backend: a code/image rollback is safe — migrations stay applied and the old code simply ignores the RBAC tables (this is exactly dev’s current state). No DB rollback needed for a code rollback.
Reference: ephemeral validation
Section intitulée « Reference: ephemeral validation »The combined change was validated end-to-end on https://route-test.dev.dowonou.com
(portal at /, GED at /ged, AFCM at /afcm), using an isolated GED database cloned
from dev + the RBAC backend — so dev was never mutated. Teardown:
notes/route-test-teardown.sh.