Hi all,
I have the following production-ready docker-compose file:
version: "3"
services:
keycloak_postgres:
image: postgres:13
restart: always
container_name: keycloak_postgres
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=keycloak
- POSTGRES_DB=keycloak
volumes:
- /mnt/containers/keycloak/container-data/db:/var/lib/postgresql/data:Z
keycloak:
image: quay.io/keycloak/keycloak:19.0.1
restart: always
container_name: keycloak
command: start --optimized
depends_on:
- keycloak_postgres
volumes:
- /home/aspallina/deploy_keycloak/cert/:/cert:Z
environment:
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD}
- KC_HTTPS_CERTIFICATE_KEY_FILE=/cert/keycloak_key.pem
- KC_HTTPS_CERTIFICATE_FILE=/cert/keycloak_cert.pem
- KC_HOSTNAME=wiki.local
- DB_VENDOR=POSTGRES
- DB_ADDR=keycloak_postgres
- DB_DATABASE=keycloak
- DB_USER=keycloak
- DB_PASSWORD=${POSTGRES_PASSWORD}
ports:
- 8443:8443
I noticed that Keycloak is not really using the db to store everything.
When I add a new client or a new user federation provider and then I destroy the container I lose every data (when I do a re-deploy the new container is empty), so Keycloak is not really storing the info related to clients and user federations into the database, but somewhere else.
I would like to have data persistence even destroying the containers. Any advice for that?
What is stored in the database and what is not? Where Keycloak stores clients and user federation data?
Thanks