Skip to content

Commit 03d9ac8

Browse files
grgrzybektadayosi
authored andcommitted
docs: Add section about Jetty deployment
1 parent 0cbaa41 commit 03d9ac8

File tree

2 files changed

+45
-7
lines changed

2 files changed

+45
-7
lines changed

modules/ROOT/pages/configuration.adoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ NOTE: For the configuration properties related to security and authentication, r
4545

4646
For Quarkus, all those properties are configurable in `application.properties` or `application.yaml` with the `quarkus.hawtio.` prefix. For example:
4747

48-
[source,java]
48+
[source,properties]
4949
.application.properties
5050
----
5151
quarkus.hawtio.disableProxy = true
@@ -55,19 +55,19 @@ quarkus.hawtio.disableProxy = true
5555

5656
For Spring Boot, all those properties are configurable in `application.properties` or `application.yaml` as is. For example:
5757

58-
[source,java]
58+
[source,properties]
5959
.application.properties
6060
----
6161
hawtio.disableProxy = true
6262
----
6363

6464
== Configuring Jolokia through System properties
6565

66-
The Jolokia agent is deployed automatically with `io.hawt.web.JolokiaConfiguredAgentServlet` that extends Jolokia native `org.jolokia.http.AgentServlet` class, defined in `hawtio-war/WEB-INF/web.xml`.
66+
The Jolokia agent is deployed automatically with `io.hawt.web.JolokiaConfiguredAgentServlet` that extends Jolokia native `org.jolokia.server.core.http.AgentServlet` class, defined in `hawtio-war/WEB-INF/web.xml`.
6767

6868
If you want to customize the Jolokia Servlet with the configuration parameters that are defined in the https://jolokia.org/reference/html/manual/agents.html#agent-war-init-params[Jolokia documentation], you can pass them as System properties prefixed with `jolokia.`. For example:
6969

70-
[source,java]
70+
[source,properties]
7171
----
7272
jolokia.policyLocation = file:///opt/hawtio/my-jolokia-access.xml
7373
----
@@ -83,11 +83,12 @@ WARNING: You cannot use Hawtio RBAC with Quarkus and Spring Boot yet. Enabling t
8383

8484
To activate the Hawtio RBAC restrictor, configure the Jolokia parameter `restrictorClass` via System property to use `io.hawt.web.RBACRestrictor` as follows:
8585

86-
[source,java]
86+
[source,properties]
8787
----
8888
jolokia.restrictorClass = io.hawt.system.RBACRestrictor
8989
----
9090

91+
[#_hawtconfig_json]
9192
== hawtconfig.json
9293

9394
`hawtconfig.json` is the entrypoint JSON file for configuring the frontend console of Hawtio. It can be used to customise the various parts of the console: the branding, styles and basic UI parts such as the login page and about modal, as well as the console-specific behaviours of some of the Hawtio plugins.

modules/ROOT/pages/get-started.adoc

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,49 @@ A good MBean for real time values and charts is `java.lang/OperatingSystem`. Try
211211

212212
== Deploying on a Servlet container
213213

214-
If you use Tomcat or Jetty, you can deploy the Hawtio WAR file.
214+
If you use https://tomcat.apache.org/[Apache Tomcat] or https://jetty.org/[Eclipse Jetty], you can deploy the Hawtio WAR file.
215215

216-
https://github.com/hawtio/hawtio/releases/latest[Download hawtio-default.war,window=_blank]
216+
https://github.com/hawtio/hawtio/releases/latest[Download hawtio-default.war from GitHub,window=_blank]
217217

218218
Please read xref:configuration.adoc[] to see how to configure the console, or in particular for security see xref:security.adoc[].
219219

220+
=== Deploying to Apache Tomcat
221+
222+
Standard https://tomcat.apache.org/[Apache Tomcat] distribution is ready to use unpacking and Hawtio WAR application can simply be copied into `$TOMCAT_HOME/webapps`.
223+
224+
=== Deploying to Eclipse Jetty
225+
226+
Jetty distribution is https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/[available in Maven Central] as `org.eclipse.jetty:jetty-home` Maven artifacts.
227+
228+
With Jetty 12, it is not possible to simply start the server after unzipping `jetty-home.zip` archive. The recommended way is to create a _Jetty Base_ directory and start from there after adding necessary _modules_. See https://jetty.org/docs/jetty/12/operations-guide/begin/index.html#quick-setup[Jetty Quick Setup] for details.
229+
230+
After setting up _base_ location, it is enough to simply add `http` and `ee10-deploy` (Jetty 12) or `deploy` (Jetty 11) module - all required modules will be used automatically.
231+
232+
However we recommend to explicitly add the modules on which `ee10-deploy` (or `deploy`) module depends - all template configuration files will then be available in `$JETTY_BASE/start.d/` directory.
233+
234+
Because Hawtio can be configured using System properties, we can make configuration easier by adding Jetty's `jvm` module, so all configuration properties can be stored in `$JETTY_BASE/start.d/jvm.ini`.
235+
236+
==== Jetty XML deployment
237+
238+
It is possible to https://jetty.org/docs/jetty/12/operations-guide/deploy/index.html#context-xml[deploy Jetty XML file instead of actual WAR application], so when there's `hawtio.war` located in your local filesystem, it is possible to drop this file int o `$JETTY_BASE/webapps`:
239+
240+
[source,xml]
241+
----
242+
<?xml version="1.0" encoding="UTF-8"?>
243+
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://jetty.org/configure_10_0.dtd">
244+
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext">
245+
<Set name="contextPath">/hawtio</Set>
246+
<Set name="war">/data/tmp/hawtio-war-4.2.0.war</Set>
247+
</Configure>
248+
----
249+
250+
But there's a trick here. Normally Jetty unpacks this WAR archive to a temporary folder (which may be specified with `-Djava.io.tmpdir` system property). But there's no need for unpacking if there's `hawtio-war-4.2.0` _directory_ next to `hawtio-war-4.2.0.war` achive.
251+
252+
Jetty uses `org.eclipse.jetty.server.SymlinkAllowedResourceAliasChecker` _alias checker_ and if
253+
_real path_ for the above `/data/tmp/hawtio-war-4.2.0` is different (i.e., the path uses symbolic links), resources from this WAR application won't be loaded and Hawtio application won't work.
254+
255+
NOTE:: This may be a problem when using such XML deployment when `hawtio.war` is located in Maven project, because `maven-war-plugin` usually keeps `hawtio-war-<version>` directory and `hawtio-war-<version>.war` archive in the same `target/` location.
256+
220257
== Using Hawtio embedded in a Java application
221258

222259
You can also embed Hawtio inside your Java application instead of deploying it on a servlet container or application server.

0 commit comments

Comments
 (0)