Skip to content

Commit e2640c2

Browse files
juanluisrptianon
andauthored
geonetwork: fix Elasticsearch version for 4.4 images (#2674)
* geonetwork: fix Elasticsearch version for 4.4 images The geonetwork:4.4 tag now resolves to 4.4.10, which requires Elasticsearch 8.x. The compose.yaml and quick-start examples still referenced elasticsearch:7.17.15, causing 400 errors due to ES 8 treating text-field aggregations differently. Changes: - compose.yaml: upgrade elasticsearch and kibana to 8.14.3, add xpack.security.enabled=false (required for local ES 8 without TLS), remove Jetty-specific JVM flags, update DB type to postgres, upgrade PostgreSQL to 17-3.5, simplify postgres service (no debug logging) - content.md: update quick-start docker run to ES 8.14.3, add Elasticsearch/GeoNetwork version compatibility table, correct Tomcat/Jetty history note and H2 database path description Fixes: geonetwork/docker-geonetwork#144 * geonetwork: fix compose healthchecks and postgres image - Use postgres:17 instead of postgis/postgis (multi-arch, no PostGIS needed with GEONETWORK_DB_TYPE=postgres) - Database healthcheck: verify geonetwork db/user exist via psql instead of pg_isready (avoids race with PostgreSQL init restart) - GeoNetwork healthcheck: check actual app endpoint, add start_period - Remove pglog volume (no longer needed) * geonetwork: fix markdownfmt and ymlfmt formatting Align the Elasticsearch/GeoNetwork version compatibility table in content.md and fix YAML quoting style issues in compose.yaml to satisfy the CI format checks. * geonetwork: update docs for 4.4.10 and 4.2.15 releases - Bump Elasticsearch and Kibana versions to 8.19.13 in compose.yaml and the quick-start example in content.md - Add REMOTE_IP_INTERNAL_PROXIES env var (new in both 4.4.10 and 4.2.15 with the Jetty-to-Tomcat migration) - Add WEBAPP_CONTEXT_PATH env var for 4.4.x images - Fix ES_INDEX_RECORDS / es.index.records default value: gn-records (hyphen), not gn_records (underscore) * geonetwork: warn about root user in Tomcat-based images Tomcat-based images (GN 3, 4.2.15+, 4.4.10+) run as root, while the previous Jetty-based images ran as the jetty user. Add a file permissions section warning users upgrading from Jetty-based images that they may need to update ownership of existing mounted volumes. * geonetwork: document Jetty-to-Tomcat migration and WEBAPP_CONTEXT_PATH validation Add a new "Upgrading from Jetty-based images" section listing the breaking changes introduced when 4.2.15 and 4.4.10 switched from Jetty to Tomcat: $JETTY_HOME/$JETTY_BASE are no longer set, the webapp path changed, and the startup command changed. Also document the WEBAPP_CONTEXT_PATH format validation added in 4.4.11, which causes the container to exit with an error if the value does not match the expected pattern. * Update geonetwork/content.md Co-authored-by: Tianon Gravi <admwiggin@gmail.com> --------- Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
1 parent 46933f0 commit e2640c2

2 files changed

Lines changed: 50 additions & 20 deletions

File tree

geonetwork/compose.yaml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ volumes:
99
geonetwork:
1010
esdata:
1111
pgdata:
12-
pglog:
1312

1413
services:
1514
geonetwork:
1615
image: geonetwork:4.4
1716
healthcheck:
18-
test: curl http://localhost:8080/
19-
interval: 5s
20-
timeout: 5s
17+
test: curl -f http://localhost:8080/geonetwork/srv/eng/catalog.search || exit 1
18+
interval: 10s
19+
timeout: 10s
2120
retries: 30
21+
start_period: 60s
2222
restart: always
2323
volumes:
2424
- geonetwork:/catalogue-data
@@ -36,9 +36,6 @@ services:
3636
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
3737
-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true
3838
-Xms512M -Xss512M -Xmx2G -XX:+UseConcMarkSweepGC
39-
-Djetty.httpConfig.requestHeaderSize=32768
40-
-Dorg.eclipse.jetty.server.Request.maxFormContentSize=500000
41-
-Dorg.eclipse.jetty.server.Request.maxFormKeys=4000
4239
# For remote debug
4340
# -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
4441

@@ -58,31 +55,29 @@ services:
5855
-Dgeonetwork.ESFeaturesProxy.targetUri=http://elasticsearch:9200/gn-features/{_}
5956
-Dgeonetwork.HttpDashboardProxy.targetUri=http://kibana:5601
6057
61-
GEONETWORK_DB_TYPE: postgres-postgis
58+
GEONETWORK_DB_TYPE: postgres
6259
GEONETWORK_DB_HOST: database
6360
GEONETWORK_DB_PORT: 5432
6461
GEONETWORK_DB_NAME: geonetwork
6562
GEONETWORK_DB_USERNAME: geonetwork
6663
GEONETWORK_DB_PASSWORD: geonetwork
6764

6865
database:
69-
image: postgis/postgis:16-3.4
66+
image: postgres:17
7067
environment:
7168
POSTGRES_USER: geonetwork
7269
POSTGRES_PASSWORD: geonetwork
7370
POSTGRES_DB: geonetwork
74-
command: [postgres, -c, log_statement=all, -c, logging_collector=true, -c, log_file_mode=0644, -c, log_directory=/var/log/postgresql, -c, log_filename=postgresql.log]
7571
healthcheck:
76-
test: [CMD-SHELL, pg_isready -U postgres]
72+
test: [CMD-SHELL, psql -U geonetwork -d geonetwork -c 'select 1' > /dev/null 2>&1 || exit 1]
7773
interval: 5s
7874
timeout: 5s
7975
retries: 5
8076
volumes:
8177
- pgdata:/var/lib/postgresql/data
82-
- pglog:/var/log/postgresql
8378

8479
elasticsearch:
85-
image: elasticsearch:7.17.15
80+
image: elasticsearch:8.19.13
8681
ports:
8782
- 9200:9200
8883
ulimits:
@@ -101,11 +96,13 @@ services:
10196
environment:
10297
ES_JAVA_OPTS: -Xms1G -Xmx1G
10398
discovery.type: single-node
99+
xpack.security.enabled: 'false'
100+
xpack.security.enrollment.enabled: 'false'
104101
volumes:
105102
- esdata:/usr/share/elasticsearch/data
106103

107104
kibana:
108-
image: kibana:7.17.15
105+
image: kibana:8.19.13
109106
environment:
110107
SERVER_NAME: kibana
111108
ELASTICSEARCH_URL: http://elasticsearch:9200/

geonetwork/content.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ GeoNetwork 4 uses an Elasticsearch server to store the index of the documents it
1919
This is a quick example of how to get GeoNetwork 4.4 Latest up and running for demo purposes. This configuration doesn't keep the data if containers are removed.
2020

2121
```console
22-
docker pull elasticsearch:7.17.15
22+
docker pull elasticsearch:8.19.13
2323
docker pull %%IMAGE%%:4
2424

2525
docker network create gn-network
2626

27-
docker run -d --name my-es-host --network gn-network -e "discovery.type=single-node" elasticsearch:7.17.15
27+
docker run -d --name my-es-host --network gn-network -e "discovery.type=single-node" -e "xpack.security.enabled=false" elasticsearch:8.19.13
2828
docker run --name %%REPO%%-host --network gn-network -e GN_CONFIG_PROPERTIES="-Des.host=my-es-host -Des.protocol=http -Des.port=9200 -Des.url=http://my-es-host:9200" -p 8080:8080 %%IMAGE%%:4
2929
```
3030

@@ -42,6 +42,17 @@ docker run --name %%REPO%%-host --network gn-network -e ES_HOST=my-es-host -e ES
4242

4343
To be sure about what Elasticsearch version to use you can check the [GeoNetwork documentation](https://docs.geonetwork-opensource.org/4.4/install-guide/installing-index/) for your GN version or the `es.version` property in the [`pom.xml`](https://github.com/geonetwork/core-geonetwork/blob/main/pom.xml#L1528C17-L1528C24) file of the GeoNetwork release used.
4444

45+
The following table summarises the required Elasticsearch version for each GeoNetwork release series:
46+
47+
| GeoNetwork version | Elasticsearch version |
48+
|--------------------|-----------------------|
49+
| 4.0.0 - 4.0.5 | 7.9.2 |
50+
| 4.0.6 - 4.2.7 | 7.11.1 |
51+
| 4.2.8 - 4.4.2 | 7.17.x |
52+
| 4.4.3 - 4.4.5 | 8.11.3 |
53+
| 4.4.6 - 4.4.9 | 8.14.3 |
54+
| 4.4.10+ | 8.19.13 |
55+
4556
### Default credentials
4657

4758
After installation, use the default credentials: **`admin`** (username) and **`admin`** (password). It is recommended to update the default password after installation.
@@ -56,11 +67,16 @@ Since GeoNetwork 4.4.0, use Java properties passed in the `GN_CONFIG_PROPERTIES`
5667
- `es.port` *optional* (default `9200`): The port where Elasticsearch server is listening to.
5768
- `es.protocol` *optional* (default `http`): The protocol used to talk to Elasticsearch. Can be `http` or `https`.
5869
- `es.url`: **mandatory if host, port or protocol aren't the default values** (default `http://localhost:9200`): Full URL of the Elasticsearch server.
59-
- `es.index.records` *optional* (default `gn_records`): In case you have more than GeoNetwork instance using the same Elasticsearch cluster each one needs to use a different index name. Use this variable to define the name of the index used by each GeoNetwork.
70+
- `es.index.records` *optional* (default `gn-records`): In case you have more than GeoNetwork instance using the same Elasticsearch cluster each one needs to use a different index name. Use this variable to define the name of the index used by each GeoNetwork.
6071
- `es.username` *optional* (default empty): username used to connect to Elasticsearch.
6172
- `es.password` *optional* (default empty): password used to connect to Elasticsearch.
6273
- `kb.url` *optional* (default `http://localhost:5601`): The URL where Kibana is listening.
6374

75+
The following environment variables are also available for 4.4.x images:
76+
77+
- `WEBAPP_CONTEXT_PATH` *optional* (default `/geonetwork`): The context path used to deploy GeoNetwork. Since 4.4.11, the value must start with `/` followed by one or more letters, digits, hyphens, or underscores (e.g. `/geonetwork`); an invalid value causes the container to exit with an error at startup.
78+
- `REMOTE_IP_INTERNAL_PROXIES` *optional* (since 4.4.10): Regular expression matching IP addresses of trusted reverse proxies. Enables `X-Forwarded-For` header processing for correct client IP detection behind a proxy. When not set, the RemoteIp Valve is disabled. Example: `192\.168\.0\.10|192\.168\.0\.11`.
79+
6480
Example Docker Compose YAML snippet:
6581

6682
```yaml
@@ -85,10 +101,11 @@ For versions older than 4.4.0, configure Elasticsearch using environment variabl
85101
- `ES_HOST` **mandatory**: The host name of the Elasticsearch server.
86102
- `ES_PORT` *optional* (default `9200`): The port where Elasticsearch server is listening to.
87103
- `ES_PROTOCOL` *optional* (default `http`): The protocol used to talk to Elasticsearch. Can be `http` or `https`.
88-
- `ES_INDEX_RECORDS` *optional* (default `gn_records`): In case you have more than GeoNetwork instance using the same Elasticsearch cluster each one needs to use a different index name. Use this variable to define the name of the index used by each GeoNetwork.
104+
- `ES_INDEX_RECORDS` *optional* (default `gn-records`): In case you have more than GeoNetwork instance using the same Elasticsearch cluster each one needs to use a different index name. Use this variable to define the name of the index used by each GeoNetwork.
89105
- `ES_USERNAME` *optional* (default empty): username used to connect to Elasticsearch.
90106
- `ES_PASSWORD` *optional* (default empty): password used to connect to Elasticsearch.
91107
- `KB_URL` *Optional* (default `http://localhost:5601`): The URL where Kibana is listening.
108+
- `REMOTE_IP_INTERNAL_PROXIES` *optional* (since 4.2.15): Regular expression matching IP addresses of trusted reverse proxies. Enables `X-Forwarded-For` header processing for correct client IP detection behind a proxy. When not set, the RemoteIp Valve is disabled. Example: `192\.168\.0\.10|192\.168\.0\.11`.
92109

93110
### Database configuration
94111

@@ -104,7 +121,7 @@ By default GeoNetwork uses a local **H2 database** for demo use (this one is **n
104121

105122
### Start GeoNetwork
106123

107-
This command will start a debian-based container, running a Tomcat (GN 3) or Jetty (GN 4) web server, with a GeoNetwork WAR deployed on the server:
124+
This command will start a Debian-based container, running a Tomcat web server, with a GeoNetwork WAR deployed on the server. Note: GeoNetwork 4.0.0-4.2.14 and 4.4.0-4.4.9 used Jetty 9 instead of Tomcat.
108125

109126
```console
110127
docker run --name some-%%REPO%% -d %%IMAGE%%
@@ -120,11 +137,27 @@ docker run --name some-%%REPO%% -d -p 8080:8080 %%IMAGE%%
120137

121138
Then, if you are running docker on Linux, you may access geonetwork at http://localhost:8080/geonetwork.
122139

140+
### File permissions
141+
142+
The Tomcat-based images (GN 3, 4.2.15+, and 4.4.10+) run as `root`, whereas the previous Jetty-based images (GN 4.0.0-4.2.14 and 4.4.0-4.4.9) ran as the `jetty` user. If you are **upgrading from a Jetty-based image** and mounting a host directory or named volume for the data directory, you may need to update the ownership of existing data to avoid permission errors:
143+
144+
```console
145+
$ docker run --rm -v /host/%%REPO%%-docker:/catalogue-data busybox chown -R root:root /catalogue-data
146+
```
147+
148+
### Upgrading from Jetty-based images
149+
150+
The switch from Jetty to Tomcat (GN 4.2.15+ and 4.4.10+) introduces additional breaking changes beyond file ownership for users who extend these images or reference Jetty-specific paths in custom scripts:
151+
152+
- `$JETTY_HOME` and `$JETTY_BASE` environment variables are no longer set.
153+
- The GeoNetwork web application path changed: it is now at `/usr/local/tomcat/webapps/geonetwork/` (GN 4.2.x) or `/opt/geonetwork/` (GN 4.4.10+), replacing the previous `/var/lib/jetty/webapps/geonetwork/`.
154+
- The container startup command is now `catalina.sh run` instead of `java -jar /usr/local/jetty/start.jar`.
155+
123156
### Set the data directory and H2 db file
124157

125158
The data directory is the location on the file system where the catalog stores much of its custom configuration and uploaded files. It is also where it stores a number of support files, used for various purposes (e.g.: spatial index, thumbnails). The default variant also uses a local H2 database to store the metadata catalog itself.
126159

127-
By default, GeoNetwork sets the data directory on `/opt/geonetwork/WEB-INF/data` and H2 database file to the Jetty dir `/var/lib/jetty/gn.h2.db` (since GN 4.0.0) or Tomcat `/usr/local/tomcat/gn.h2.db` (for GN 3), but you may override these values by injecting environment variables into the container: - `-e DATA_DIR=...` (defaults to `/opt/geonetwork/WEB-INF/data`) and `-e GEONETWORK_DB_NAME=...` (defaults to `gn` which sets up database `gn.h2.db` in tomcat bin dir `/usr/local/tomcat`). Note that setting the database location via `GEONETWORK_DB_NAME` only works from version 3.10.3 onwards.
160+
By default, GeoNetwork sets the data directory on `/opt/geonetwork/WEB-INF/data` and the H2 database file to `/usr/local/tomcat/gn.h2.db` (Tomcat-based images: GN 3, 4.2.15+, and 4.4.10+) or `/var/lib/jetty/gn.h2.db` (Jetty-based images: GN 4.0.0-4.2.14 and 4.4.0-4.4.9), but you may override these values by injecting environment variables into the container: - `-e DATA_DIR=...` (defaults to `/opt/geonetwork/WEB-INF/data`) and `-e GEONETWORK_DB_NAME=...` (defaults to `gn` which sets up database `gn.h2.db` in tomcat bin dir `/usr/local/tomcat`). Note that setting the database location via `GEONETWORK_DB_NAME` only works from version 3.10.3 onwards.
128161

129162
Since version 4.4.0 the data directory needs to be configued using Java properties passed in the `GN_CONFIG_PROPERTIES` environment variable. For example:
130163

0 commit comments

Comments
 (0)