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

Artemis Console next gen based on hawtIO 4 #5149

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,15 @@ artemis-native/src/main/c/org_apache_activemq_artemis_jlibaio_LibaioContext.h

# overlay outpit
**/overlays/**/*

#for the console and yarn builds
artemis-hawtio/artemis-plugin/artemis-plugin/build
artemis-hawtio/artemis-plugin/artemis-plugin/node_modules
artemis-hawtio/artemis-plugin/artemis-plugin/node
# yarn (zero-installs)
artemis-hawtio/artemis-plugin/artemis-plugin/.yarn/*
artemis-hawtio/artemis-plugin/artemis-plugin/!.yarn/patches
artemis-hawtio/artemis-plugin/artemis-plugin/!.yarn/plugins
artemis-hawtio/artemis-plugin/artemis-plugin/!.yarn/releases
artemis-hawtio/artemis-plugin/artemis-plugin/!.yarn/sdks
artemis-hawtio/artemis-plugin/artemis-plugin/!.yarn/versions
gemmellr marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions artemis-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-plugin</artifactId>
<artifactId>artemis-console-war</artifactId>
<type>war</type>
<version>${project.version}</version>
<version>${artemis-console-war-version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
*/
package org.apache.activemq.artemis.cli.commands;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.HashMap;
Expand All @@ -37,7 +39,7 @@
public class Upgrade extends InstallAbstract {

// these are the JVM argumnents we must keep between upgrades
private static final String[] KEEPING_JVM_ARGUMENTS = new String[]{"-Xmx", "-Djava.security.auth.login.config", "-Dhawtio.role="};
private static final String[] KEEPING_JVM_ARGUMENTS = new String[]{"-Xmx", "-Djava.security.auth.login.config", "-Dhawtio.roles="};

// this is the prefix where we can find the JDK arguments in Windows script
private static final String JDK_PREFIX_WINDOWS = "IF \"%JAVA_ARGS%\"==\"\" (set JAVA_ARGS=";
Expand Down Expand Up @@ -145,7 +147,7 @@ public Object run(ActionContext context) throws Exception {
"<env name=\"ARTEMIS_INSTANCE\"", "<env name=\"ARTEMIS_INSTANCE_ETC\"",
"<env name=\"ARTEMIS_INSTANCE_URI\"", "<env name=\"ARTEMIS_INSTANCE_ETC_URI\"",
"<env name=\"ARTEMIS_DATA_DIR\"", "<logpath>", "<startargument>-Xmx", "<stopargument>-Xmx",
"<name>", "<id>", "<startargument>-Dhawtio.role=");
"<name>", "<id>", "<startargument>-Dhawtio.roles=");
gemmellr marked this conversation as resolved.
Show resolved Hide resolved

final File artemisProfileCmdTmp = new File(tmp, Create.ETC_ARTEMIS_PROFILE_CMD);
final File artemisProfileCmd = new File(etcFolder, Create.ETC_ARTEMIS_PROFILE_CMD);
Expand Down Expand Up @@ -173,7 +175,7 @@ public Object run(ActionContext context) throws Exception {
write("etc/" + Create.ETC_ARTEMIS_PROFILE, new File(tmp, Create.ETC_ARTEMIS_PROFILE), filters, false, false);
upgradeJDK(context, JDK_PREFIX_LINUX, "\"", KEEPING_JVM_ARGUMENTS,
new File(tmp, Create.ETC_ARTEMIS_PROFILE), new File(etcFolder, Create.ETC_ARTEMIS_PROFILE), new File(etcBkp, Create.ETC_ARTEMIS_PROFILE), "ARTEMIS_INSTANCE=",
"ARTEMIS_DATA_DIR=", "ARTEMIS_ETC_DIR=", "ARTEMIS_OOME_DUMP=", "ARTEMIS_INSTANCE_URI=", "ARTEMIS_INSTANCE_ETC_URI=", "HAWTIO_ROLE=");
"ARTEMIS_DATA_DIR=", "ARTEMIS_ETC_DIR=", "ARTEMIS_OOME_DUMP=", "ARTEMIS_INSTANCE_URI=", "ARTEMIS_INSTANCE_ETC_URI=", "HAWTIO_ROLES=");
}

