Keycloak 17+ (or updated) compose files
Keycloak
Keycloak is an open source
software product to allow single sign-on with identity and Access
Management aimed at modern applications and services. Previously prior to
version 17, Keycloak used
WildFly to develop and
distribute the project. Later from version 17, red-had has
released Quarkus based keycloak distribution which is supposed to be faster, leaner
and a lot easier to configure.
Compose Files
Mostly for development purpose, we use compose file to run softwares without
ever installing in the system. So for development purpose, keycloak is also
used. Most of the examples found are for legacy keycloak. In this blog, a
compose-file is shown as an example which can be enhanced for further
customization. Let's see the compose file.
version: "3.7"
services:
postgres:
container_name: keycloak-postgres
restart: unless-stopped
tty: true
image: postgres
ports:
- 5444:5432
environment:
- POSTGRES_DB=keycloak
- POSTGRES_USER=keycloak
- POSTGRES_PASSWORD=password
volumes:
- postgres-db:/var/lib/postgresql/data
keycloak:
container_name: keycloak
restart: unless-stopped
tty: true
command: ["start-dev", "--http-port", "8180"]
image: quay.io/keycloak/keycloak:latest
ports:
- 9080:8180
depends_on:
- postgres
environment:
- KC_DB=postgres
- KC_DB_URL=jdbc:postgresql://postgres:5432/keycloak
- KC_DB_USERNAME=keycloak
- KC_DB_PASSWORD=password
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=super
- KC_HOSTNAME_ADMIN=localhost
- KC_HTTP_RELATIVE_PATH=/auth
volumes:
postgres-db:
name: postgres-db
Here, we are using Postgres database. But you may use any types of supported
databases. Also note here, we need to add
- KC_HTTP_RELATIVE_PATH=/auth else you will see
no page found exception.
Hope the above example will help you in further enhancement and customization.
Comments are welcome if you need any assistance.
Thanks for reading the blog.
Comments
Post a Comment