Repository navigation
Replies: 12 comments 10 replies
|
For clearing data from database it could also be used following (assuming the database uses schema |
|
Updated so reflect that client_scopes are now supported. Added a paragraph about isolation levels. |
|
Updated to reflected added support for groups. Table names for Keycloak now have the prefix "kc_". |
|
We'll be adding a section on how to alternatively use CockroachDB. |
|
@ahus1 Just realized that the user login failures store has been available for a while now and is missing here. Relevant properties: |
|
Updated the description on how to run JPA Map storage with Quarkus |
|
Known limitations
@ahus1 the note regarding isolation level should be probably removed, when I was testing it with SERIALIZABLE and READ_COMMITTED I've seen failures (due to the fact it was not possible to serialize transactions) Supported Objects also seems outdated. |
|
Question: How can I see all the available CLI options for the new store directly from the cli? |
|
After todays update, will there be an additional followup to this blog post https://www.keycloak.org/2022/02/dbs.html lining out how this will affect future database compatibility? In particular I was looking forward to cockroach compatibility. Are there already plans which databases will be supported in the future? |
|
As announced to the community in this blog post, we are no longer developing the Map Store, and it will be removed from Keycloak's codebase. Follow #24111 for the removal steps. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This post summarizes what the JPA Map Storage provider can do today, how it can be tested and configured, and things to watch out. Comments provided to in this discussion will be used to update the original post. The post aims to reflect the current state of development in Keycloak's main branch.
For a discussion what this store could do in the future, consider creating a new discussion as this post focuses on how to test and use what is already on the main branch.
Audience, Goals, Status
Audience: (will change while development progresses)
Goal of the Map Storage Provider Family: Plugable storage back ends for the different first-class objects that will eventually support zero downtime upgrades, see https://github.com/keycloak/keycloak-community/blob/main/design/keycloak.x/storage-architecture.md
Goal of the JPA Map Storage Provider: Map storage provider backed by an SQL database. First-class objects stored as JSON to support lazy schema migration with no downtime, with additional columns/tables to support efficient retrieval and search, plus database consistency via constraints within an entity (but not between entities).
Status: early preview, see announcement here: https://www.keycloak.org/2022/07/storage-map.html
Supported Objects: All stores as listed below. Can be activated independently for development, and all stores active for the Quarkus distribution.
Supported Databases: PostgreSQL, CockroachDB (other databases will eventually follow)
Supported Isolation Levels:
Upgrades from previous versions: While this is in development, no upgrades are supported. When trying out a newer version, always start with an empty realm setup / empty database (all tables dropped).
Setup of a test environment (minimal)
podman run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=pass -e POSTGRES_USER=keycloak -e POSTGRES_DB=keycloak -d postgres:13.2Use host localhost, port 5432, database
keycloak, userkeycloakand passwordpassto connect to the database later to debug or to inspect the database.org.keycloak.testsuite.KeycloakServerwith the following parameters; the given properties will replace values in https://github.com/keycloak/keycloak/blob/main/testsuite/utils/src/main/resources/META-INF/keycloak-server.jsonkc_client,kc_client_attribute,kc_client_scope, etc.) anddatabasechangelogshould exist. All tables should contain data from the initially set up master realm.Alternative setup with Quarkus
After building Keycloak, run
Or use the Keycloak nightly distribution or unpack the locally build file
quarkus/dist/target/keycloak-999-SNAPSHOT.zipand runAlternative setup with CockroachDB
Setup a local CockroachDB single-node instance using docker
docker run -d --name=cockroach -p 26257:26257 -e COCKROACH_USER=keycloak -e COCKROACH_DATABASE=keycloak -p 8280:8080 cockroachdb/cockroach:latest-v22.1 start-single-node --insecureRun
org.keycloak.testsuite.KeycloakServeras described above. The only changed needed is theJDBCURL, that must be adjusted to use port26257. So the property must readCockroachDB uses the PostgreSQL driver for JDBC connections and this leads to minimal adjustments to make
KeycloakServerrun with CockroachDB instead of PostgreSQL.Verify setup after start: Connect to the database (run Cockroach's
sqltool and then run\c keycloak;to connect to thekeycloakdatabase). Then type\dto see that all tables were created successfully.Clear data from CockroachDB (needed for subsequent restarts):
defaultdbdatabase if you are currently connected to thekeycloakdatabase:\c defaultdbkeycloakdatabase:DROP DATABASE keycloak CASCADE;keycloakdatabase:CREATE DATABASE keycloak;keycloak:GRANT ALL ON DATABASE keycloak TO keycloak;Known issues and limitations
Open Issues
All reactions