final File bootstrapXml = new File(etcFolder, Create.ETC_BOOTSTRAP_XML);
Expand All @@ -187,6 +189,10 @@ public Object run(ActionContext context) throws Exception {
"^(.*)<app url=(.*branding.*)$", "$1<app name=\"branding\" url=$2",
"^(.*)<app url=(.*plugin.*)$", "$1<app name=\"plugin\" url=$2",
"^(.*)<app url=\"([^\"]+)\"(.*)$", "$1<app name=\"$2\" url=\"$2\"$3");

//we remove the unwanted wars after updating them above just in case we are upgrading from an older version where the format was different
removeWars(context, bootstrapXml);

upgradeLogging(context, etcFolder, etcBkp);

context.out.println();
Expand Down Expand Up @@ -361,4 +367,31 @@ protected File findBackup(ActionContext context) throws IOException {
}
throw new RuntimeException("Too many backup folders in place already. Please remove some of the old-config-bkp.* folders");
}

private void removeWars(ActionContext context, File bootstrapXml) throws Exception {
StringBuilder sb = new StringBuilder();
boolean remove = false;
try (Stream<String> lines = Files.lines(bootstrapXml.toPath())) {
Iterator<String> linesIterator = lines.iterator();
while (linesIterator.hasNext()) {
String line = linesIterator.next();
if (line.matches("^(.*)<app name=(.*branding.*)$")) {
context.out.println("removing branding war as no longer needed");
remove = true;
} else if (line.matches("^(.*)<app name=(.*plugin.*)$")) {
context.out.println("removing plugin war as no longer needed");
remove = true;
} else {
sb.append(line).append(System.lineSeparator());
}
}
}
if (remove) {
try (InputStream inputStream = new ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8));
OutputStream outputStream = new FileOutputStream(bootstrapXml)) {
copy(inputStream, outputStream);
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if [ -z "$ARTEMIS_INSTANCE" ] ; then
ARTEMIS_INSTANCE=`cd "$ARTEMIS_INSTANCE/.." && pwd`
fi

HAWTIO_ROLE="NO_HAWTIO_ROLE"
HAWTIO_ROLES="NO_HAWTIO_ROLES"

# Load Profile Data
ARTEMIS_INSTANCE_ETC='${artemis.instance.etc}'
Expand Down Expand Up @@ -102,7 +102,7 @@ fi

exec "$JAVACMD" \
$JAVA_ARGS \
-Dhawtio.role="$HAWTIO_ROLE" \
-Dhawtio.roles="$HAWTIO_ROLES" \
-Djava.security.auth.login.config="$ARTEMIS_INSTANCE_ETC/login.config" \
$ARTEMIS_CLUSTER_PROPS \
-classpath "$CLASSPATH" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<startargument>-Dhawtio.disableProxy=true</startargument>
<startargument>-Dhawtio.realm=activemq</startargument>
<startargument>-Dhawtio.offline="true"</startargument>
<startargument>-Dhawtio.role=${role}</startargument>
<startargument>-Dhawtio.roles=${role}</startargument>
<startargument>-Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal</startargument>
<startargument>-Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%/jolokia-access.xml</startargument>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ ARTEMIS_INSTANCE_ETC_URI='${artemis.instance.etc.uri}'
#ARTEMIS_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446"

# Hawtio Properties
# HAWTIO_ROLE define the user role or roles required to be able to login to the console. Multiple roles to allow can
# HAWTIO_ROLES defines the user roles required to be able to login to the console. Multiple roles to allow can
# be separated by a comma. Set to '*' or an empty value to disable role checking when Hawtio authenticates a user.
HAWTIO_ROLE='${role}'
HAWTIO_ROLES='${role}'

# Java Opts
if [ -z "$JAVA_ARGS" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rem Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be
rem set ARTEMIS_CLUSTER_PROPS=-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446

rem Java Opts
IF "%JAVA_ARGS%"=="" (set JAVA_ARGS=${java-opts} -XX:AutoBoxCacheMax=20000 -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+UseStringDeduplication -Xms512M -Xmx${java-memory} -Djava.security.auth.login.config=%ARTEMIS_ETC_DIR%\login.config -Dhawtio.disableProxy=true -Dhawtio.offline=true -Dhawtio.realm=activemq -Dhawtio.role=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Dhawtio.http.strictTransportSecurity=max-age=31536000;includeSubDomains;preload -Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%\jolokia-access.xml -Dartemis.instance=%ARTEMIS_INSTANCE% --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dlog4j2.disableJmx=true)
IF "%JAVA_ARGS%"=="" (set JAVA_ARGS=${java-opts} -XX:AutoBoxCacheMax=20000 -XX:+PrintClassHistogram -XX:+UseG1GC -XX:+UseStringDeduplication -Xms512M -Xmx${java-memory} -Djava.security.auth.login.config=%ARTEMIS_ETC_DIR%\login.config -Dhawtio.disableProxy=true -Dhawtio.offline=true -Dhawtio.realm=activemq -Dhawtio.roles=${role} -Dhawtio.rolePrincipalClasses=org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal -Dhawtio.http.strictTransportSecurity=max-age=31536000;includeSubDomains;preload -Djolokia.policyLocation=%ARTEMIS_INSTANCE_ETC_URI%\jolokia-access.xml -Dartemis.instance=%ARTEMIS_INSTANCE% --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dlog4j2.disableJmx=true)

rem Logs Safepoints JVM pauses: Uncomment to enable them
rem In addition to the traditional GC logs you could enable some JVM flags to know any meaningful and "hidden" pause that could
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!-- The web server is only bound to localhost by default -->
<web path="web" rootRedirectLocation="console">
<binding name="artemis" uri="${web.protocol}://${http.host}:${http.port}"${extra.web.attributes}>
<app name="branding" url="activemq-branding" war="activemq-branding.war"/>
<app name="plugin" url="artemis-plugin" war="artemis-plugin.war"/>
<app name="console" url="console" war="console.war"/>
</binding>
</web>
34 changes: 15 additions & 19 deletions artemis-hawtio/artemis-console/pom.xml → artemis-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,36 @@

<parent>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-hawtio-pom</artifactId>
<artifactId>artemis-pom</artifactId>
<version>2.36.0</version>
<relativePath>../artemis-pom/pom.xml</relativePath>
</parent>

<artifactId>artemis-console</artifactId>
<name>ActiveMQ Artemis Console</name>

<packaging>war</packaging>

<properties>
<activemq.basedir>${project.basedir}/../..</activemq.basedir>
</properties>

<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
gemmellr marked this conversation as resolved.
Show resolved Hide resolved
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.hawt</groupId>
<artifactId>hawtio-war</artifactId>
<version>${hawtio.version}</version>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-console-war</artifactId>
<type>war</type>
</dependency>

<!-- lets mark dependencies from the WAR as provided to avoid jetty:run adding duplicates -->
<dependency>
<!--<dependency>
gemmellr marked this conversation as resolved.
Show resolved Hide resolved
<groupId>io.hawt</groupId>
<artifactId>hawtio-core</artifactId>
<version>${hawtio.version}</version>
<scope>provided</scope>
</dependency>
</dependency>-->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand All @@ -78,7 +74,10 @@
<useCache>true</useCache>
<packagingExcludes>
**/lib/slf4j*.jar,
**/lib/log4j*.jar
**/lib/log4j*.jar,
**/lib/jolokia-service-discovery*.jar,
**/lib/jolokia-service-history*.jar,
**/lib/jolokia-service-notif*.jar
</packagingExcludes>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
Expand All @@ -87,19 +86,16 @@
<directory>src/main/webapp</directory>
<includes>
<include>**/*.svg</include>
<include>hawtconfig.json</include>
<!-- include any other file types you want to filter -->
</includes>
</resource>
</webResources>
<overlays>
<overlay>
<groupId>io.hawt</groupId>
<artifactId>hawtio-war</artifactId>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-console-war</artifactId>
<excludes>
<exclude>hawtconfig.json</exclude>
<exclude>img/icons/**/*</exclude>
<exclude>img/**/*</exclude>
<exclude>fonts/glyphicons**</exclude>
<exclude>WEB-INF/lib/guava*.jar</exclude>
<exclude>WEB-INF/lib/checker-qual-*.jar</exclude>
<exclude>WEB-INF/lib/error_prone_annotations-*.jar</exclude>
Expand Down
25 changes: 25 additions & 0 deletions artemis-console/src/main/webapp/hawtconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"branding": {
"appName": "Artemis Console",
"showAppName": false,
"appLogoUrl": "img/activemq.png",
"companyLogoUrl": "img/activemq.png",
"css": "css/activemq.css",
"favicon": "img/favicon.png"
},
"login": {
"description": "Login page for Artemis Console.",
"links": [
{ "url": "https://activemq.apache.org/components/artemis/documentation/", "text": "Documentation" },
{ "url": "https://activemq.apache.org/", "text": "Website" }
]
},
"about": {
"title": "ActiveMQ Artemis Management Console",
"productInfo": [{"name": "Artemis", "value": "${project.version}"}],
"additionalInfo": "",
"copyright": " ",
"imgSrc": "img/activemq.png"
},
"disabledRoutes": []
}
10 changes: 0 additions & 10 deletions artemis-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@
<artifactId>artemis-console</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-branding</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-plugin</artifactId>
<type>war</type>
</dependency>
Comment on lines -120 to -129
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is as much a comment on the unaltered bit remaining, as the removals.

The binary distribution assembly has a number of entries in its LICENCE file (and files it references) to do with covering the console bits. Those files haven't been changed here, but it seems almost certain they will need to be. That is, artemis-distribution/src/main/resources/licenses/bin/LICENSE and files under dir artemis-distribution/src/main/resources/licenses/bin/licenses/.

<!-- quorum -->
<dependency>
<groupId>org.apache.activemq</groupId>
Expand Down
24 changes: 0 additions & 24 deletions artemis-distribution/src/main/assembly/dep.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

<!-- Handled later in web subdir for console bits -->
<exclude>org.apache.activemq:artemis-console:war</exclude>
<exclude>org.apache.activemq:activemq-branding:war</exclude>
<exclude>org.apache.activemq:artemis-plugin:war</exclude>
</excludes>
<outputDirectory>lib</outputDirectory>
<unpack>false</unpack>
Expand Down Expand Up @@ -79,28 +77,6 @@
<directoryMode>0755</directoryMode>
<fileMode>0644</fileMode>
</dependencySet>
<dependencySet>
<includes>
<include>org.apache.activemq:activemq-branding:war</include>
</includes>
<outputDirectory>web</outputDirectory>
<unpack>false</unpack>
<outputFileNameMapping>activemq-branding.war</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
<directoryMode>0755</directoryMode>
<fileMode>0644</fileMode>
</dependencySet>
<dependencySet>
<includes>
<include>org.apache.activemq:artemis-plugin:war</include>
</includes>
<outputDirectory>web</outputDirectory>
<unpack>false</unpack>
<outputFileNameMapping>artemis-plugin.war</outputFileNameMapping>
<useProjectArtifact>false</useProjectArtifact>
<directoryMode>0755</directoryMode>
<fileMode>0644</fileMode>
</dependencySet>

</dependencySets>
<fileSets>
Expand Down
Loading