Repository navigation
feat(api): replace Keycloak with Atrium on the API and dev stack - #153
Merged
Merged
Conversation
Point identity, JWT verification, and local compose at Atrium 0.2.0-rc.6. Prod compose, deploy, and the dashboard login flow still use Keycloak.
Mount the EnvSync login and mail templates, ask for the email before the password, and send the ID token hint while revoking Atrium tokens on dashboard logout.
Mock tests import revokeDirectoryToken, and UI setup was reading the E2E client before atrium-seed finished restoring it.
BRAVO68WEB
marked this pull request as ready for review
October 28, 2026 03:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Draft cutover of the API identity layer and the local dev/e2e stack from Keycloak to Atrium
ghcr.io/bravo68web/atrium:0.2.0-rc.6.packages/envsync-api/src/helpers/identity.tsreplaceshelpers/keycloak.ts. Management calls use the Atrium client-credentials client (management/ scopemanagement): user lookup, create, patch, delete, set-password, and reset-email.{issuer}/oidc/jwks. Authorize is{issuer}/oauth/authorize. Tokens arePOST {internal}/oauth/tokenwithclient_secret_post.ATRIUM_*(ATRIUM_INTERNAL_URL,ATRIUM_PUBLIC_URL,ATRIUM_ISSUER, management and web/api/cli client ids and secrets).KEYCLOAK_*is no longer accepted by the API schema.keycloak/keycloak_dbwithatrium(Postgres 17, no Atrium Redis),docker/atrium/config.yaml, and a one-shotatrium-seedrestore ofdocker/atrium/clients.json. A second boot does not rewrite client secrets whenenvsync-webalready exists.skip_consent, registration/DCR/CIMD off, JWT access tokens, refresh168h, and Mailpit SMTP. Issuer for host-run API ishttp://auth.lvh.me:8080./health,/oauth/token, and/api/usersinstead ofkcadmand/realms/....Do not merge until Keycloak is gone from prod compose, deploy, and the dashboard login flow.
Program / phase
feat/migrate-to-atrium— Keycloak day-one cutoff. Not part offeat/the-big-update.No-piggyback checklist
deploy-cli/ enterprise deploy sources — deploy is unchanged in this draftStill on Keycloak
docker-compose.prod.yamlandscripts/cli.tsservice listspackages/deploy,packages/deploy-core, render testspackages/envsync-keycloak-themeanddocker/keycloak/realm-import#kc-login) and OpenAPI / SDK wordingSELFHOSTING.md,DEPLOY.md,README.mdidp-migrate) is not in this branchmfa.enabledandmfa.requiredfalseTests
bun test tests/mock/auth.test.tsdied while preparingenvsync_test(connection terminated), before assertions.Local API e2e after
bun run scripts/e2e-setup.ts init, against the Atrium stack:cd packages/envsync-api && TEST_MODE=e2e bun test tests/e2e --preload tests/e2e/helpers/real-setup.ts --timeout 60000289 pass, 2 fail, 291 tests, 38 files, ~27s. Login, JWT, OpenFGA, miniKMS, and migrations passed. The two failures are
Enterprise License Lock E2E(active verification…andhosted heartbeat…). Both throw immediately becauseENVSYNC_E2E_LICENSE_KEY/ENVSYNC_LICENSE_KEYis empty locally. CI suppliesENVSYNC_E2E_LICENSE_KEYand callshttps://license.envsync.cloud. The invalid-key lock test in that file passed.Risk / rollout
Breaking for any process that still sets
KEYCLOAK_*and expects the API to boot. Dev.envmust gain theATRIUM_*block from.env.example. Dev client secrets in compose (dev-web-secret,dev-api-secret,dev-e2e-secret,replace-me-management) match that example anddocker/atrium/clients.json.Hosted production is unchanged until prod compose and deploy render Atrium and the import window runs. Rollback for that later window is revert-the-release plus restore the pre-window Keycloak dump and the pre-window Atrium database. Sessions and refresh tokens are not migrated. Issuer moves from
{public}/realms/envsyncto the Atrium site root, so existing access tokens fail verification.