diff --git a/cli/pom.xml b/cli/pom.xml index fff66323..7f0a2b49 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -47,7 +47,7 @@ ${project.groupId} - wildfly-glow-openshift-deployment-artemis + wildfly-glow-openshift-deployment-amq ${project.groupId} diff --git a/cli/src/main/java/org/wildfly/glow/cli/commands/Constants.java b/cli/src/main/java/org/wildfly/glow/cli/commands/Constants.java index 8053f7e8..0219e4cc 100644 --- a/cli/src/main/java/org/wildfly/glow/cli/commands/Constants.java +++ b/cli/src/main/java/org/wildfly/glow/cli/commands/Constants.java @@ -52,19 +52,24 @@ public interface Constants { String EXCLUDE_ARCHIVES_FROM_SCAN_OPTION = "--exclude-archives-from-scan"; String EXCLUDE_ARCHIVES_FROM_SCAN_OPTION_LABEL = ""; String EXCLUDE_ARCHIVES_FROM_SCAN_OPTION_SHORT = "-ea"; + String FAILS_ON_ERROR_OPTION = "--fails-on-error"; + String FAILS_ON_ERROR_OPTION_SHORT = "-foe"; String HA_OPTION = "--ha"; String HELP_OPTION = "--help"; String HELP_OPTION_SHORT = "-h"; + String CLI_SCRIPT_OPTION = "--cli-script"; + String CLI_SCRIPT_OPTION_SHORT = "-cs"; + String CLI_SCRIPT_OPTION_LABEL = ""; String INIT_SCRIPT_OPTION = "--init-script"; - String INIT_SCRIPT_OPTION_SHORT = "-id"; + String INIT_SCRIPT_OPTION_SHORT = "-is"; String INIT_SCRIPT_OPTION_LABEL = ""; String INPUT_FEATURE_PACKS_FILE_OPTION = "--input-feature-packs-file"; String INPUT_FEATURE_PACKS_FILE_OPTION_LABEL = ""; String NO_DOCKER_IMAGE_OPTION = "--no-docker-image"; String NO_DOCKER_IMAGE_OPTION_SHORT = "-nd"; String PROVISION_OPTION = "--provision"; - String PROVISION_OPTION_LABEL = ""; + String PROVISION_OPTION_LABEL = ""; String PROVISION_OPTION_SHORT = "-p"; String SERVER_VERSION_OPTION = "--server-version"; String SERVER_VERSION_OPTION_SHORT = "-sv"; diff --git a/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java b/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java index ba81ad32..c0c3f9cb 100644 --- a/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java +++ b/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java @@ -16,6 +16,8 @@ */ package org.wildfly.glow.cli.commands; +import org.wildfly.glow.deployment.openshift.api.OpenShiftSupport; +import org.wildfly.glow.deployment.openshift.api.OpenShiftConfiguration; import java.nio.file.Files; import org.jboss.galleon.util.IoUtils; import org.wildfly.glow.Arguments; @@ -64,9 +66,9 @@ public Stability convert(String value) throws Exception { } } - private static final String ADD_ADD_ONS_MSG="@|bold To enable add-ons, add the|@ @|fg(yellow) " + - Constants.ADD_ONS_OPTION + "=|@ @|bold option to the|@ @|fg(yellow) " + - Constants.SCAN_COMMAND + "|@ @|bold command|@"; + private static final String ADD_ADD_ONS_MSG = "@|bold To enable add-ons, add the|@ @|fg(yellow) " + + Constants.ADD_ONS_OPTION + "=|@ @|bold option to the|@ @|fg(yellow) " + + Constants.SCAN_COMMAND + "|@ @|bold command|@"; @CommandLine.Option(names = {Constants.CLOUD_OPTION_SHORT, Constants.CLOUD_OPTION}) Optional cloud; @@ -118,10 +120,13 @@ public Stability convert(String value) throws Exception { Optional configStability; @CommandLine.Option(names = {Constants.ENV_FILE_OPTION_SHORT, Constants.ENV_FILE_OPTION}, paramLabel = Constants.ENV_FILE_OPTION_LABEL) - Optional envFile; + Optional envFile; @CommandLine.Option(names = {Constants.INIT_SCRIPT_OPTION_SHORT, Constants.INIT_SCRIPT_OPTION}, paramLabel = Constants.INIT_SCRIPT_OPTION_LABEL) - Optional initScriptFile; + Optional initScriptFile; + + @CommandLine.Option(names = {Constants.CLI_SCRIPT_OPTION_SHORT, Constants.CLI_SCRIPT_OPTION}, paramLabel = Constants.CLI_SCRIPT_OPTION_LABEL) + Optional cliScriptFile; @CommandLine.Option(names = Constants.DISABLE_DEPLOYERS, split = ",", paramLabel = Constants.ADD_ONS_OPTION_LABEL) Set disableDeployers = new LinkedHashSet<>(); @@ -130,6 +135,9 @@ public Stability convert(String value) throws Exception { split = " ", paramLabel = Constants.SYSTEM_PROPERTIES_LABEL) Set systemProperties = new HashSet<>(); + @CommandLine.Option(names = {Constants.FAILS_ON_ERROR_OPTION_SHORT, Constants.FAILS_ON_ERROR_OPTION}, defaultValue = "true") + Optional failsOnError; + @Override public Integer call() throws Exception { if (!systemProperties.isEmpty()) { @@ -146,7 +154,7 @@ public Integer call() throws Exception { } System.setProperty(propName, value); } else { - throw new Exception("Invalid system property " + p +". A property must start with -D"); + throw new Exception("Invalid system property " + p + ". A property must start with -D"); } } } @@ -156,9 +164,6 @@ public Integer call() throws Exception { print("Wildfly Glow is scanning..."); } Builder builder = Arguments.scanBuilder(); - if (cloud.orElse(false)) { - builder.setExecutionContext(CLOUD_EXECUTION_CONTEXT); - } if (haProfile.orElse(false)) { Set profiles = new HashSet<>(); profiles.add(Constants.HA); @@ -189,13 +194,14 @@ public Integer call() throws Exception { if (!Files.exists(p)) { throw new Exception(p + " file doesn't exist"); } - for(String l : Files.readAllLines(p)) { - if (!l.startsWith("#")) { + for (String l : Files.readAllLines(p)) { + l = l.trim(); + if (!l.isEmpty() && !l.startsWith("#")) { int i = l.indexOf("="); if (i < 0 || i == l.length() - 1) { throw new Exception("Invalid environment variable " + l + " in " + p); } - extraEnv.put(l.substring(0, i), l.substring(i+1)); + extraEnv.put(l.substring(0, i), l.substring(i + 1)); } } } @@ -227,13 +233,16 @@ public Integer call() throws Exception { throw new Exception("Can't produce a Bootable JAR for cloud. Use the " + Constants.PROVISION_OPTION + "=SERVER option for cloud."); } if (DOCKER_IMAGE.equals(provision.get()) && !cloud.orElse(false)) { - throw new Exception("Can't produce a Docker image if cloud is not enabled. Use the " + Constants.CLOUD_OPTION + " option."); + cloud = Optional.of(Boolean.TRUE); } if (OPENSHIFT.equals(provision.get()) && !cloud.orElse(false)) { - throw new Exception("Can't build/deploy on openShift if cloud is not enabled. Use the " + Constants.CLOUD_OPTION + " option."); + cloud = Optional.of(Boolean.TRUE); } builder.setOutput(provision.get()); } + if (cloud.orElse(false)) { + builder.setExecutionContext(CLOUD_EXECUTION_CONTEXT); + } builder.setExcludeArchivesFromScan(excludeArchivesFromScan); if (stability.isPresent()) { if (configStability.isPresent()) { @@ -256,6 +265,7 @@ public Integer call() throws Exception { throw new Exception("Can only set a docker image name when provisioning a docker image. Remove the " + Constants.DOCKER_IMAGE_NAME_OPTION + " option"); } } + builder.setIsCli(true); ScanResults scanResults = GlowSession.scan(MavenResolver.newMavenResolver(), builder.build(), GlowMessageWriter.DEFAULT); scanResults.outputInformation(); if (provision.isEmpty()) { @@ -271,24 +281,27 @@ public Integer call() throws Exception { if (scanResults.getErrorSession().hasErrors()) { if (!suggest.orElse(false)) { boolean hasAddOn = false; - // Do we have errors and add-ons to set? - for(IdentifiedError err : scanResults.getErrorSession().getErrors()) { - if (!err.getPossibleAddons().isEmpty()) { - hasAddOn = true; - break; - } - } + // Do we have errors and add-ons to set? + for (IdentifiedError err : scanResults.getErrorSession().getErrors()) { + if (!err.getPossibleAddons().isEmpty()) { + hasAddOn = true; + break; + } + } if (hasAddOn) { System.out.println(CommandLine.Help.Ansi.AUTO.string(ADD_ADD_ONS_MSG)); } } print("@|bold Some errors have been reported. You should fix them prior provisioning a server with the|@ @|fg(yellow) " + Constants.PROVISION_OPTION + "|@ @|bold option of the|@ @|fg(yellow) " + Constants.SCAN_COMMAND + "|@ @|bold command|@"); } else { - print("@|bold If you had included a|@ @|fg(yellow) " + Constants.PROVISION_OPTION + "|@ @|bold option to the|@ @|fg(yellow) " + Constants.SCAN_COMMAND + "|@ @|bold command, after outputting this report, WildFly Glow will continue on to provisioning your WildFly server, bootable jar or Docker image.|@"); + print("@|bold If you had included a|@ @|fg(yellow) " + Constants.PROVISION_OPTION+"="+Constants.PROVISION_OPTION_LABEL + "|@ @|bold option to the|@ @|fg(yellow) " + Constants.SCAN_COMMAND + "|@ @|bold command, after outputting this report, WildFly Glow will continue on to provisioning your WildFly server, bootable jar, a Docker image or deploy your application to OpenShift.|@"); } } } else { print(); + if (failsOnError.orElse(false) && scanResults.getErrorSession().hasErrors()) { + throw new Exception("Your are provisioning although errors have been reported. If you want to enforce provisioning, set --fails-on-error=false to ignore errors."); + } String vers = wildflyServerVersion.orElse(null) == null ? FeaturePacks.getLatestVersion() : wildflyServerVersion.get(); Path target = Paths.get(provisionOutputDir.orElse("server-" + vers)); IoUtils.recursiveDelete(target); @@ -319,34 +332,35 @@ public Integer call() throws Exception { } OutputContent content = scanResults.outputConfig(target, dockerImageName.orElse(null)); Path base = Paths.get("").toAbsolutePath(); + String envMessage = null; + String completedMessage = null; for (OutputContent.OutputFile f : content.getFiles().keySet()) { Path rel = base.relativize(content.getFiles().get(f)); switch (f) { case BOOTABLE_JAR_FILE: { - print("@|bold Bootable JAR build DONE.|@"); - print("@|bold To run the jar call: 'java -jar " + rel + "'|@"); + completedMessage = "@|bold To run the jar call: 'java -jar " + rel + "'|@"; break; } case DOCKER_FILE: { - print("@|bold Image generation DONE.|@."); print("@|bold Docker file generated in %s|@.", rel); break; } case ENV_FILE: { - if (!OutputFormat.OPENSHIFT.equals(provision.get())) { - print("@|bold The file " + rel + " contains the list of environment variables that you must set prior to start the server.|@"); - } + // Exposing this file seems to create confusion +// if (!OutputFormat.OPENSHIFT.equals(provision.get())) { +// print("@|bold The file " + rel + " contains the list of environment variables that you must set prior to start the server.|@"); +// } switch (provision.get()) { case SERVER: { - print("@|bold Export the suggested env variables for the server to take them into account.|@"); + envMessage = "WARNING: You have to export the suggested env variables prior to start the server."; break; } case BOOTABLE_JAR: { - print("@|bold Export the suggested env variables for the bootable JAR to take them into account.|@"); + envMessage="WARNING: You have to export the suggested env variables prior to start the bootable JAR."; break; } case DOCKER_IMAGE: { - print("@|bold For each env variable add `-e =` to the `docker run` command.|@"); + envMessage = "WARNING: For each suggested env variable add `-e =` to the `[docker | podman] run` command."; break; } } @@ -355,7 +369,6 @@ public Integer call() throws Exception { case PROVISIONING_XML_FILE: { switch (provision.get()) { case PROVISIONING_XML: { - print("@|bold Generation DONE.|@"); print("@|bold Galleon Provisioning configuration is located in " + rel + " file|@"); } } @@ -363,11 +376,10 @@ public Integer call() throws Exception { } case SERVER_DIR: { - print("@|bold Provisioning DONE.|@"); if (cloud.orElse(false)) { - print("@|bold To run the server call: 'JBOSS_HOME=" + rel + " sh " + rel + "/bin/openshift-launch.sh'|@"); + completedMessage = "@|bold To run the server call: 'JBOSS_HOME=" + rel + " sh " + rel + "/bin/openshift-launch.sh'|@"; } else { - print("@|bold To run the server call: 'sh " + rel + "/bin/standalone.sh'|@"); + completedMessage = "@|bold To run the server call: 'sh " + rel + "/bin/standalone.sh'|@"; } break; } @@ -383,17 +395,37 @@ public Integer call() throws Exception { name = p.getFileName().toString().substring(0, ext); } Map envMap = new HashMap<>(); - for(Set envs : scanResults.getSuggestions().getStronglySuggestedConfigurations().values()) { - for(Env env : envs) { + for (Set envs : scanResults.getSuggestions().getStronglySuggestedConfigurations().values()) { + for (Env env : envs) { envMap.put(env.getName(), env.getDescription()); } } - OpenShiftSupport.deploy(GlowMessageWriter.DEFAULT, target, name == null ? "app-from-wildfly-glow" : name.toLowerCase(), envMap, scanResults.getDiscoveredLayers(), - scanResults.getEnabledAddOns(), haProfile.orElse(false), extraEnv, disableDeployers, initScriptFile.orElse(null)); + OpenShiftSupport.deploy(GlowMessageWriter.DEFAULT, + target, name == null ? "app-from-wildfly-glow" : name.toLowerCase(), + envMap, + scanResults.getDiscoveredLayers(), + scanResults.getEnabledAddOns(), + haProfile.orElse(false), + extraEnv, + disableDeployers, + initScriptFile.orElse(null), + cliScriptFile.orElse(null), + new OpenShiftConfiguration.Builder().build()); print("@|bold \nOpenshift build and deploy DONE.|@"); - } - if (content.getDockerImageName() != null) { - print("@|bold To run the image call: 'docker run " + content.getDockerImageName() + "'|@"); + } else { + if (content.getDockerImageName() != null) { + print("@|bold To run the image call: '[docker | podman] run -p 8080:8080 -p 9990:9990 " + content.getDockerImageName() + "'|@"); + if (envMessage != null) { + GlowMessageWriter.DEFAULT.warn(envMessage); + } + } else { + if (completedMessage != null) { + print(completedMessage); + if (envMessage != null) { + GlowMessageWriter.DEFAULT.warn(envMessage); + } + } + } } } return 0; diff --git a/cli/src/main/resources/UsageMessages.properties b/cli/src/main/resources/UsageMessages.properties index 07365694..159f8092 100644 --- a/cli/src/main/resources/UsageMessages.properties +++ b/cli/src/main/resources/UsageMessages.properties @@ -39,10 +39,11 @@ config-stability-level = Specify a stability to be used when provisioning the se package-stability-level = Specify a stability to be used when provisioning server packages. The stability is also used to identify server packages that would be not provisioned by the specified stability. The stability is by default the minimum stability of each Galleon feature-packs. The stability can be @|fg(yellow) default|@, @|fg(yellow) community|@, @|fg(yellow) preview|@, @|fg(yellow) experimental|@. env-file = The path to a file that contains environment variables (in the form env=value) to be passed to the OpenShift deployment. Can only be used with @|fg(yellow) OPENSHIFT|@ kind of provisioning. init-script = The path to a script that contains commands (JBoss CLI, add-user, ...) to fine tune the server on OpenShift deployment. Can only be used with @|fg(yellow) OPENSHIFT|@ kind of provisioning. +cli-script = The path to a CLI script file that only contains CLI commands in order to fine tune the server on OpenShift deployment. Can only be used with @|fg(yellow) OPENSHIFT|@ kind of provisioning. disable-deployers = A comma separated list of deployer names to disable. To retrieve all the deployer names call the @|fg(yellow) show-configuration|@ operation. To disable them all, use @|fg(yellow) ALL|@ value. Can only be used with @|fg(yellow) OPENSHIFT|@ kind of provisioning. properties = A space separated list of Java system properties. When multiple system properties are set, the list must be enclosed in double quotes. For example: "-Dfoo=bar -DmyProp" - +fails-on-error= By default provisioning will be aborted if an error is reported by WildFly Glow. Set this option to false to not fail and process with the provisioning. usage.synopsisHeading = %nUsage:\u0020 # for the main command do not prepend with new line character: wildfly-glow.usage.synopsisHeading = Usage:\u0020 diff --git a/core/src/main/java/org/wildfly/glow/Arguments.java b/core/src/main/java/org/wildfly/glow/Arguments.java index c1b41742..c348307a 100644 --- a/core/src/main/java/org/wildfly/glow/Arguments.java +++ b/core/src/main/java/org/wildfly/glow/Arguments.java @@ -35,6 +35,7 @@ public class Arguments implements GoOfflineArguments, ScanArguments { private final Set excludeArchivesFromScan; private final Stability configStability; private final Stability packageStability; + private final boolean isCli; protected Arguments( String executionContext, @@ -51,7 +52,8 @@ protected Arguments( boolean techPreview, Set excludeArchivesFromScan, Stability configStability, - Stability packageStability) { + Stability packageStability, + boolean isCli) { this.executionProfiles = executionProfiles; this.userEnabledAddOns = userEnabledAddOns; this.binaries = binaries; @@ -76,6 +78,7 @@ protected Arguments( } else { this.manualLayers = new HashSet<>(Arrays.asList(manualLayers.split(","))); } + this.isCli = isCli; } /** @@ -191,6 +194,14 @@ public Stability getPackageStability() { return packageStability; } + /** + * @return the isCli + */ + @Override + public boolean isCli() { + return isCli; + } + static GoOfflineArguments.Builder goOfflineBuilder() { return new GoOfflineArguments.Builder(); } diff --git a/core/src/main/java/org/wildfly/glow/BaseArgumentsBuilder.java b/core/src/main/java/org/wildfly/glow/BaseArgumentsBuilder.java index 53f7a8fb..3bf80155 100644 --- a/core/src/main/java/org/wildfly/glow/BaseArgumentsBuilder.java +++ b/core/src/main/java/org/wildfly/glow/BaseArgumentsBuilder.java @@ -42,6 +42,7 @@ public class BaseArgumentsBuilder { protected Set excludeJarsFromScan = Collections.emptySet(); protected Stability packageStability; protected Stability configStability; + protected boolean isCli; protected BaseArgumentsBuilder() { @@ -67,6 +68,7 @@ public Arguments build() { techPreview, excludeJarsFromScan, configStability, - packageStability); + packageStability, + isCli); } } diff --git a/core/src/main/java/org/wildfly/glow/ScanArguments.java b/core/src/main/java/org/wildfly/glow/ScanArguments.java index 83fcce44..ff6eac3d 100644 --- a/core/src/main/java/org/wildfly/glow/ScanArguments.java +++ b/core/src/main/java/org/wildfly/glow/ScanArguments.java @@ -76,6 +76,7 @@ public interface ScanArguments { Stability getConfigStability(); Stability getPackageStability(); + boolean isCli(); default Builder createScanArgumentsBuilder() { return new Builder(); @@ -163,5 +164,9 @@ public Builder setConfigStability(Stability stability) { this.configStability = stability; return this; } + public Builder setIsCli(boolean isCli) { + this.isCli = isCli; + return this; + } } } diff --git a/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java b/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java index ae1ed8a5..a47c067e 100644 --- a/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java +++ b/core/src/main/java/org/wildfly/glow/ScanResultsPrinter.java @@ -277,7 +277,7 @@ private void detailed(ScanArguments arguments, ScanResults scanResults) throws E } } else { if (!scanResults.getSuggestions().getPossibleAddOns().isEmpty() || !scanResults.getSuggestions().getPossibleAddOns().isEmpty() || !suggestedConfigs.isEmpty() || !suggestedBuildTimeConfigs.isEmpty()) { - writer.info("Some suggestions have been found. You could enable suggestions with the --suggest option (if using the WildFly Glow CLI) or true (if using the WildFly Maven Plugin)."); + writer.info("Some suggestions have been found. You could enable suggestions with the " + (arguments.isCli() ? "--suggest" : "true") + " option."); } } } diff --git a/core/src/main/java/org/wildfly/glow/Utils.java b/core/src/main/java/org/wildfly/glow/Utils.java index 0da80332..28d21691 100644 --- a/core/src/main/java/org/wildfly/glow/Utils.java +++ b/core/src/main/java/org/wildfly/glow/Utils.java @@ -637,10 +637,7 @@ public static String getAddOnFix(AddOn ao, String fixContent) throws URISyntaxEx } } if (envBuilder.length() != 0) { - builder.append(" and expects (at least) the following env variables:\n").append(envBuilder.toString()); - if (fixContent != null && !fixContent.isEmpty()) { - builder.append(" - ").append(fixContent); - } + builder.append(" but you need to set the strongly suggested configuration."); } else { if (fixContent == null || fixContent.isEmpty()) { builder.append(" fully"); diff --git a/docs/guide/intro/index.adoc b/docs/guide/intro/index.adoc index 041e46a2..9f24b750 100644 --- a/docs/guide/intro/index.adoc +++ b/docs/guide/intro/index.adoc @@ -71,7 +71,7 @@ Note: The OpenShift resources yaml files are generated in the directory `server- Note: the support for OpenShift is currently specified by this WildFly Glow project link:https://github.com/wildfly/wildfly-glow/issues/49[GitHub Issue]. -###### Automatic deployment of PostGreSQL, MySQL, MariaDB, Artemis JMS Broker and Keycloak +###### Automatic deployment of PostGreSQL, MySQL, MariaDB, AMQ JMS Broker and Keycloak If WildFly Glow detects the need for these technologies, it will automatically deploy the required servers and will bound the application to them. diff --git a/openshift-deployment/artemis-broker/pom.xml b/openshift-deployment/amq-broker/pom.xml similarity index 91% rename from openshift-deployment/artemis-broker/pom.xml rename to openshift-deployment/amq-broker/pom.xml index f07a7083..892e89da 100644 --- a/openshift-deployment/artemis-broker/pom.xml +++ b/openshift-deployment/amq-broker/pom.xml @@ -8,7 +8,7 @@ 1.0.0.Beta12-SNAPSHOT - wildfly-glow-openshift-deployment-artemis + wildfly-glow-openshift-deployment-amq jar diff --git a/openshift-deployment/artemis-broker/src/main/java/org/wildfly/glow/deployment/openshift/artemis/ArtemisDeployer.java b/openshift-deployment/amq-broker/src/main/java/org/wildfly/glow/deployment/openshift/amq/AMQDeployer.java similarity index 79% rename from openshift-deployment/artemis-broker/src/main/java/org/wildfly/glow/deployment/openshift/artemis/ArtemisDeployer.java rename to openshift-deployment/amq-broker/src/main/java/org/wildfly/glow/deployment/openshift/amq/AMQDeployer.java index 09deefa8..3b6b2ea5 100644 --- a/openshift-deployment/artemis-broker/src/main/java/org/wildfly/glow/deployment/openshift/artemis/ArtemisDeployer.java +++ b/openshift-deployment/amq-broker/src/main/java/org/wildfly/glow/deployment/openshift/amq/AMQDeployer.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wildfly.glow.deployment.openshift.artemis; +package org.wildfly.glow.deployment.openshift.amq; import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.ContainerPort; @@ -43,33 +43,37 @@ * * @author jdenise */ -public class ArtemisDeployer implements Deployer { +public class AMQDeployer implements Deployer { - private static final String REMOTE_BROKER_NAME = "artemis-broker"; + private static final String REMOTE_BROKER_NAME = "amq-broker"; private static final String REMOTE_BROKER_PASSWORD = "admin"; private static final String REMOTE_BROKER_USER = "admin"; private static final Map REMOTE_BROKER_CONNECTION_MAP = new HashMap<>(); private static final Map REMOTE_BROKER_APP_MAP = new HashMap<>(); + private static final String AMQ_USER_ENV = "AMQ_USER"; + private static final String AMQ_PASSWORD_ENV = "AMQ_PASSWORD"; + private static final String BROKER_AMQ_USERNAME_ENV = "BROKER_AMQ_USERNAME"; + private static final String BROKER_AMQ_PASSWORD_ENV = "BROKER_AMQ_PASSWORD"; static { - REMOTE_BROKER_CONNECTION_MAP.put("AMQ_USER", REMOTE_BROKER_USER); - REMOTE_BROKER_CONNECTION_MAP.put("AMQ_PASSWORD", REMOTE_BROKER_PASSWORD); + REMOTE_BROKER_CONNECTION_MAP.put(AMQ_USER_ENV, REMOTE_BROKER_USER); + REMOTE_BROKER_CONNECTION_MAP.put(AMQ_PASSWORD_ENV, REMOTE_BROKER_PASSWORD); REMOTE_BROKER_CONNECTION_MAP.put("AMQ_DATA_DIR", "/home/jboss/data"); REMOTE_BROKER_APP_MAP.put("MQ_SERVICE_PREFIX_MAPPING", "broker-amq7=BROKER_AMQ"); REMOTE_BROKER_APP_MAP.put("MQ_SERVICE_PREFIX_MAPPING", "broker-amq7=BROKER_AMQ"); REMOTE_BROKER_APP_MAP.put("BROKER_AMQ_TCP_SERVICE_HOST", REMOTE_BROKER_NAME); REMOTE_BROKER_APP_MAP.put("BROKER_AMQ_TCP_SERVICE_PORT", "61616"); - REMOTE_BROKER_APP_MAP.put("BROKER_AMQ_PASSWORD", REMOTE_BROKER_PASSWORD); - REMOTE_BROKER_APP_MAP.put("BROKER_AMQ_USERNAME", REMOTE_BROKER_USER); + REMOTE_BROKER_APP_MAP.put(BROKER_AMQ_PASSWORD_ENV, REMOTE_BROKER_PASSWORD); + REMOTE_BROKER_APP_MAP.put(BROKER_AMQ_USERNAME_ENV, REMOTE_BROKER_USER); } @Override public Map deploy(GlowMessageWriter writer, Path target, OpenShiftClient osClient, - Map env, String appHost, String appName, String matching) throws Exception { - writer.info("\nDeploying Artemis Messaging Broker"); + Map env, String appHost, String appName, String matching, Map extraEnv) throws Exception { + writer.info("\nDeploying AMQ Messaging Broker"); Map labels = new HashMap<>(); labels.put(LABEL, REMOTE_BROKER_NAME); ContainerPort port = new ContainerPort(); @@ -79,11 +83,20 @@ public Map deploy(GlowMessageWriter writer, Path target, OpenShi ports.add(port); List vars = new ArrayList<>(); for (Map.Entry entry : REMOTE_BROKER_CONNECTION_MAP.entrySet()) { - vars.add(new EnvVar().toBuilder().withName(entry.getKey()).withValue(entry.getValue()).build()); + // In case user overrides the default values. + String val = extraEnv.get(entry.getKey()); + if (val != null) { + if (AMQ_USER_ENV.equals(entry.getKey())) { + REMOTE_BROKER_APP_MAP.put(BROKER_AMQ_USERNAME_ENV, val); + } else if (AMQ_PASSWORD_ENV.equals(entry.getKey())) { + REMOTE_BROKER_APP_MAP.put(BROKER_AMQ_PASSWORD_ENV, val); + } + } + vars.add(new EnvVar().toBuilder().withName(entry.getKey()).withValue(val == null ? entry.getValue() : val).build()); } Container container = new Container(); container.setName(REMOTE_BROKER_NAME); - container.setImage("quay.io/artemiscloud/activemq-artemis-broker-kubernetes"); + container.setImage("registry.redhat.io/amq7/amq-broker"); container.setPorts(ports); container.setEnv(vars); container.setImagePullPolicy("IfNotPresent"); @@ -108,6 +121,7 @@ public Map deploy(GlowMessageWriter writer, Path target, OpenShi ret.putAll(REMOTE_BROKER_APP_MAP); return REMOTE_BROKER_APP_MAP; } + @Override public Map disabledDeploy(String appHost, String appName, String matching, Map env) { Map ret = new HashMap<>(); @@ -122,7 +136,7 @@ public Map disabledDeploy(String appHost, String appName, String String k = entry.getKey().replace("{SERVICE-NAME}", "SERVICE-NAME"); ret.put(k, entry.getValue() + descriptionServiceName); } else { - if(entry.getKey().startsWith("MQ_SERVICE_PREFIX_MAPPING")) { + if (entry.getKey().startsWith("MQ_SERVICE_PREFIX_MAPPING")) { ret.put(entry.getKey(), entry.getValue()); } @@ -146,7 +160,7 @@ public Set getSupportedAddOns() { @Override public String getName() { - return "artemis_jms_broker"; + return REMOTE_BROKER_NAME; } } diff --git a/openshift-deployment/amq-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer b/openshift-deployment/amq-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer new file mode 100644 index 00000000..9c40c634 --- /dev/null +++ b/openshift-deployment/amq-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer @@ -0,0 +1 @@ +org.wildfly.glow.deployment.openshift.amq.AMQDeployer diff --git a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/AbstractDatabaseDeployer.java b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/AbstractDatabaseDeployer.java index 9335cf87..bf77941b 100644 --- a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/AbstractDatabaseDeployer.java +++ b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/AbstractDatabaseDeployer.java @@ -100,7 +100,7 @@ private Map getExistingEnv(Map env) { @Override public Map deploy(GlowMessageWriter writer, Path target, OpenShiftClient osClient, - Map env, String appHost, String appName, String matching) throws Exception { + Map env, String appHost, String appName, String matching, Map extraEnv) throws Exception { Map labels = new HashMap<>(); labels.put(LABEL, dbName); ContainerPort port = new ContainerPort(); @@ -110,7 +110,9 @@ public Map deploy(GlowMessageWriter writer, Path target, OpenShi ports.add(port); List vars = new ArrayList<>(); for (Map.Entry entry : CONNECTION_MAP.entrySet()) { - vars.add(new EnvVar().toBuilder().withName(entry.getKey()).withValue(entry.getValue()).build()); + // In case user overrides the default values. + String val = extraEnv.get(entry.getKey()); + vars.add(new EnvVar().toBuilder().withName(entry.getKey()).withValue(val == null ? entry.getValue() : val).build()); } Container container = new Container(); container.setName(dbName); diff --git a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/Deployer.java b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/Deployer.java index 9429cbd6..89023f29 100644 --- a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/Deployer.java +++ b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/Deployer.java @@ -33,7 +33,7 @@ public interface Deployer { String getName(); - Map deploy(GlowMessageWriter writer, Path target, OpenShiftClient osClient, Map env, String appHost, String appName, String matching) throws Exception; + Map deploy(GlowMessageWriter writer, Path target, OpenShiftClient osClient, Map env, String appHost, String appName, String matching, Map extraEnv) throws Exception; default Map disabledDeploy(String appHost, String appName, String matching, Map env) { return Collections.emptyMap(); diff --git a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftConfiguration.java b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftConfiguration.java new file mode 100644 index 00000000..7796a6c2 --- /dev/null +++ b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftConfiguration.java @@ -0,0 +1,99 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2024 Red Hat, Inc., and individual contributors + * as indicated by the @author tags. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wildfly.glow.deployment.openshift.api; + +/** + * + * @author jdenise + */ +public class OpenShiftConfiguration { + + private final String labelRadical; + private final String serverImageNameRadical; + private final String builderImage; + private final String runtimeImage; + + private OpenShiftConfiguration(String labelRadical, + String serverImageNameRadical, + String builderImage, + String runtimeImage) { + this.labelRadical = labelRadical; + this.serverImageNameRadical = serverImageNameRadical; + this.builderImage = builderImage; + this.runtimeImage = runtimeImage; + } + + public static class Builder { + + private String labelRadical = "org.wildfly.glow"; + private String serverImageNameRadical = "wildfly-server-"; + private String builderImage = "quay.io/wildfly/wildfly-s2i:latest"; + private String runtimeImage = "quay.io/wildfly/wildfly-runtime:latest"; + + public Builder setLabelRadical(String radical) { + this.labelRadical = radical; + return this; + } + + public Builder setServerImageNameRadical(String radical) { + this.serverImageNameRadical = radical; + return this; + } + + public Builder setBuilderImage(String img) { + this.builderImage = img; + return this; + } + + public Builder setRuntimeImage(String img) { + this.runtimeImage = img; + return this; + } + + public OpenShiftConfiguration build() { + return new OpenShiftConfiguration(labelRadical, serverImageNameRadical, builderImage, runtimeImage); + } + } + + /** + * @return the labelRadical + */ + public String getLabelRadical() { + return labelRadical; + } + + /** + * @return the serverImageNameRadical + */ + public String getServerImageNameRadical() { + return serverImageNameRadical; + } + + /** + * @return the builderImage + */ + public String getBuilderImage() { + return builderImage; + } + + /** + * @return the runtimeImage + */ + public String getRuntimeImage() { + return runtimeImage; + } +} diff --git a/cli/src/main/java/org/wildfly/glow/cli/commands/OpenShiftSupport.java b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java similarity index 83% rename from cli/src/main/java/org/wildfly/glow/cli/commands/OpenShiftSupport.java rename to openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java index 2c4b7df7..aa3f10e0 100644 --- a/cli/src/main/java/org/wildfly/glow/cli/commands/OpenShiftSupport.java +++ b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.wildfly.glow.cli.commands; +package org.wildfly.glow.deployment.openshift.api; import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.ContainerPort; @@ -23,7 +23,6 @@ import io.fabric8.kubernetes.api.model.HTTPGetAction; import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.ObjectReference; -import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder; import io.fabric8.kubernetes.api.model.Probe; import io.fabric8.kubernetes.api.model.Service; import io.fabric8.kubernetes.api.model.ServiceBuilder; @@ -49,12 +48,12 @@ import io.fabric8.openshift.api.model.RouteBuilder; import io.fabric8.openshift.api.model.RouteTargetReference; import io.fabric8.openshift.api.model.TLSConfig; -import io.fabric8.openshift.api.model.TagReferenceBuilder; import io.fabric8.openshift.client.OpenShiftClient; import java.nio.file.Files; import java.nio.file.Path; import java.security.MessageDigest; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -75,13 +74,12 @@ import org.wildfly.glow.AddOn; import org.wildfly.glow.GlowMessageWriter; import org.wildfly.glow.Layer; -import org.wildfly.glow.deployment.openshift.api.Deployer; -import org.wildfly.glow.deployment.openshift.api.Utils; + /** * * @author jdenise */ -class OpenShiftSupport { +public class OpenShiftSupport { private static void createAppDeployment(GlowMessageWriter writer, Path target, OpenShiftClient osClient, String name, Map env, boolean ha) throws Exception { writer.info("Deploying application image on OpenShift"); @@ -178,8 +176,18 @@ private static void createAppDeployment(GlowMessageWriter writer, Path target, O osClient.resources(Deployment.class).resource(deployment).waitUntilReady(5, TimeUnit.MINUTES); } - static void deploy(GlowMessageWriter writer, Path target, String appName, Map env, Set layers, Set addOns, boolean ha, - Map extraEnv, Set disabledDeployers, Path initScript) throws Exception { + public static void deploy(GlowMessageWriter writer, + Path target, + String appName, + Map env, + Set layers, + Set addOns, + boolean ha, + Map extraEnv, + Set disabledDeployers, + Path initScript, + Path cliScript, + OpenShiftConfiguration config) throws Exception { Map actualEnv = new TreeMap<>(); OpenShiftClient osClient = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class); writer.info("\nConnected to OpenShift cluster"); @@ -216,7 +224,7 @@ static void deploy(GlowMessageWriter writer, Path target, String appName, Map> \"${CLI_SCRIPT_FILE}\""); + } + Path postconfigure = extensions.resolve("postconfigure.sh"); + Files.write(postconfigure, initExecution.toString().getBytes()); + return true; + } + return false; } private static boolean isDisabled(String name, Set disabledDeployers) { @@ -282,7 +314,7 @@ private static String bytesToHex(byte[] hash) { return hexString.toString(); } - static Map createLabels(Path target, Path provisioning) throws Exception { + private static Map createLabels(Path target, Path provisioning, OpenShiftConfiguration osConfig) throws Exception { GalleonBuilder provider = new GalleonBuilder(); Path dir = target.resolve("tmp").resolve("tmpHome"); Files.createDirectory(dir); @@ -291,11 +323,11 @@ static Map createLabels(Path target, Path provisioning) throws E try (Provisioning p = provider.newProvisioningBuilder(provisioning).setInstallationHome(dir).build()) { GalleonProvisioningConfig config = provider.newProvisioningBuilder(provisioning).setInstallationHome(dir).build().loadProvisioningConfig(provisioning); GalleonConfigurationWithLayers cl = config.getDefinedConfig(new ConfigId("standalone", "standalone.xml")); - for(String s : cl.getIncludedLayers()) { - labels.put("org.wildfly.glow.layer."+s,""); + for (String s : cl.getIncludedLayers()) { + labels.put(osConfig.getLabelRadical() + ".layer." + s, ""); } - for(String s : cl.getExcludedLayers()) { - labels.put("org.wildfly.glow.excluded.layer."+s,""); + for (String s : cl.getExcludedLayers()) { + labels.put(osConfig.getLabelRadical() + ".excluded.layer." + s, ""); } for (GalleonFeaturePackConfig gfpc : config.getFeaturePackDeps()) { if (fps.length() != 0) { @@ -304,30 +336,30 @@ static Map createLabels(Path target, Path provisioning) throws E String producerName = gfpc.getLocation().getProducerName(); producerName = producerName.replaceAll("::zip", ""); int i = producerName.indexOf(":"); - if(i > 0) { - producerName = producerName.substring(i+1); + if (i > 0) { + producerName = producerName.substring(i + 1); } producerName = producerName.replaceAll(":", "-"); - labels.put("org.wildfly.glow.feature-pack."+producerName,""); + labels.put(osConfig.getLabelRadical() + ".feature-pack." + producerName, ""); } } return labels; } - static String doServerImageBuild(GlowMessageWriter writer, Path target, OpenShiftClient osClient) throws Exception { + private static String doServerImageBuild(GlowMessageWriter writer, Path target, OpenShiftClient osClient, OpenShiftConfiguration config) throws Exception { Path provisioning = target.resolve("galleon").resolve("provisioning.xml"); byte[] content = Files.readAllBytes(provisioning); MessageDigest digest = MessageDigest.getInstance("MD5"); byte[] encodedhash = digest.digest(content); String key = bytesToHex(encodedhash); - String serverImageName = "wildfly-server-" + key; + String serverImageName = config.getServerImageNameRadical() + key; ImageStream stream = new ImageStreamBuilder().withNewMetadata().withName(serverImageName). endMetadata().withNewSpec().withLookupPolicy(new ImageLookupPolicy(Boolean.TRUE)).endSpec().build(); // check if it exists ImageStream existingStream = osClient.imageStreams().resource(stream).get(); if (existingStream == null) { - writer.info("\nBuilding server image (this can take up to few minutes the first time)..."); + writer.info("\nBuilding server image (this can take up to few minutes)..."); // zip deployment and provisioning.xml to be pushed to OpenShift Path file = target.resolve("tmp").resolve("openshiftServer.zip"); if (Files.exists(file)) { @@ -338,7 +370,7 @@ static String doServerImageBuild(GlowMessageWriter writer, Path target, OpenShif Files.createDirectories(stepOne); IoUtils.copy(target.resolve("galleon"), stepOne.resolve("galleon")); ZipUtils.zip(stepOne, file); - stream = stream.toBuilder().editOrNewMetadata().withLabels(createLabels(target, provisioning)).endMetadata().build(); + stream = stream.toBuilder().editOrNewMetadata().withLabels(createLabels(target, provisioning, config)).endMetadata().build(); osClient.imageStreams().resource(stream).createOr(NonDeletingOperation::update); Utils.persistResource(target, stream, serverImageName + "-image-stream.yaml"); BuildConfigBuilder builder = new BuildConfigBuilder(); @@ -352,7 +384,7 @@ static String doServerImageBuild(GlowMessageWriter writer, Path target, OpenShif withKind("ImageStreamTag"). withName(serverImageName + ":latest").endTo(). endOutput().withNewStrategy().withNewSourceStrategy().withNewFrom().withKind("DockerImage"). - withName("quay.io/wildfly/wildfly-s2i:latest").endFrom(). + withName(config.getBuilderImage()).endFrom(). withIncremental(true). withEnv(new EnvVar().toBuilder().withName("GALLEON_USE_LOCAL_FILE").withValue("true").build()). endSourceStrategy().endStrategy().withNewSource(). @@ -369,18 +401,23 @@ static String doServerImageBuild(GlowMessageWriter writer, Path target, OpenShif return serverImageName; } - static void doAppImageBuild(String serverImageName, GlowMessageWriter writer, Path target, OpenShiftClient osClient, String name, Path initScript) throws Exception { + private static void doAppImageBuild(String serverImageName, + GlowMessageWriter writer, + Path target, + OpenShiftClient osClient, + String name, + Path initScript, + Path cliScript, + OpenShiftConfiguration config) throws Exception { // Now step 2 // From the server image, do a docker build, copy the server and copy in it the deployments and init file. Path stepTwo = target.resolve("tmp").resolve("step-two"); IoUtils.copy(target.resolve("deployments"), stepTwo.resolve("deployments")); StringBuilder dockerFileBuilder = new StringBuilder(); - dockerFileBuilder.append("FROM wildfly-runtime:latest\n"); + dockerFileBuilder.append("FROM " + config.getRuntimeImage() + "\n"); dockerFileBuilder.append("COPY --chown=jboss:root /server $JBOSS_HOME\n"); dockerFileBuilder.append("COPY --chown=jboss:root deployments/* $JBOSS_HOME/standalone/deployments\n"); - - if (initScript != null) { - packageInitScript(initScript, stepTwo); + if (packageInitScript(initScript, cliScript, stepTwo)) { dockerFileBuilder.append("COPY --chown=jboss:root extensions $JBOSS_HOME/extensions\n"); dockerFileBuilder.append("RUN chmod ug+rwx $JBOSS_HOME/extensions/postconfigure.sh\n"); } @@ -395,17 +432,6 @@ static void doAppImageBuild(String serverImageName, GlowMessageWriter writer, Pa } ZipUtils.zip(stepTwo, file2); writer.info("\nBuilding application image..."); - ImageStream runtimeStream = new ImageStreamBuilder().withNewMetadata().withName("wildfly-runtime"). - endMetadata().withNewSpec(). - addToTags(0, new TagReferenceBuilder() - .withName("latest") - .withFrom(new ObjectReferenceBuilder() - .withKind("DockerImage") - .withName("quay.io/wildfly/wildfly-runtime:latest") - .build()) - .build()). - withLookupPolicy(new ImageLookupPolicy(Boolean.TRUE)).endSpec().build(); - osClient.imageStreams().resource(runtimeStream).createOr(NonDeletingOperation::update); ImageStream appStream = new ImageStreamBuilder().withNewMetadata().withName(name). endMetadata().withNewSpec().withLookupPolicy(new ImageLookupPolicy(Boolean.TRUE)).endSpec().build(); osClient.imageStreams().resource(appStream).createOr(NonDeletingOperation::update); @@ -423,8 +449,8 @@ static void doAppImageBuild(String serverImageName, GlowMessageWriter writer, Pa withName(name + ":latest").endTo(). endOutput(). withNewSource().withType("Binary").withImages(imageSource).endSource(). - withNewStrategy().withNewDockerStrategy().withNewFrom().withKind("ImageStream"). - withName("wildfly-runtime").endFrom(). + withNewStrategy().withNewDockerStrategy().withNewFrom().withKind("DockerImage"). + withName("quay.io/wildfly/wildfly-runtime:latest").endFrom(). withDockerfilePath("./Dockerfile"). endDockerStrategy().endStrategy().endSpec().build(); osClient.buildConfigs().resource(buildConfig2).createOr(NonDeletingOperation::update); diff --git a/openshift-deployment/artemis-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer b/openshift-deployment/artemis-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer deleted file mode 100644 index 6d475194..00000000 --- a/openshift-deployment/artemis-broker/src/main/resources/META-INF/services/org.wildfly.glow.deployment.openshift.api.Deployer +++ /dev/null @@ -1 +0,0 @@ -org.wildfly.glow.deployment.openshift.artemis.ArtemisDeployer diff --git a/openshift-deployment/keycloak/src/main/java/org/wildfly/glow/deployment/openshift/keycloak/KeycloakDeployer.java b/openshift-deployment/keycloak/src/main/java/org/wildfly/glow/deployment/openshift/keycloak/KeycloakDeployer.java index e0fc3d5d..20241956 100644 --- a/openshift-deployment/keycloak/src/main/java/org/wildfly/glow/deployment/openshift/keycloak/KeycloakDeployer.java +++ b/openshift-deployment/keycloak/src/main/java/org/wildfly/glow/deployment/openshift/keycloak/KeycloakDeployer.java @@ -80,11 +80,13 @@ private Map getExistingEnv(Map env) { @Override public Map deploy(GlowMessageWriter writer, Path target, OpenShiftClient osClient, Map env, - String appHost, String appName, String matching) throws Exception { + String appHost, String appName, String matching, Map extraEnv) throws Exception { writer.info("\nDeploying Keycloak server"); Map parameters = new HashMap<>(); - parameters.put(KEYCLOAK_ADMIN_ENV, KEYCLOAK_ADMIN); - parameters.put(KEYCLOAK_ADMIN_PASSWORD_ENV, KEYCLOAK_ADMIN_PASSWORD); + String adminVal = extraEnv.get(KEYCLOAK_ADMIN_ENV); + parameters.put(KEYCLOAK_ADMIN_ENV, adminVal == null ? KEYCLOAK_ADMIN : adminVal); + String adminPassword = extraEnv.get(KEYCLOAK_ADMIN_PASSWORD_ENV); + parameters.put(KEYCLOAK_ADMIN_PASSWORD_ENV, adminPassword == null ? KEYCLOAK_ADMIN_PASSWORD : adminPassword); parameters.put(NAMESPACE_ENV, osClient.getNamespace()); Template t = osClient.templates(). load(new URL(KEYCLOAK_TEMPLATE_URL)).createOr(NonDeletingOperation::update); diff --git a/openshift-deployment/pom.xml b/openshift-deployment/pom.xml index 9a99c228..6bc6d59b 100644 --- a/openshift-deployment/pom.xml +++ b/openshift-deployment/pom.xml @@ -22,6 +22,6 @@ mariadb mysql postgresql - artemis-broker + amq-broker \ No newline at end of file diff --git a/pom.xml b/pom.xml index 77dcc15f..8c6b61c4 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ ${project.groupId} - wildfly-glow-openshift-deployment-artemis + wildfly-glow-openshift-deployment-amq ${project.version} @@ -299,9 +299,15 @@ - org.wildfly.core - wildfly-version - ${version.org.wildfly.core} + org.wildfly.core + wildfly-version + ${version.org.wildfly.core} + + + * + * + + org.wildfly.galleon-plugins