Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak statup option --hostname-port is deprecated and disabled by default since keycloak 25.0.0 #42509

Closed
HerrDerb opened this issue Aug 13, 2024 · 13 comments
Labels
area/keycloak kind/bug Something isn't working

Comments

@HerrDerb
Copy link
Contributor

Since keycloak 25.0.0. hostname:v1 is disabled by default. Therefor the dev service will fail to start if useSharedNetwork evaluates to true

    ...
    if (keycloakX) {
                addEnv(KEYCLOAK_QUARKUS_ADMIN_PROP, KEYCLOAK_ADMIN_USER);
                addEnv(KEYCLOAK_QUARKUS_ADMIN_PASSWORD_PROP, KEYCLOAK_ADMIN_PASSWORD);
                withCommand(startCommand.orElse(KEYCLOAK_QUARKUS_START_CMD)
                        + (useSharedNetwork ? " --hostname-port=" + fixedExposedPort.getAsInt() : ""));
                addUpConfigResource();
            }
    ...

https://github.com/quarkusio/quarkus/blob/main/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java#L517

Log output from the failed container:
Disabled option: --hostname-port. Available only when hostname:v1 feature is enabled
Possible solutions: --hostname, --hostname-admin, --hostname-backchannel-dynamic, --hostname-strict, --hostname-debug
Try kc.sh start --help for more information on the available options.
Specify --help-all to obtain information on all options and their availability.
Copy link

quarkus-bot bot commented Aug 13, 2024

/cc @pedroigor (keycloak), @sberyozkin (keycloak)

@HerrDerb HerrDerb changed the title --hostname-port is deprecated and disabled by default since keycloak 25.0.0 Keycloak statup option --hostname-port is deprecated and disabled by default since keycloak 25.0.0 Aug 13, 2024
@HerrDerb
Copy link
Contributor Author

Might actually not be relevant for you as we use our own image... If you already enabled --features=hostname:v1 in the default keycloak dev service image, feel free to close this issue

@andrejpetras
Copy link
Contributor

Workaround that works for me:

quarkus.keycloak.devservices.show-logs=true
quarkus.keycloak.devservices.start-command=start --http-enabled=true --hostname-strict=false --features=hostname:v1

Logs:

2024-08-13 14:19:00,476 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak: 2024-08-13 12:18:58,111 WARN  [org.key.com.Profile] (main) Deprecated features enabled: hostname:v1
2024-08-13 14:19:00,478 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak: 2024-08-13 12:18:58,137 WARN  [org.key.qua.run.cli.Picocli] (main) The following used options or option values are DEPRECATED and will be removed or their behaviour changed in a future release:
2024-08-13 14:19:00,478 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak:   - hostname-strict
2024-08-13 14:19:00,478 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak:   - hostname-port
2024-08-13 14:19:00,479 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak:   - hostname
2024-08-13 14:19:00,479 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak: Consult the Release Notes for details.
2024-08-13 14:19:00,483 INFO  [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (docker-java-stream--657611309) Keycloak: 2024-08-13 12:18:59,068 WARN  [org.key.com.Profile] (main) Deprecated features enabled: hostname:v1

@andrejpetras
Copy link
Contributor

It seems like integration tests for Keycloak DevServices are missing.

@sberyozkin
Copy link
Member

@andrejpetras We do have them, but not for the shared network case, we actually used to have them but they got accidentally dropped during some restructuring. I think we can hopefully fix this issue by reintroducing them

@sberyozkin sberyozkin added the kind/bug Something isn't working label Aug 13, 2024
@joggeli34
Copy link
Contributor

Any news about this? With keycloak 26, the hostname:v1 got removed and is therefore not an option as workaround anymore

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Jan 9, 2025

Seems to be resolved by past changes

@HerrDerb HerrDerb closed this as completed Jan 9, 2025
@HerrDerb HerrDerb reopened this Jan 11, 2025
@HerrDerb
Copy link
Contributor Author

HerrDerb commented Jan 11, 2025

@sberyozkin Now with keycloak 26 hostname:v1 got dropped.
The usage within the keycloak devservice of --hostname-port is still present, therefor, upgrade to keycloak 26 is blocked.

@HerrDerb
Copy link
Contributor Author

I intended to try if it works when the port gets set directly with the hostname, which should be valid

if (useSharedNetwork) {
                hostName = ConfigureUtil.configureSharedNetwork(this, "keycloak");
                if (keycloakX) {
                    addEnv(KEYCLOAK_QUARKUS_HOSTNAME, "localhost:" + fixedExposedPort.getAsInt());
                } else {
                    addEnv(KEYCLOAK_WILDFLY_FRONTEND_URL, "http://localhost:" + fixedExposedPort.getAsInt());
                }
            }

But my system won't let me 🤦‍♂️ I need to try after the weekend.

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Jan 14, 2025

@sberyozkin seems like I am currently having issue coming from by #45496

@HerrDerb
Copy link
Contributor Author

Wrong button :)

@HerrDerb HerrDerb reopened this Jan 14, 2025
@sberyozkin
Copy link
Member

Thanks @HerrDerb for looking into this issue, and hopefully the linked one will be resolved soon for you to be able to continue

@HerrDerb
Copy link
Contributor Author

HerrDerb commented Jan 28, 2025

@sberyozkin I did come myself as far as #45793 (comment) getting the localhost/127.0.0.1:35271
Therefor we might close this issue in favor for #45793 as it seems to contains more information and attention 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/keycloak kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants