Skip to content

Commit ce4f62a

Browse files
authored
updated hop web build instructions. fixes #4713 (#6104)
1 parent 02eacec commit ce4f62a

1 file changed

Lines changed: 143 additions & 19 deletions

File tree

  • docs/hop-dev-manual/modules/ROOT/pages/hopweb

docs/hop-dev-manual/modules/ROOT/pages/hopweb/index.adoc

Lines changed: 143 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,22 @@ Follow the steps in this guid to learn how you can build your own Hop Web instal
2828

2929
WARNING: Hop Web is built with https://eclipse.dev/rap/demos/[Eclipse RAP], and translates the default Hop Gui desktop application into a web version. It is functional, but there are limitations. Feel free to https://hop.apache.org/community/contributing/[contribute] if you'd like to improve Hop Web.
3030

31+
== Prerequisites
32+
33+
Before starting, ensure you have:
34+
35+
* **Java 17** installed and available in your PATH
36+
* **Apache Hop** built from source (run `mvn clean install -DskipTests` in the Hop source directory)
37+
* **Apache Tomcat 10** downloaded and extracted
38+
3139
== Build Hop
3240

3341
Hop currently doesn't offer any standalone Hop Web builds.
3442

3543
Running your own Hop Web environment is straightforward but requires you to build Hop. Follow the xref:setup-dev-environment.adoc[development environment setup] guide to get the Hop source code and build Hop.
3644

45+
After building Hop, note the path to your Hop build directory (e.g., `~/git-hop/hop`). You'll need to run the commands below from this directory.
46+
3747
The steps to set up the default Docker image are included in a helper script `docker/create_hop_web_container.sh` in the Hop code base.
3848
This should get you started to make modifications or create your own version entirely.
3949

@@ -45,30 +55,71 @@ Additional info in xref:hopweb/developer-guide.adoc#_building_the_hop_web_docker
4555

4656
We'll use Apache Tomcat in this example. If you use another application server, the process should be similar.
4757

48-
Hop 2.x is built with Java 17, so you'll need to https://tomcat.apache.org/download-90.cgi[download the latest Tomcat 9].
58+
Hop 2.x is built with Java 17, so you'll need to https://tomcat.apache.org/download-10.cgi[download the latest Tomcat 10] (or use the official Tomcat 10 Docker image).
4959

5060
Copy or extract the following files from your Hop build, where `$CATALINA_HOME` is your Tomcat installation folder.
5161

