### Run Quarkus Application with Hawtio Source: https://hawt.io/docs/get-started Starts a Quarkus application in development mode with the Hawtio console integrated. After setting up the dependencies, running this command will make the Hawtio console accessible at http://localhost:8080/hawtio. ```bash mvn compile quarkus:dev ``` -------------------------------- ### Install Dependencies with Yarn Source: https://hawt.io/docs/online/develop Installs project dependencies using Yarn. Ensure Yarn v3+ is installed. ```shell $ yarn install ``` -------------------------------- ### Install and Run Hawtio via CLI (JBang) Source: https://hawt.io/docs/get-started Installs and runs the latest Hawtio console using JBang. It allows launching a Hawtio instance and customizing the port. The CLI supports various configuration options for context path, plugins, host, and more. ```bash $ jbang app install hawtio@hawtio/hawtio $ hawtio $ hawtio --port 8090 ``` -------------------------------- ### Hawtio CLI Usage Help Source: https://hawt.io/docs/get-started Displays the usage help for the Hawtio CLI command, detailing all available options and their descriptions for configuring the console, such as context path, plugins directory, host, port, and security settings. ```bash Usage: hawtio [-hjoV] [-c=] [-d=] [-e=] [-H=] [-k=] [-l=] [-p=] [-s=] [-w=] [-n=] Run Hawtio -c, --context-path= Context path. -d, --plugins-dir= Directory to search for .war files to install as 3rd party plugins. -e, --extra-class-path= Extra class path. -h, --help Print usage help and exit. -H, --host= Hostname to listen to. -j, --join Join server thread. -k, --key-store= JKS keyStore with the keys for https. -l, --war-location= Directory to search for .war files. -n, --connection= List of settings for automated connections. -o, --open-url Open the web console automatic in the web browser. -p, --port= Port number. -s, --key-store-pass= Password for the JKS keyStore with the keys for https. -V, --version Print Hawtio version -w, --war= War file or directory of the hawtio web application. ``` -------------------------------- ### Run Embedded Hawtio Console (Java) Source: https://hawt.io/docs/get-started This Java code demonstrates how to initialize and run the embedded Hawtio console within your application. It requires setting the path to the Hawtio WAR file. ```java import io.hawt.embedded.Main; Main main = new Main(); main.setWar(""); main.run(); ``` -------------------------------- ### Hawtio Configuration Example (hawtconfig.json) Source: https://hawt.io/docs/configuration An example of a complete hawtconfig.json file demonstrating the structure for branding, login, about modal, and disabled routes. ```json { "branding": { "appName": "Hawtio Management Console", "showAppName": false, "appLogoUrl": "hawtio-logo.svg", "companyLogoUrl": "hawtio-logo.svg", "css": "", "favicon": "favicon.ico" }, "login": { "description": "Login page for Hawtio Management Console.", "links": [ { "url": "#terms", "text": "Terms of Use" }, { "url": "#help", "text": "Help" }, { "url": "#privacy", "text": "Privacy Policy" } ] }, "about": { "title": "Hawtio Management Console", "description": "A Hawtio reimplementation based on TypeScript + React.", "imgSrc": "hawtio-logo.svg", "productInfo": [ { "name": "ABC", "value": "1.2.3" }, { "name": "XYZ", "value": "7.8.9" } ], "copyright": "© Hawtio project" }, "disabledRoutes": [ "/disabled" ] } ``` -------------------------------- ### Deploy Hawtio WAR to Jetty using XML Configuration Source: https://hawt.io/docs/get-started This XML snippet configures Jetty to deploy the Hawtio WAR application. It sets the context path to `/hawtio` and specifies the location of the WAR file. Note the considerations regarding unpacked WAR directories and symbolic links for proper resource loading. ```xml /hawtio /data/tmp/hawtio-war-4.2.0.war ``` -------------------------------- ### Enable Hawtio and Jolokia Endpoints in application.properties Source: https://hawt.io/docs/get-started Configure your Spring Boot application to enable JMX and expose the Hawtio and Jolokia endpoints by adding these lines to your `application.properties` file. This allows access to the Hawtio console via the `/actuator/hawtio` endpoint. ```properties spring.jmx.enabled = true management.endpoints.web.exposure.include = hawtio,jolokia ``` -------------------------------- ### Add Hawtio Spring Boot Dependencies to pom.xml Source: https://hawt.io/docs/get-started This snippet shows how to add the necessary `hawtio-springboot` and Camel Spring Boot starter dependencies to your `pom.xml` file. Ensure you replace `4.x.y` with the latest Hawtio release version. These dependencies enable Hawtio and Camel management features. ```xml io.hawt hawtio-springboot 4.x.y org.apache.camel.springboot camel-management-starter org.apache.camel.springboot camel-spring-boot-xml-starter ``` -------------------------------- ### ACL Matching Examples for JMX Operations Source: https://hawt.io/docs/online/rbac Illustrates different patterns for matching JMX operations to roles within Hawtio's RBAC configuration. These examples show how to define access control based on operation signatures, arguments, and operation names. ```text uninstall(java.lang.String)[0]: [] # no roles can perform this operation ``` ```text /update\(java\.lang\.String,java\.lang\.String\)\[[1-4]?[0-9],.*\]/: admin ``` ```text delete(java.lang.String): admin ``` ```text dumpStatsAsXml: admin, viewer ``` -------------------------------- ### Example JAAS Configuration with LDAP Login Module Source: https://hawt.io/docs/security This example demonstrates a JAAS configuration file entry for a 'myrealm'. It specifies the use of `com.sun.security.auth.module.LdapLoginModule` for authentication, including LDAP server details and user provider configuration. ```plaintext myrealm { com.sun.security.auth.module.LdapLoginModule REQUIRED userProvider="ldap://localhost:389" authIdentity="uid={USERNAME},ou=users,dc=example,dc=com" useSSL=false debug=true; }; ``` -------------------------------- ### Run Keycloak Container for Hawtio Demo Source: https://hawt.io/docs/oidc This command demonstrates how to start a Keycloak instance using Podman for use with Hawtio's OpenID Connect authentication. It maps the Keycloak port and sets up administrative credentials, preparing Keycloak for realm and client configuration. ```bash podman run -d --name keycloak \ -p 18080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak:latest start-dev ``` -------------------------------- ### Add Hawtio to Quarkus Application Dependencies Source: https://hawt.io/docs/get-started Configures a Quarkus application to include the Hawtio console by adding necessary dependencies to the `pom.xml` file. This includes `hawtio-quarkus` and optional Camel Quarkus extensions for enhanced management features. ```xml io.hawt hawtio-quarkus 4.x.y org.apache.camel.quarkus camel-quarkus-management org.apache.camel.quarkus camel-quarkus-jaxb ``` -------------------------------- ### Aggregate Example Plugin Registration Source: https://hawt.io/docs/developers/applications The examples/index.ts file aggregates individual Hawtio example plugins into a single registration function. This function is called during the application bootstrap process. ```javascript import { registerExample1 } from './example1' export const registerExamples = () => { registerExample1() } ``` -------------------------------- ### Run Hawtio in Namespace Mode Source: https://hawt.io/docs/online/develop Starts the Hawtio console in namespace mode. Requires authentication with the OpenShift API server and specifies the master URL and the current namespace. ```shell $ yarn start --master=`oc whoami --show-server` --mode=namespace --namespace=`oc project -q` ``` -------------------------------- ### Hawtio React: Minimal Setup - Index File Source: https://hawt.io/docs/developers/architecture The entry point for a Hawtio React application, responsible for importing necessary CSS and bootstrapping the application. It imports core Hawtio and Patternfly styles and initiates the application bootstrap process. ```javascript import '@hawtio/react/dist/index.css' import '@patternfly/react-core/dist/styles/base.css' import('./bootstrap') ``` -------------------------------- ### Jetty JAAS User Properties Configuration Source: https://hawt.io/docs/security Example of a `login.properties` file for Jetty JAAS, defining users, their passwords (plain or encrypted), and assigned roles. ```properties scott=tiger,user admin=CRYPT:adpexzg3FUZAk,admin,user ``` -------------------------------- ### Hawtio React: Minimal Setup - Bootstrap File Source: https://hawt.io/docs/developers/architecture The bootstrap file for a Hawtio React application, setting up the React root and rendering the main `` component. It ensures Hawtio services are initialized before rendering the UI, synchronizing component rendering with Hawtio's initialization. ```javascript import React from 'react' import ReactDOM from 'react-dom/client' import { Hawtio } from '@hawtio/react/ui' import { hawtio } from '@hawtio/react' const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) hawtio.bootstrap().then(() => { root.render( , ) }) ``` -------------------------------- ### Adding Hawtio Jetty Module to Jetty Source: https://hawt.io/docs/security Command to add the 'jaas' and 'hawtio-jetty-security' modules to a Jetty base installation. This process initializes the modules and copies the required JAR file. ```shell cd $JETTY_BASE java -jar $JETTY_HOME/start.jar --add-module=jaas,hawtio-jetty-security ``` -------------------------------- ### Statically Import Hawtio Initialization Modules Source: https://hawt.io/docs/developers/architecture This TypeScript code demonstrates how to statically import modules from '@hawtio/react/init'. It includes importing the HawtioInitialization component, configManager, and hawtio for initial setup and displaying initialization UI before the full package is loaded. ```typescript import ReactDOM from 'react-dom/client' import { configManager, hawtio, HawtioInitialization, TaskState } from '@hawtio/react/init' const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render() configManager.addProductInfo('Test App', '1.0.0') hawtio.addUrl('plugin') ... ``` -------------------------------- ### Connect Hawtio CLI to Remote JVM Source: https://hawt.io/docs/get-started Connects the Hawtio CLI directly to a remote JVM by specifying a Jolokia endpoint URL. It supports connecting with a named connection, which can be cached in browser local storage, and connecting to multiple JVMs simultaneously. ```bash $ hawtio --connection=myconn=http://localhost:8778/jolokia/ $ hawtio --connection=myconn $ hawtio --connection=conn1 --connection=conn2 --connection=conn3 ``` -------------------------------- ### Run Keycloak Server with Docker Source: https://hawt.io/docs/keycloak This command starts a Keycloak server instance using a Docker image. It maps port 18080 on the host to port 8080 in the container and sets up administrative credentials. This is a convenient way to quickly set up a Keycloak server for testing or development purposes. ```bash docker run -d --name keycloak \ -p 18080:8080 \ -e KEYCLOAK_ADMIN=admin \ -e KEYCLOAK_ADMIN_PASSWORD=admin \ quay.io/keycloak/keycloak start-dev ``` -------------------------------- ### Keycloak Integration (Deprecated) Source: https://hawt.io/docs/security Starting with Keycloak 25.0.0, Keycloak-specific login modules are no longer available. Integration is now recommended via OpenID Connect. ```markdown __ | Starting with Keycloak 25.0.0, Keycloak specific login modules are no longer available. Keycloak can be used with Hawtio using OpenID Connect Integration. ---|--- ``` -------------------------------- ### Hawtio Example Plugin Component Source: https://hawt.io/docs/developers/applications The Example1.tsx file defines a simple React component that serves as a Hawtio plugin. It displays a page section with a title and descriptive text, intended to be registered via `hawtio.addPlugin()`. ```javascript import { PageSection, PageSectionVariants, Text, TextContent } from '@patternfly/react-core' import React from 'react' export const Example1: React.FunctionComponent = () => ( Example 1 This is an example plugin registered using hawtio.addPlugin(). ) ``` -------------------------------- ### Configure Jolokia Agent via System Properties Source: https://hawt.io/docs/configuration This example illustrates how to configure the Jolokia agent by setting system properties prefixed with `jolokia.`. This allows customization of Jolokia's behavior, such as specifying the location of its access policy file. This configuration is applied to the Hawtio server runtime. ```properties jolokia.policyLocation = file:///opt/hawtio/my-jolokia-access.xml ``` -------------------------------- ### Example JWT Access Token Structure Source: https://hawt.io/docs/oidc This is an example of a JWT access token generated by Keycloak, showcasing the typical claims and structure. It includes information like expiration time, issuer, audience, subject, realm access roles, and user details, which are crucial for Hawtio's JAAS authentication. ```json { "exp": 1709552728, "iat": 1709552428, "jti": "0f33971f-c4f7-4a5c-a240-c18ba3f97aa1", "iss": "http://localhost:18080/realms/hawtio-demo", "aud": "account", "sub": "84d156fa-e4cc-4785-91c1-4e0bda4b8ed9", "typ": "Bearer", "azp": "hawtio-client", "session_state": "181a30ac-fce1-4f4f-aaee-110304ccb0e6", "acr": "1", "allowed-origins": [ "http://0.0.0.0:8181", "http://localhost:8080", "http://localhost:8181", "http://0.0.0.0:10001", "http://0.0.0.0:8080", "http://localhost:10001", "http://localhost:10000", "http://0.0.0.0:10000" ], "realm_access": { "roles": [ "viewer", "manager", "admin", "user" ] }, "resource_access": { "account": { "roles": [ "manage-account", "manage-account-links", "view-profile" ] } }, "scope": "openid profile email", "sid": "181a30ac-fce1-4f4f-aaee-110304ccb0e6", "email_verified": false, "name": "Admin Hawtio", "preferred_username": "admin", "given_name": "Admin", "family_name": "Hawtio", "email": "admin@hawt.io" } ``` -------------------------------- ### Assigning Roles for Hawtio Access in Tomcat Source: https://hawt.io/docs/security Defines roles and assigns them to users within tomcat-users.xml. This example shows how to create a 'manager' role and assign the 'Administrator' role to the 'scott' user, enabling them to log in to Hawtio if the 'hawtio.roles' property is set accordingly. ```xml ``` -------------------------------- ### Create OAuth Client for Cluster Mode Source: https://hawt.io/docs/online/develop Creates an OAuth client configuration for Hawtio in cluster mode. This is necessary for authentication and obtaining OAuth access tokens. ```shell $ oc create -f oauthclient.yml ``` -------------------------------- ### Configure Quarkus Properties-Based Authentication Users Source: https://hawt.io/docs/security Defines users for Hawtio's properties-based authentication in Quarkus by configuring 'application.properties'. This example sets up a user 'hawtio' with password 's3cr3t!' and the role 'admin'. 'quarkus.security.users.embedded.plain-text = true' allows plain-text passwords. ```properties quarkus.security.users.embedded.enabled = true quarkus.security.users.embedded.plain-text = true quarkus.security.users.embedded.users.hawtio = s3cr3t! quarkus.security.users.embedded.roles.hawtio = admin ``` -------------------------------- ### Hawtio Plugin Discovery JSON Structure Source: https://hawt.io/docs/developers/applications Example JSON structure returned by the Hawtio plugin discovery URL. Each object defines a remote Module Federation module, including its URL, scope, module identifier, remote entry file name, and the specific entry point function to load the plugin. This structure mirrors Module Federation's `remote` and `exposes` configurations. ```json [ { "url": "http://localhost:8080/hawtio", "scope": "appRemote", "module": "./remote3", "remoteEntryFileName": "remoteExternalEntry.js", "pluginEntry": "registerRemote" }, { "url": "http://localhost:8080/hawtio", "scope": "appRemote", "module": "./remote3-deferred", "remoteEntryFileName": "remoteExternalEntry.js", "pluginEntry": "registerRemoteDeferred" } ] ``` -------------------------------- ### Run Hawtio in Cluster Mode Source: https://hawt.io/docs/online/develop Starts the Hawtio console in cluster mode. Requires authentication with the OpenShift API server and specifies the master URL. ```shell $ yarn start --master=`oc whoami --show-server` --mode=cluster ``` -------------------------------- ### Disable Hawtio Authentication (Java) Source: https://hawt.io/docs/get-started This Java code snippet shows how to disable the authentication for the embedded Hawtio console by setting a system property. This is useful for development or testing environments. ```java System.setProperty("hawtio.authenticationEnabled", "false"); ``` -------------------------------- ### Add Hawtio Embedded Dependency (Maven) Source: https://hawt.io/docs/get-started This snippet shows how to add the necessary Hawtio embedded dependency to your Maven project's pom.xml file. Replace '4.x.y' with the actual latest release version of Hawtio. ```xml io.hawt hawtio-embedded 4.x.y ``` -------------------------------- ### Configure Hawtio Endpoint Path in application.properties Source: https://hawt.io/docs/get-started Customize the base path for Spring Boot management endpoints and specifically for the Hawtio endpoint. This allows you to change the default `/actuator` prefix or map Hawtio to a custom path like `/hawtio/console`. ```properties management.endpoints.web.base-path = / management.endpoints.web.path-mapping.hawtio = hawtio/console ``` -------------------------------- ### Hawtio React App Entry Point Source: https://hawt.io/docs/developers/applications The bootstrap.tsx file serves as the entry point for a Hawtio React application. It initializes configuration, registers plugins, bootstraps Hawtio, and renders the main Hawtio component using React. ```javascript import { configManager, hawtio, Hawtio, registerPlugins } from '@hawtio/react' import React from 'react' import ReactDOM from 'react-dom/client' import { registerExamples } from './examples' configManager.addProductInfo('Test App', '1.0.0') // Register Hawtio plugins registerPlugins() // Register custom plugins registerExamples() // Bootstrap Hawtio hawtio.bootstrap() // Launch React application const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render( ) ``` -------------------------------- ### Enable Hawtio with Jolokia Java Agent Source: https://hawt.io/docs/faq This command-line instruction shows how to enable Hawtio by attaching the Jolokia Java agent to a Java application. It specifies the agent JAR, host for Jolokia, and the main application JAR. The Jolokia API endpoint is typically accessible at http://localhost:8778/jolokia. ```bash java -javaagent:jolokia-agent-jvm-2.4.1-javaagent.jar=host=0.0.0.0 -jar foo.jar ``` -------------------------------- ### Hawtio App Entry Point (index.ts) Source: https://hawt.io/docs/developers/applications The top-level index.ts file provides a basic entry point for the React application. It imports CSS and asynchronously imports the bootstrap module, initiating the application's startup sequence. ```javascript import './index.css' import('./bootstrap') ``` -------------------------------- ### Initialize Hawtio with Progress Tracking Component Source: https://hawt.io/docs/developers/applications This React/TypeScript code snippet shows how to render the `` component from `@hawtio/react/init`. This component provides visual feedback on the Hawtio initialization process, including loading plugins and configuration. It can be displayed in verbose mode to show detailed status of each initialization item. ```javascript import React from 'react' import ReactDOM from 'react-dom/client' import { configManager, HawtioInitialization } from '@hawtio/react/init' const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render() ``` -------------------------------- ### Apply Jolokia Auth Disable Script Source: https://hawt.io/docs/online/develop Executes a script to apply Jolokia authentication disablement environment variables to all deployments with the label `provider=fabric8`. ```shell $ ./scripts/disable-jolokia-auth.sh ``` -------------------------------- ### Create New Branch using Git Source: https://hawt.io/docs/contributing This command creates and switches to a new branch for your code changes. Replace '' with a descriptive name for your new branch. ```bash git checkout -b ``` -------------------------------- ### Push Changes to Remote Repository using Git Source: https://hawt.io/docs/contributing This command pushes your committed changes from your local branch to the remote repository. Replace '' with the name of the branch you are pushing. ```bash git push origin ``` -------------------------------- ### Register Selected Built-in Hawtio Plugins Source: https://hawt.io/docs/developers/applications Demonstrates how to register specific built-in Hawtio plugins by importing and calling their respective registration functions, such as `camel()` and `jmx()`. This allows for a more granular control over which plugins are enabled. ```javascript import { camel, jmx, ... } from '@hawtio/react' camel() jmx() ... ``` -------------------------------- ### Disable Jolokia Authentication Environment Variables Source: https://hawt.io/docs/online/develop Sets environment variables to disable Jolokia authentication for local Hawtio development. This allows local Hawtio to detect hawtio-enabled applications. ```shell AB_JOLOKIA_AUTH_OPENSHIFT=false AB_JOLOKIA_PASSWORD_RANDOM=false AB_JOLOKIA_OPTS=useSslClientAuthentication=false,protocol=https ``` -------------------------------- ### Clone Repository using Git Source: https://hawt.io/docs/contributing This command clones a forked repository from GitHub to your local machine. Replace '' and '' with your specific GitHub username and the repository's name. ```bash git clone git://github.com//.git ``` -------------------------------- ### Remote Module Federation Plugin Implementation Source: https://hawt.io/docs/developers/applications A sample implementation for a remotely exposed Module Federation module that registers a Hawtio plugin. It dynamically imports `@hawtio/react` and the plugin component, then uses `hawtio.addPlugin` to register it. The function returns a promise, allowing Hawtio to await the plugin registration. ```javascript import { type HawtioAsyncPlugin } from '@hawtio/react' export const registerRemote: HawtioAsyncPlugin = async () => { return import('@hawtio/react').then(async m => { return import('./Remote').then(r => { m.hawtio.addPlugin({ id: 'remote3', title: 'Remote plugin 3 (dynamic, immediate)', path: '/remote3a', component: r.RemotePlugin, isActive: async () => true, }) }) }) } ``` -------------------------------- ### Basic Tomcat User Configuration for Hawtio Source: https://hawt.io/docs/security Defines a simple user with a username, password, and role within Tomcat's tomcat-users.xml file. Hawtio automatically detects and utilizes this configuration for authentication when running within Tomcat. ```xml ``` -------------------------------- ### Tomcat User with Hashed Password for Hawtio Source: https://hawt.io/docs/security An example entry in tomcat-users.xml demonstrating a user with a hashed password, intended for use with Tomcat's MessageDigestCredentialHandler. The password format includes salt, iteration count, and the digest. ```xml ``` -------------------------------- ### Asynchronous Plugin Registration with Hawtio Source: https://hawt.io/docs/developers/applications Demonstrates how to register a plugin asynchronously using `addDeferredPlugin`. This method allows for dynamic `import()` of plugin code, ensuring that the plugin is evaluated only when needed. Hawtio immediately recognizes the plugin's existence, allowing `hawtio.bootstrap()` to be called early while internally managing the deferred evaluation. ```typescript import { hawtio, type HawtioPlugin } from '@hawtio/react' export const registerExample1Deferred: HawtioPlugin = () => { hawtio.addDeferredPlugin('example1', async () => { return import('./Example1').then(m => { return { id: 'example1', title: 'Example 1', path: '/example1', component: m.Example1, isActive: async () => true, } }) }) } ``` -------------------------------- ### Create Service Account for Namespace Mode Source: https://hawt.io/docs/online/develop Creates a service account configuration for Hawtio in namespace mode. This is used for authentication and obtaining OAuth access tokens within a specific namespace. ```shell $ oc create -f serviceaccount.yml ``` -------------------------------- ### Register a Basic Hawtio Plugin Source: https://hawt.io/docs/developers/applications Demonstrates the simplest way to register a Hawtio plugin using the `hawtio.addPlugin()` API. This method takes a plugin object with an ID, title, path, a React component, and an isActive function. ```javascript hawtio.addPlugin({ id: 'example1', title: 'Example 1', path: '/example1', component: () => (Example 1), isActive: async () => true }) ```