Document WithRealmImport production limitation and alternatives#379
Document WithRealmImport production limitation and alternatives#379
Conversation
…ealmImport Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
|
Hey @pfo-omicsstudio, please have a look at this. Does it make sense, is it accurate? |
There was a problem hiding this comment.
Pull request overview
This pull request addresses a critical documentation gap by documenting that the WithRealmImport() method is for local development only and does not work in production deployments. The PR adds a caution callout and provides three practical production alternatives with code examples, helping developers avoid spending hours debugging a limitation that wasn't previously documented.
Changes:
- Added a caution callout explaining that
WithRealmImport()is development-only due to volume mounting constraints - Added a "Production alternatives for realm seeding" subsection with three approaches (custom Keycloak image, initialization service, and Infrastructure as Code)
- Included code examples and external documentation links for each alternative
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - **Custom Keycloak image**: Build a custom container image that includes your realm configuration files. The realm JSON files can be baked into the image at build time: | ||
|
|
||
| ```dockerfile title="Dockerfile" | ||
| FROM quay.io/keycloak/keycloak:latest |
There was a problem hiding this comment.
The Dockerfile example uses FROM quay.io/keycloak/keycloak:latest, which pins your Keycloak base image to the mutable latest tag and introduces a supply-chain risk if that image is compromised or changes unexpectedly. An attacker who compromises or replaces the latest tag in the remote registry could affect your builds or running containers without any change on your side. Use a specific, trusted Keycloak version tag or image digest for the base image to ensure reproducible and auditable builds.
Yeah, that's pretty great! Might be worth mentioning that bind volumes in general are not supported in prod? Unsure, but Fowler mentioned that to me in the Discord, and I found that insight pretty valuable. Also, one question I would have after reading this - what about future versions? Is it always going to be like this, or are there plans for supporting it in the future? Maybe a short sentence or two addressing this. |
|
I also noticed the is a bit misleading, since it suggests an equivalent setup, but omits the defaults I know this is out of scope for this specific documentation issue, but being able to call EDIT: var keycloak = builder
.AddKeycloak("keycloak", adminPassword: keycloakAdminPassword)
.WithDockerfile("./keycloak");with this directory layout: and the same Dockerfile you already have. |
|
Hey @copilot, please address review feedback - for the |
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Added a note after the Dockerfile example recommending to replace Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
I think you ought to take a closer look yourself... |

Documentation Update for Keycloak
WithRealmImport()LimitationWithRealmImport()sectionlatestChanges Made
Updated
/src/frontend/src/content/docs/integrations/security/keycloak.mdxto:Added Caution callout explicitly stating that
WithRealmImport()is not supported in production deployments (such as when usingaspire deploy) because it relies on mounting local directories as volumesAdded Production alternatives section with three complete, actionable approaches:
Added note about version pinning: Added an
Asidenote recommending to replacelatestwith a specific Keycloak version tag (e.g.,25.0.0) or image digest for production to ensure reproducible builds and avoid unexpected changesEach alternative includes complete code examples with proper configuration and links to relevant documentation.
Resolves
This PR addresses the issue where developers spend hours trying to get
WithRealmImport()working in production without realizing it's not supported. The updated documentation now clearly states this limitation upfront and provides practical alternatives.Screenshots
Caution message:

Production alternatives with version note:

Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.