Closed ffroliva closed 4 months ago
@ffroliva Hi. Thanks for your time.
I tried to change on one place too but with no success. You need to change on both application properties and keycloak-server.json to work
PS.: Valeu :) Brasileiro?
The ideia is to be able to dynamically change the database provider by enabling a profile in spring boot. I will try to work on that and let you know if that works on my end.
Ps: Sim, de Brasilia, mas more em Londres.
Em seg., 22 de abr. de 2024 às 14:22, Thiago Suchorski < @.***> escreveu:
@ffroliva https://github.com/ffroliva Hi. Thanks for your time.
I tried to change on one place too but with no success. You need to change on both application properties and keycloak-server.json to work
PS.: Valeu :) Brasileiro?
— Reply to this email directly, view it on GitHub https://github.com/suchorski/springboot-keycloak-server/issues/10#issuecomment-2069409567, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF67VG6ISYCMST6KKCSXHATY6UFIPAVCNFSM6AAAAABGSUYGN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGQYDSNJWG4 . You are receiving this because you were mentioned.Message ID: @.***>
I was able to enable postgres in the following way:
config/keycloak-server/postgres/keycloak-server.json
pom.xml
spring-boot-docker-compose
dependency to pom.xml
application-postgres.yml
with postgres database configurationsdocker-compose.yml
with postgres databaset setup.-Dspring.profiles.active=postgres -Djboss.server.config.dir=/springboot-keycloak-server/config/keycloak-server/postgres
With this I was able to start the application with postgres, however now I have 2 keycloak-server.json
to manage, which is not ideal.
I think it is possible to remove the -Djboss.server.config.dir and rely on the one within the META-INF
directory, however, I would probably need to add a lot more variables:
-Dkeycloak.connectionsJpa.url=jdbc:postgresql://localhost:5432/keycloak
-Dkeycloak.connectionsJpa.driver=org.postgresql.Driver
-Dkeycloak.connectionsJpa.driverDialect=org.hibernate.dialect.PostgreSQLDialect
-Dkeycloak.connectionsJpa.user=keycloak
-Dkeycloak.connectionsJpa.password=keycloak
Any insight on this?
Since you are using docker, why not use something like this?
Thanks for sharing. Nice docker compose setup. I will give it a try. I though about having keycloak as spring boot application so that I could customize it as needed. Also by having it as spring application I can integrate it to my stack which also uses spring boot. For now I just need Postgres as my database which I was able to accomplish with the JVM arguments above.
Hi Suchoski,
Your project is great and I believe it should be expanded a little. One thing I believe would make it more suitable for production is to allow switching to a different database, for example, Postgres.
I noticed that you have
src/main/resourcesapplication.yml
andsrc/main/resources/META-INF/keycloak-server.json
with the same database configuration.I simply added a new profile
application-postgres
with postgres datasource configuration but it was not enough to switch the database to a different provider.Do you have an idea how to accomplish having a different database provider? Would it be sufficient to change the following section of
keycloak-server.json
:Your insight on this would be greatly appreciated.
PS: Bom trabalho! :)