I’m trying to secure my springboot application with keycloak but after a certain period keycloak resests and deletes the realm that i created so I have to create it again. I have patially imported my realm and everytime I recreate it using the JSON file i downloaded but I want to persist it in my docker-compose.yml file.
This is what i already added to the file, is there something else I should do?
KC_LOG_LEVEL: info
KC_METRICS_ENABLED: ‘true’
KC_HEALTH_ENABLED: ‘true’
KC_IMPORT_DIR: /opt/keycloak/data/import # Adjust if your data directory is different
command: start-dev
ports:
- '8080:8080'
healthcheck:
test: [ "CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8080;echo -e "GET /health/ready HTTP/1.1rnhost: http://localhostrnConnection: closernrn" >&3;grep "HTTP/1.1 200 OK" <&3" ]
interval: 5s
timeout: 5s
retries: 3
depends_on:
postgres:
condition: service_healthy
# New volume to store realm data
volumes:
- realm_data:/opt/keycloak/data/import # Adjust mount point if needed
I tried adding this code to my docker-compose file
KC_LOG_LEVEL: info
KC_METRICS_ENABLED: ‘true’
KC_HEALTH_ENABLED: ‘true’
KC_IMPORT_DIR: /opt/keycloak/data/import # Adjust if your data directory is different
command: start-dev
ports:
- '8080:8080'
healthcheck:
test: [ "CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8080;echo -e "GET /health/ready HTTP/1.1rnhost: http://localhostrnConnection: closernrn" >&3;grep "HTTP/1.1 200 OK" <&3" ]
interval: 5s
timeout: 5s
retries: 3
depends_on:
postgres:
condition: service_healthy
# New volume to store realm data
volumes:
- realm_data:/opt/keycloak/data/import # Adjust mount point if needed
eliiiiiiiiiiii is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.