5262
[source,bash]
5363
----
64+
# Set CATALINA_HOME if it's not already set (replace with your actual Tomcat installation path)
65+
export CATALINA_HOME="${CATALINA_HOME:-/path/to/your/tomcat}"
66+
67+
# Step 1: Extract webapp to ROOT directory (not /hop/)
68+
unzip -o assemblies/web/target/hop.war -d $CATALINA_HOME/webapps/ROOT/
69+
70+
# Step 2: Extract client distribution (contains config, libs, plugins, JDBC drivers)
71+
unzip -o assemblies/client/target/hop-client-*.zip -d /tmp/hop-client/
72+
73+
# Step 3: Copy config folder
74+
cp -r /tmp/hop-client/hop/config $CATALINA_HOME/webapps/ROOT/
75+
76+
# Step 4: Copy core libraries
77+
cp -r /tmp/hop-client/hop/lib/core/* $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/
78+
79+
# Step 4b: Remove RCP jar (RCP is for desktop GUI, not web)
80+
rm -f $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/hop-ui-rcp-*.jar
81+
82+
# Step 5: Copy beam libraries
83+
cp -r /tmp/hop-client/hop/lib/beam/* $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/
84+
85+
# Step 6: Copy plugins
86+
cp -r /tmp/hop-client/hop/plugins $CATALINA_HOME/
87+
88+
# Step 7: Copy JDBC drivers
89+
mkdir -p $CATALINA_HOME/jdbc-drivers
90+
cp -r /tmp/hop-client/hop/lib/jdbc/* $CATALINA_HOME/jdbc-drivers/
5491
55-
#unzip files for docker image
56-
unzip assemblies/web/target/hop.war -d $CATALINA_HOME/webapps/hop/
57-
unzip assemblies/plugins/dist/target/hop-assemblies-*.zip -d $CATALINA_HOME/
92+
# Step 8: Cleanup
93+
rm -rf /tmp/hop-client
5894
----
5995

6096
=== Modify startup script
6197

62-
Configure Tomcat to run Hop by adding the information below to `$CATALINA_HOME/bin/startup.sh`, anywhere before the last line (`exec "$PRGDIR"/"$EXECUTABLE" start "$@"`)
98+
Configure Tomcat to run Hop by adding the information below to `$CATALINA_HOME/bin/startup.sh`.
99+
100+
**Important**: You must insert these environment variables and `CATALINA_OPTS` *before* the `exec` line that starts Tomcat. The `exec` line should be the last line in the file and looks like:
101+
102+
[source,bash]
103+
----
104+
exec "$PRGDIR"/"$EXECUTABLE" start "$@"
105+
----
106+
107+
To find the correct insertion point:
108+
1. Open `$CATALINA_HOME/bin/startup.sh` in a text editor
109+
2. Search for the line containing `exec "$PRGDIR"/"$EXECUTABLE" start "$@"`
110+
3. Insert the code block below *immediately before* that line
111+
4. Ensure there is only *one* `exec` line in the file (if you see multiple, remove any duplicates after the first one)
112+
113+
Add the following code block:
63114

64115
[source,bash]
65116
----
66117
67118
export HOP_AES_ENCODER_KEY=
68119
# specify where Hop should store audit information
69-
export HOP_AUDIT_FOLDER="${CATALINA_HOME}/webapps/hop/audit"
120+
export HOP_AUDIT_FOLDER="${CATALINA_HOME}/webapps/ROOT/audit"
70121
# specify where Hop should manage configuration metadata (e.g. projects and environments information).
71-
export HOP_CONFIG_FOLDER="${CATALINA_HOME}/webapps/hop/config"
122+
export HOP_CONFIG_FOLDER="${CATALINA_HOME}/webapps/ROOT/config"
72123
# specify the hop log level
73124
export HOP_LOG_LEVEL="Basic"
74125
# any additional JRE settings you want to pass on
@@ -78,22 +129,27 @@ export HOP_PASSWORD_ENCODER_PLUGIN="Hop"
78129
# point Hop to the plugins folder
79130
export HOP_PLUGIN_BASE_FOLDERS="${CATALINA_HOME}/plugins"
80131
# path to jdbc drivers
81-
export HOP_SHARED_JDBC_FOLDERS=
132+
export HOP_SHARED_JDBC_FOLDERS="${CATALINA_HOME}/jdbc-drivers"
82133
# the theme to use (dark or light)
83134
export HOP_WEB_THEME="light"
84135
85136
# Set TOMCAT start variables
86-
export CATALINA_OPTS='${HOP_OPTIONS} -DHOP_AES_ENCODER_KEY="${HOP_AES_ENCODER_KEY}" -DHOP_AUDIT_FOLDER="${HOP_AUDIT_FOLDER}" -DHOP_CONFIG_FOLDER="${HOP_CONFIG_FOLDER}" -DHOP_LOG_LEVEL="${HOP_LOG_LEVEL}" -DHOP_PASSWORD_ENCODER_PLUGIN="${HOP_PASSWORD_ENCODER_PLUGIN}" -DHOP_PLUGIN_BASE_FOLDERS="${HOP_PLUGIN_BASE_FOLDERS}" -DHOP_SHARED_JDBC_FOLDERS="${HOP_SHARED_JDBC_FOLDERS}" -DHOP_WEB_THEME="${HOP_WEB_THEME}"'
137+
# Note: Use double quotes so shell variables are expanded before being passed to JVM
138+
export CATALINA_OPTS="${HOP_OPTIONS} -DHOP_AES_ENCODER_KEY=\"${HOP_AES_ENCODER_KEY}\" -DHOP_AUDIT_FOLDER=\"${HOP_AUDIT_FOLDER}\" -DHOP_CONFIG_FOLDER=\"${HOP_CONFIG_FOLDER}\" -DHOP_LOG_LEVEL=\"${HOP_LOG_LEVEL}\" -DHOP_PASSWORD_ENCODER_PLUGIN=\"${HOP_PASSWORD_ENCODER_PLUGIN}\" -DHOP_PLUGIN_BASE_FOLDERS=\"${HOP_PLUGIN_BASE_FOLDERS}\" -DHOP_SHARED_JDBC_FOLDERS=\"${HOP_SHARED_JDBC_FOLDERS}\" -DHOP_WEB_THEME=\"${HOP_WEB_THEME}\""
87139
88140
----
89141

90142
=== Project settings
91143

92144
If you want to run Hop Web with the `default` and `samples` projects, make sure the project root path in `hop-config.json` is set to `{openvar}HOP_CONFIG_FOLDER{closevar}.
93145

94-
On Linux or Mac, use the following sed command to fix this in one line:
146+
On Linux, use the following sed command to fix this in one line:
147+
148+
`sed -i 's/config\/projects/{openvar}HOP_CONFIG_FOLDER{closevar}\/projects/g' ${CATALINA_HOME}/webapps/ROOT/config/hop-config.json`
149+
150+
On macOS, use (note the empty string '' after -i):
95151

96-
`sed -i 's/config\/projects/{openvar}HOP_CONFIG_FOLDER{closevar}\/projects/g' webapps/hop/config/hop-config.json`
152+
`sed -i '' 's/config\/projects/{openvar}HOP_CONFIG_FOLDER{closevar}\/projects/g' ${CATALINA_HOME}/webapps/ROOT/config/hop-config.json`
97153

98154
On Windows, modify `hop-config.json` to make sure `projectsConf` looks like the one below:
99155

@@ -122,16 +178,26 @@ On Windows, modify `hop-config.json` to make sure `projectsConf` looks like the
122178

123179
To make sure all hop scripts are accessible and work correctly with Hop Web, update their classpaths:
124180

125-
This can be done with a couple of `sed` commands on Mac and Linux:
181+
This can be done with a couple of `sed` commands. On Linux:
126182

127183
[source, bash]
128184
----
129-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-run.sh
130-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-conf.sh
131-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-search.sh
132-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-encrypt.sh
133-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-import.sh
134-
RUN sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-search.sh
185+
sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-run.sh
186+
sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-conf.sh
187+
sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-search.sh
188+
sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-encrypt.sh
189+
sed -i 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-import.sh
190+
----
191+
192+
On macOS, use (note the empty string '' after -i):
193+
194+
[source, bash]
195+
----
196+
sed -i '' 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-run.sh
197+
sed -i '' 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-conf.sh
198+
sed -i '' 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-search.sh
199+
sed -i '' 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-encrypt.sh
200+
sed -i '' 's&lib/core/*&../../lib/*:WEB-INF/lib/*:lib/core/*&g' ${CATALINA_HOME}/webapps/ROOT/hop-import.sh
135201
----
136202

137203
The `CLASSPATH` lines in the various scripts should look similar to the one below after editing:
@@ -145,14 +211,72 @@ Once the classpaths have been updated, make sure to make the scripts executable:
145211

146212
=== Start Tomcat
147213

214+
Before starting Tomcat, ensure the Tomcat scripts are executable. The startup script requires several other scripts (`catalina.sh`, `setclasspath.sh`, etc.) to be executable as well. Make all scripts executable with:
215+
216+
`chmod +x {openvar}CATALINA_HOME{closevar}/bin/*.sh`
217+
148218
Run `bin/startup.sh` (Linux/Mac) or `bin/startup.bat` (Windows).
149219

150220
Hop Web should only take a couple of seconds to start.
151221

152-
Access through http://localhost:8080/hop/ui to test.
222+
=== Verify Installation
223+
224+
After starting Tomcat, verify the installation:
225+
226+
1. **Check Tomcat logs** for successful startup:
227+
`tail -f $CATALINA_HOME/logs/catalina.out`
228+
Look for: "Server startup" and "Hop - Projects enabled"
229+
230+
2. **Verify port 8080 is listening**:
231+
`lsof -i :8080` (Linux/Mac) or `netstat -an | grep 8080` (Linux)
232+
233+
3. **Access Hop Web**:
234+
Open http://localhost:8080/ui in your browser
153235

154236
image:hop-web.png[Hop Web, width="90%"]
155237

238+
== Troubleshooting
239+
240+
=== Tomcat won't start
241+
242+
* **Check Tomcat logs**: `$CATALINA_HOME/logs/catalina.out` for errors
243+
* **Verify Java 17**: Run `java -version` (should show version 17)
244+
* **Check port availability**: `lsof -i :8080` (Linux/Mac) - port 8080 must be free
245+
246+
=== Permission denied errors
247+
248+
* **Make scripts executable**: `chmod +x $CATALINA_HOME/bin/*.sh`
249+
* **Check file permissions**: Ensure webapp files are readable
250+
251+
=== ClassNotFoundException or missing libraries
252+
253+
* **Verify libraries copied**: `ls $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/ | wc -l` (should show 100+ files)
254+
* **Check core/beam libraries**: Ensure Step 4 and Step 5 completed successfully
255+
* **Verify script classpaths**: Check that sed commands updated the CLASSPATH in scripts
256+
257+
=== Hop Web shows 404 or blank page
258+
259+
* **Verify webapp location**: Should be in `webapps/ROOT/` (not `webapps/hop/`)
260+
* **Check access URL**: Use http://localhost:8080/ui (not `/hop/ui`)
261+
* **Check Tomcat logs**: Look for deployment errors in `catalina.out`
262+
263+
=== RCP or SWT-related errors
264+
265+
* **Remove RCP jar**: Ensure Step 4b removed `hop-ui-rcp-*.jar`
266+
* **Verify removal**: `ls $CATALINA_HOME/webapps/ROOT/WEB-INF/lib/*rcp*` (should show nothing)
267+
268+
=== Environment variables not working
269+
270+
* **Check startup.sh**: Verify variables were added before the `exec` line
271+
* **Verify syntax**: `grep HOP_CONFIG_FOLDER $CATALINA_HOME/bin/startup.sh`
272+
* **Restart Tomcat**: Always restart after modifying `startup.sh`
273+
274+
=== Projects not found
275+
276+
* **Check hop-config.json**: Verify paths were updated with sed command
277+
* **Verify variable substitution**: `grep HOP_CONFIG_FOLDER $CATALINA_HOME/webapps/ROOT/config/hop-config.json`
278+
* **Check project directories**: `ls $CATALINA_HOME/webapps/ROOT/config/projects/`
279+
156280
== Additional Guides
157281

158282
* xref:hopweb/developer-guide.adoc[Developer Guide]

0 commit comments

Comments
 (0)