change optimised to optimized

also: fix kc.bat to not use autobuild in devmode anymore, fix containers.adoc to not use auto_build naming, fix build command cli help as it is not required anymore to run it beforehand.
This commit is contained in:
Dominik Guhr 2022-07-22 08:40:31 +02:00 committed by Pedro Igor
parent a251d785db
commit 9bb1299d89
25 changed files with 245 additions and 268 deletions

View file

@ -74,7 +74,7 @@ To start the image, run:
podman|docker run --name optimized_keycloak -p 8443:8443 \
-e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me \
prebuilt_keycloak \
start --optimised
start --optimized
----
Keycloak starts in production mode, using only secured HTTPS communication, and is available on `https://localhost:8443`.
Notice that the startup log contains the following line:
@ -113,7 +113,7 @@ For example:
[source, bash]
----
podman|docker run --name keycloak_auto_build -p 8080:8080 \
podman|docker run --name keycloak_unoptimized -p 8080:8080 \
-e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=change_me \
quay.io/keycloak/keycloak:latest \
start \

View file

@ -516,7 +516,7 @@ public class KeycloakDeployment extends OperatorManagedResource implements Statu
container.setImage(customImage.orElse(config.keycloak().image()));
if (customImage.isPresent()) {
container.getArgs().add("--optimised");
container.getArgs().add("--optimized");
}
container.setImagePullPolicy(config.keycloak().imagePullPolicy());

View file

@ -388,7 +388,7 @@ public class KeycloakDeploymentTest extends BaseOperatorTest {
.list()
.getItems();
assertThat(pods.get(0).getSpec().getContainers().get(0).getArgs()).containsExactly("start", "--optimised");
assertThat(pods.get(0).getSpec().getContainers().get(0).getArgs()).containsExactly("start", "--optimized");
} catch (Exception e) {
savePodLogs();
throw e;

View file

@ -46,7 +46,7 @@ if "%KEY%" == "--debug" (
goto READ-ARGS
)
if "%KEY%" == "start-dev" (
set "CONFIG_ARGS=%CONFIG_ARGS% --profile=dev %KEY% --auto-build"
set "CONFIG_ARGS=%CONFIG_ARGS% --profile=dev %KEY% "
shift
goto READ-ARGS
)
@ -130,7 +130,7 @@ set "JAVA_RUN_OPTS=%JAVA_OPTS% -Dkc.home.dir="%DIRNAME%.." -Djboss.server.config
SetLocal EnableDelayedExpansion
set "ONLY_BUILD_OPTION= build"
set "NO_AUTO_BUILD_OPTION=optimised"
set "NO_AUTO_BUILD_OPTION=optimized"
if "!CONFIG_ARGS:%NO_AUTO_BUILD_OPTION%=!"=="!CONFIG_ARGS!" if "!CONFIG_ARGS:%ONLY_BUILD_OPTION%=!"=="!CONFIG_ARGS!" (
"%JAVA%" -Dkc.config.build-and-exit=true %JAVA_RUN_OPTS%

View file

@ -96,7 +96,7 @@ CLASSPATH_OPTS="'$DIRNAME'/../lib/quarkus-run.jar"
JAVA_RUN_OPTS="$JAVA_OPTS $SERVER_OPTS -cp $CLASSPATH_OPTS io.quarkus.bootstrap.runner.QuarkusEntryPoint ${CONFIG_ARGS#?}"
if [[ (! $CONFIG_ARGS = *"--optimised"*) ]] && [[ ! "$CONFIG_ARGS" == " build"* ]]; then
if [[ (! $CONFIG_ARGS = *"--optimized"*) ]] && [[ ! "$CONFIG_ARGS" == " build"* ]]; then
eval "$JAVA" -Dkc.config.build-and-exit=true $JAVA_RUN_OPTS
JAVA_RUN_OPTS="-Dkc.config.built=true $JAVA_RUN_OPTS"
EXIT_CODE=$?

View file

@ -90,8 +90,8 @@ public class KeycloakMain implements QuarkusApplication {
}
private static boolean isFastStart(List<String> cliArgs) {
// 'start --optimised' should start the server without parsing CLI
return cliArgs.size() == 2 && cliArgs.get(0).equals(Start.NAME) && cliArgs.stream().anyMatch(OPTIMISED_BUILD_OPTION_LONG::equals);
// 'start --optimized' should start the server without parsing CLI
return cliArgs.size() == 2 && cliArgs.get(0).equals(Start.NAME) && cliArgs.stream().anyMatch(OPTIMIZED_BUILD_OPTION_LONG::equals);
}
public static void start(ExecutionExceptionHandler errorHandler, PrintWriter errStream) {

View file

@ -43,8 +43,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -181,7 +179,7 @@ public final class Picocli {
exitCode = cmd.execute(configArgsList.toArray(new String[0]));
if(!isDevMode() && exitCode == cmd.getCommandSpec().exitCodeOnSuccess()) {
cmd.getOut().printf("Next time you run the server, just run:%n%n\t%s %s %s %s%n%n", Environment.getCommand(), Start.NAME, OPTIMISED_BUILD_OPTION_LONG, String.join(" ", getSanitizedRuntimeCliOptions()));
cmd.getOut().printf("Next time you run the server, just run:%n%n\t%s %s %s %s%n%n", Environment.getCommand(), Start.NAME, OPTIMIZED_BUILD_OPTION_LONG, String.join(" ", getSanitizedRuntimeCliOptions()));
}
return exitCode;

View file

@ -27,8 +27,8 @@ public abstract class AbstractStartCommand extends AbstractCommand implements Ru
// remove this once auto-build is removed
public static final String AUTO_BUILD_OPTION_LONG = "--auto-build";
public static final String AUTO_BUILD_OPTION_SHORT = "-b";
public static final String OPTIMISED_BUILD_OPTION_LONG = "--optimised";
public static final String DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION = "WARNING: The '" + AUTO_BUILD_OPTION_LONG + "' option for 'start' command is DEPRECATED and no longer needed. When executing the '" + Start.NAME + "' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '" + OPTIMISED_BUILD_OPTION_LONG + "' option instead.";
public static final String OPTIMIZED_BUILD_OPTION_LONG = "--optimized";
public static final String DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION = "WARNING: The '" + AUTO_BUILD_OPTION_LONG + "' option for 'start' command is DEPRECATED and no longer needed. When executing the '" + Start.NAME + "' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '" + OPTIMIZED_BUILD_OPTION_LONG + "' option instead.";
@Override
public void run() {

View file

@ -36,12 +36,6 @@ import picocli.CommandLine.Command;
description = {
"%nCreates a new and optimized server image based on the configuration options passed to this command. Once created, the configuration will be persisted and read during startup without having to pass them over again.",
"",
"Some configuration options require this command to be executed in order to actually change a configuration. For instance",
"",
"- Change database vendor%n" +
"- Enable/disable features%n" +
"- Enable/Disable providers or set a default",
"",
"Consider running this command before running the server in production for an optimal runtime."
},
footerHeading = "Examples:",

View file

@ -35,8 +35,8 @@ import java.util.Optional;
description = {
"%nUse this command to run the server in production."
},
footer = "%nBy default, this command tries to update the server configuration by running a '" + Build.NAME + "' before starting the server. You can disable this behavior by using the '" + Start.OPTIMISED_BUILD_OPTION_LONG + "' option:%n%n"
+ " $ ${PARENT-COMMAND-FULL-NAME:-$PARENTCOMMAND} ${COMMAND-NAME} '" + Start.OPTIMISED_BUILD_OPTION_LONG + "'%n%n"
footer = "%nBy default, this command tries to update the server configuration by running a '" + Build.NAME + "' before starting the server. You can disable this behavior by using the '" + Start.OPTIMIZED_BUILD_OPTION_LONG + "' option:%n%n"
+ " $ ${PARENT-COMMAND-FULL-NAME:-$PARENTCOMMAND} ${COMMAND-NAME} '" + Start.OPTIMIZED_BUILD_OPTION_LONG + "'%n%n"
+ "By doing that, the server should start faster based on any previous configuration you have set when manually running the '" + Build.NAME + "' command.")
public final class Start extends AbstractStartCommand implements Runnable {
@ -50,7 +50,7 @@ public final class Start extends AbstractStartCommand implements Runnable {
order = 1)
Boolean autoConfig;
@CommandLine.Option(names = {OPTIMISED_BUILD_OPTION_LONG},
@CommandLine.Option(names = {OPTIMIZED_BUILD_OPTION_LONG},
description = "Use this option to achieve an optional startup time if you have previously built a server image using the 'build' command.",
paramLabel = NO_PARAM_LABEL,
order = 1)

View file

@ -27,7 +27,7 @@ import io.quarkus.test.junit.main.LaunchResult;
import org.keycloak.quarkus.runtime.cli.command.Start;
import org.keycloak.quarkus.runtime.cli.command.StartDev;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
@CLITest
public class HelpCommandTest {
@ -54,7 +54,7 @@ public class HelpCommandTest {
}
@Test
@Launch({ Start.NAME, "--help", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ Start.NAME, "--help", OPTIMIZED_BUILD_OPTION_LONG})
void testStartHelp(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertHelp();

View file

@ -18,7 +18,7 @@
package org.keycloak.it.cli;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
import org.junit.jupiter.api.Test;
import org.keycloak.it.junit5.extension.CLIResult;
@ -52,7 +52,7 @@ public class StartCommandTest {
}
@Test
@Launch({ "-v", "start", "--db=dev-mem", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ "-v", "start", "--db=dev-mem", OPTIMIZED_BUILD_OPTION_LONG})
void failBuildPropertyNotAvailable(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertError("Unknown option: '--db'");

View file

@ -31,7 +31,7 @@ import org.keycloak.it.utils.KeycloakDistribution;
import io.quarkus.test.junit.main.Launch;
import io.quarkus.test.junit.main.LaunchResult;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
@DistributionTest(reInstall = DistributionTest.ReInstall.NEVER)
@RawDistOnly(reason = "Containers are immutable")
@ -47,7 +47,7 @@ public class BuildAndStartDistTest {
}
@Test
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", OPTIMIZED_BUILD_OPTION_LONG})
@Order(2)
void testStartUsingCliArgs(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
@ -65,7 +65,7 @@ public class BuildAndStartDistTest {
}
@Test
@Launch({ "start", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ "start", OPTIMIZED_BUILD_OPTION_LONG})
@Order(4)
void testStartUsingConfFile(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;

View file

@ -19,7 +19,7 @@ import org.keycloak.quarkus.runtime.cli.command.StartDev;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
@DistributionTest
@RawDistOnly(reason = "Containers are immutable")
@ -36,7 +36,7 @@ public class FeaturesDistTest {
}
@Test
@Launch({ Start.NAME, "--http-enabled=true", "--hostname-strict=false", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ Start.NAME, "--http-enabled=true", "--hostname-strict=false", OPTIMIZED_BUILD_OPTION_LONG})
@Order(2)
public void testFeatureEnabledOnStart(LaunchResult result) {
assertPreviewFeaturesEnabled((CLIResult) result);

View file

@ -21,7 +21,7 @@ import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
import java.util.function.Consumer;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
@ -120,7 +120,7 @@ public class QuarkusPropertiesDistTest {
@Test
@KeepServerAlive
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ "start", "--http-enabled=true", "--hostname-strict=false", OPTIMIZED_BUILD_OPTION_LONG})
@Order(9)
void testUnknownQuarkusBuildTimePropertyApplied(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;

View file

@ -32,7 +32,7 @@ import org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
@DistributionTest(reInstall = DistributionTest.ReInstall.NEVER)
@RawDistOnly(reason = "Containers are immutable")
@ -49,7 +49,7 @@ public class StartAutoBuildDistTest {
cliResult.assertMessage("Server configuration updated and persisted. Run the following command to review the configuration:");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " show-config");
cliResult.assertMessage("Next time you run the server, just run:");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " start " + OPTIMISED_BUILD_OPTION_LONG + " --http-enabled=true --hostname-strict=false");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " start " + OPTIMIZED_BUILD_OPTION_LONG + " --http-enabled=true --hostname-strict=false");
cliResult.assertMessage(DEFAULT_WARN_MESSAGE_REPEATED_AUTO_BUILD_OPTION);
assertFalse(cliResult.getOutput().contains("--cache"));
cliResult.assertStarted();
@ -109,7 +109,7 @@ public class StartAutoBuildDistTest {
}
@Test
@Launch({ "start", "--db=dev-file", "--http-enabled=true", "--hostname-strict=false", "--cache=local", OPTIMISED_BUILD_OPTION_LONG})
@Launch({ "start", "--db=dev-file", "--http-enabled=true", "--hostname-strict=false", "--cache=local", OPTIMIZED_BUILD_OPTION_LONG})
@Order(8)
void testShouldReAugAndNeedsAutoBuildOptionBecauseHasNoAutoBuildOption(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;

View file

@ -22,7 +22,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG;
import static org.keycloak.quarkus.runtime.cli.command.AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG;
import org.junit.jupiter.api.Test;
import org.keycloak.it.cli.StartCommandTest;
@ -60,7 +60,7 @@ public class StartCommandDistTest extends StartCommandTest {
cliResult.assertMessage("Server configuration updated and persisted. Run the following command to review the configuration:");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " show-config");
cliResult.assertMessage("Next time you run the server, just run:");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " start " + OPTIMISED_BUILD_OPTION_LONG + " --http-enabled=true --hostname-strict=false");
cliResult.assertMessage(KeycloakDistribution.SCRIPT_CMD + " start " + OPTIMIZED_BUILD_OPTION_LONG + " --http-enabled=true --hostname-strict=false");
assertFalse(cliResult.getOutput().contains("--cache"));
cliResult.assertStarted();
}

View file

@ -31,14 +31,14 @@ import io.quarkus.test.junit.main.LaunchResult;
public abstract class BasicDatabaseTest {
@Test
@Launch({ "start", AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG, "--http-enabled=true", "--hostname-strict=false" })
@Launch({ "start", AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG, "--http-enabled=true", "--hostname-strict=false" })
void testSuccessful(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertStarted();
}
@Test
@Launch({ "start", AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG,"--http-enabled=true", "--hostname-strict=false", "--db-username=wrong" })
@Launch({ "start", AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG,"--http-enabled=true", "--hostname-strict=false", "--db-username=wrong" })
void testWrongUsername(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertMessage("ERROR: Failed to obtain JDBC connection");
@ -48,7 +48,7 @@ public abstract class BasicDatabaseTest {
protected abstract void assertWrongUsername(CLIResult cliResult);
@Test
@Launch({ "start", AbstractStartCommand.OPTIMISED_BUILD_OPTION_LONG,"--http-enabled=true", "--hostname-strict=false", "--db-password=wrong" })
@Launch({ "start", AbstractStartCommand.OPTIMIZED_BUILD_OPTION_LONG,"--http-enabled=true", "--hostname-strict=false", "--db-password=wrong" })
void testWrongPassword(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertMessage("ERROR: Failed to obtain JDBC connection");

View file

@ -30,7 +30,7 @@ import io.quarkus.test.junit.main.LaunchResult;
public class JPAStoreDistTest {
@Test
@Launch({ "start", "--optimised", "--http-enabled=true", "--hostname-strict=false" })
@Launch({ "start", "--optimized", "--http-enabled=true", "--hostname-strict=false" })
void testSuccessful(LaunchResult result) {
CLIResult cliResult = (CLIResult) result;
cliResult.assertMessage("Experimental feature enabled: map_storage");

View file

@ -8,13 +8,6 @@ Creates a new and optimized server image based on the configuration options
passed to this command. Once created, the configuration will be persisted and
read during startup without having to pass them over again.
Some configuration options require this command to be executed in order to
actually change a configuration. For instance
- Change database vendor
- Enable/disable features
- Enable/Disable providers or set a default
Consider running this command before running the server in production for an
optimal runtime.

View file

@ -8,13 +8,6 @@ Creates a new and optimized server image based on the configuration options
passed to this command. Once created, the configuration will be persisted and
read during startup without having to pass them over again.
Some configuration options require this command to be executed in order to
actually change a configuration. For instance
- Change database vendor
- Enable/disable features
- Enable/Disable providers or set a default
Consider running this command before running the server in production for an
optimal runtime.

View file

@ -1,4 +1,3 @@
WARNING: The '--auto-build' option for 'start' command is DEPRECATED and no longer needed. When executing the 'start' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '--optimised' option instead.
Start the server in development mode.
Usage:

View file

@ -16,7 +16,7 @@ Options:
-h, --help This help message.
--import-realm Import realms during startup by reading any realm configuration file from the
'data/import' directory.
--optimised Use this option to achieve an optional startup time if you have previously
--optimized Use this option to achieve an optional startup time if you have previously
built a server image using the 'build' command.
Database:
@ -160,9 +160,9 @@ Logging:
By default, this command tries to update the server configuration by running a
'build' before starting the server. You can disable this behavior by using the
'--optimised' option:
'--optimized' option:
$ kc.sh start '--optimised'
$ kc.sh start '--optimized'
By doing that, the server should start faster based on any previous
configuration you have set when manually running the 'build' command.

View file

@ -16,7 +16,7 @@ Options:
-h, --help This help message.
--import-realm Import realms during startup by reading any realm configuration file from the
'data/import' directory.
--optimised Use this option to achieve an optional startup time if you have previously
--optimized Use this option to achieve an optional startup time if you have previously
built a server image using the 'build' command.
Database:
@ -160,9 +160,9 @@ Logging:
By default, this command tries to update the server configuration by running a
'build' before starting the server. You can disable this behavior by using the
'--optimised' option:
'--optimized' option:
$ kc.bat start '--optimised'
$ kc.bat start '--optimized'
By doing that, the server should start faster based on any previous
configuration you have set when manually running the 'build' command.

View file

@ -177,7 +177,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
commands.add(getCommand());
commands.add("-v");
commands.add("start");
commands.add("--optimised");
commands.add("--optimized");
commands.add("--http-enabled=true");
if (Boolean.parseBoolean(System.getProperty("auth.server.debug", "false"))) {
@ -198,7 +198,7 @@ public class KeycloakQuarkusServerDeployableContainer implements DeployableConta
// only run build during restarts or when running cluster tests
if (restart.get() || "ha".equals(System.getProperty("auth.server.quarkus.cluster.config"))) {
commands.removeIf("--optimised"::equals);
commands.removeIf("--optimized"::equals);
commands.add("--http-relative-path=/auth");
String cacheMode = System.getProperty("auth.server.quarkus.cluster.config", "local");