Skip to content

Commit e7d520b

Browse files
Enforce development environment instructions to Elasticsearch 8.11.3 (geonetwork#7866)
* docker - missing mentioned kibana configuration - missing kibana configuration provided by Pierre Mauduit (via geonetwork#6284) - using latest geonetwork image (rather htan 3.99.0) - Setup and document docker folder as independent testing environments * reorder es/README.md to list recommended best practice first * Use enforcer plugin to check es/README.md and es/docker-compose.yml * Also enforce version check of es-dashboard/README.md * Additional troubleshooting advise for low disk space and blocked index read-only * Apply suggestions from code review Accept feedback from review Co-authored-by: Jose García <[email protected]> --------- Co-authored-by: Jose García <[email protected]>
1 parent 9bc4ad5 commit e7d520b

File tree

10 files changed

+273
-69
lines changed

10 files changed

+273
-69
lines changed

docker/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Docker Test Environments
2+
3+
These docker images are intended for development and debugging. For production we recommend the official GeoNetwork docker images at https://github.com/geonetwork/docker-geonetwork.git repository.

docker/docker-geonetwork.txt

-1
This file was deleted.

docker/gn-cas-ldap/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# Introduction
1+
# GeoNetwork CAS Test Environment
22

33
This composition is meant to make runtime testing the CAS integration of
44
GeoNetwork easier.
55

66
This composition also integrates a LDAP, so that testing the
77
config-spring-cas-ldap configuration is also possible.
88

9+
These docker images are intended for development and debugging. For production we recommend the official GeoNetwork docker images at https://github.com/geonetwork/docker-geonetwork.git repository.
10+
911
# Prerequisites
1012

1113
It requires the GeoNetwork webapp to be built first:
@@ -18,7 +20,6 @@ Then it can be launched:
1820

1921
```
2022
$ docker-compose up
21-
2223
```
2324

2425
# Accessing the CAS login page from GeoNetwork

docker/gn-postgres/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# GeoNetwork PostgreSQL Test Environment
2+
3+
This composition is meant to make runtime testing the PostgreSQL integration of
4+
GeoNetwork easier.
5+
6+
This folder provides a ``docker-compose.yml`` file for local testing.
7+
8+
These docker images are intended for development and debugging. For production we recommend the official GeoNetwork docker images at https://github.com/geonetwork/docker-geonetwork.git repository.

docker/docker-compose.yml docker/gn-postgres/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ volumes:
44

55
services:
66
geonetwork:
7-
image: geonetwork:3.99.0
7+
image: geonetwork:latest
88
restart: always
99
ports:
1010
- 8080:8080

docker/gn-postgres/kibana/kibana.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
server.basePath: "/geonetwork/dashboards"
2+
server.rewriteBasePath: false
3+
kibana.index: ".dashboards"
4+
elasticsearch.hosts: ["http://elasticsearch:9200"]
5+

es/README.md

+62-38
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
# Install, configure and start Elasticsearch
22

3+
## Installation options
4+
35
This section describes several methods for configuring Elasticsearch for development.
46

57
These configurations should not be used for a production deployment.
68

7-
## Manual installation
9+
### Docker installation (Recommended)
810

9-
1. Download Elasticsearch 8.x (tested with 8.11.3 for Geonetwork 4.4.x) from https://www.elastic.co/downloads/elasticsearch
10-
and copy to the ES module, e.g., es/elasticsearch-8.11.3
11+
1. Use docker pull to download the image (you can check version in the :file:`pom.xml` file):
1112

12-
2. Disable the security
13+
```
14+
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.11.3
15+
```
1316

14-
Elasticsearch 8 has security enabled by default. To disable this configuration for development, update the file `config/elasticsearch.yml` adding at the end:
17+
2. Use docker run, leaving 9200 available:
1518

16-
```
17-
xpack.security.enabled: false
18-
xpack.security.enrollment.enabled: false
19-
```
19+
```
20+
docker run -p 9200:9200 -p 9300:9300 \
21+
-e "discovery.type=single-node" \
22+
-e "xpack.security.enabled=false" \
23+
-e "xpack.security.enrollment.enabled=false" \
24+
docker.elastic.co/elasticsearch/elasticsearch:8.11.3
25+
```
26+
27+
3. Check that elasticsearch is running by visiting http://localhost:9200 in a browser
2028

29+
### Docker compose installation
2130

22-
3. Start ES using:
31+
1. Use docker compose with the provided [docker-compose.yml](docker-compose.yml):
2332

24-
```shell script
25-
./bin/elasticsearch
33+
```
34+
cd es
35+
docker-compose up
2636
```
2737

28-
4. Check that elasticsearch is running by visiting http://localhost:9200 in a browser
38+
3. Check that it is running using your browser:
39+
40+
* Elasticsearch: http://localhost:9200
41+
* Kibana: http://localhost:5601
42+
43+
### Maven installation
2944

30-
## Maven installation
45+
Maven installation ensure you always are using the ``es.version`` version specified in ``pom.xml``.
3146

3247
1. Maven can take care of the installation steps:
3348

@@ -44,42 +59,32 @@ xpack.security.enrollment.enabled: false
4459
```
4560
3. Check that elasticsearch is running by visiting http://localhost:9200 in a browser
4661

47-
## Docker installation
62+
## Manual installation
4863

49-
1. Use docker pull to download the image (you can check version in the :file:`pom.xml` file):
64+
1. Download Elasticsearch 8.11.3 from https://www.elastic.co/downloads/elasticsearch
65+
and copy to the ES module, e.g., ``es/elasticsearch-8.11.3`
5066

51-
```
52-
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.11.3
53-
```
67+
2. Disable the security
5468

55-
2. Use docker run, leaving 9200 available:
69+
Elasticsearch 8 has security enabled by default. To disable this configuration for development, update the file `config/elasticsearch.yml` adding at the end:
5670

5771
```
58-
docker run -p 9200:9200 -p 9300:9300 \
59-
-e "discovery.type=single-node" \
60-
-e "xpack.security.enabled=false" \
61-
-e "xpack.security.enrollment.enabled=false" \
62-
docker.elastic.co/elasticsearch/elasticsearch:8.11.3
72+
xpack.security.enabled: false
73+
xpack.security.enrollment.enabled: false
6374
```
6475

65-
3. Check that elasticsearch is running by visiting http://localhost:9200 in a browser
66-
67-
## Docker compose installation
68-
69-
1. Use docker compose with the provided [docker-compose.yml](docker-compose.yml):
76+
3. Start ES using:
7077

71-
```
72-
cd es
73-
docker-compose up
78+
```shell script
79+
./bin/elasticsearch
7480
```
7581

76-
3. Check that it is running using your browser:
77-
78-
* Elasticsearch: http://localhost:9200
79-
* Kibana: http://localhost:5601
82+
4. Check that elasticsearch is running by visiting http://localhost:9200 in a browser
8083

8184
# Configuration
8285

86+
## Index management
87+
8388
Optionally you can manually create index but they will be created by the catalogue when
8489
the Elastic instance is available and if index does not exist.
8590

@@ -122,7 +127,7 @@ Don't hesitate to propose a Pull Request with the new language.
122127

123128
1. Configure ES to start on server startup. It is recommended to protect `gn-records` index from the Internet access.
124129

125-
* Note that for debian-based servers the current deb download (7.3.2) can be installed rather than installing manually and can be configured to run as a service using the instructions here: https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html
130+
* Note that for debian-based servers the current deb download (8.11.3) can be installed rather than installing manually and can be configured to run as a service using the instructions here: https://www.elastic.co/guide/en/elasticsearch/reference/current/starting-elasticsearch.html
126131

127132

128133
# Troubleshoot
@@ -163,3 +168,22 @@ field expansion for [*] matches too many fields, limit: 1024
163168
An option is to restrict `queryBase` to limit the number of field to query on. `any:(${any}) resourceTitleObject.default:(${any})^2` is a good default. Using `${any}` will probably trigger the error if the number of records is high.
164169

165170
The other option is to increase `indices.query.bool.max_clause_count`.
171+
172+
173+
## Disk space threshold
174+
175+
The server application will refuse to write new content unless there is enough free space available (by default 1/4 of your hard drive).
176+
177+
To turn off this check:
178+
179+
```
180+
curl -XPUT http://localhost:9200/_cluster/settings -H 'Content-Type: application/json' -d '{ "transient" : { "cluster.routing.allocation.disk.threshold_enabled" : false } }'
181+
```
182+
183+
## Blocked by index read-only / allow delete
184+
185+
To recover:
186+
187+
```
188+
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
189+
```

es/es-dashboards/README.md

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
# Install, configure and start Kibana
22

3-
## Manual installation
4-
5-
Download Kibana from https://www.elastic.co/downloads/kibana. For Geonetwork 3.8.x download at least version 7.2.1
3+
## Installation options
64

7-
Set Kibana base path and index name in config/kibana.yml:
5+
### Docker compose installation (Recommended)
86

9-
```
10-
server.basePath: "/geonetwork/dashboards"
11-
server.rewriteBasePath: false
12-
```
7+
1. Use docker compose with the provided [docker-compose.yml](es/docker-compose.yml):
138

14-
Adapt if needed ```elasticsearch.url``` and ```server.host```.
15-
16-
Start Kibana manually:
9+
```
10+
cd es
11+
docker-compose up
12+
```
1713

18-
```
19-
cd kibana/bin
20-
./kibana
21-
```
14+
3. Check that it is running using your browser:
15+
16+
* Elasticsearch: http://localhost:9200
17+
* Kabana: http://localhost:5601
2218

2319
## Maven installation
2420

@@ -41,20 +37,26 @@ cd kibana/bin
4137
mvn exec:exec -Dkb-start
4238
```
4339

44-
## Docker compose installation
40+
## Manual installation
41+
42+
1. Download Kibana 8.11.3 from https://www.elastic.co/downloads/kibana
43+
44+
2. Set Kibana base path and index name in config/kibana.yml:
45+
46+
```
47+
server.basePath: "/geonetwork/dashboards"
48+
server.rewriteBasePath: false
49+
```
50+
51+
3. Adapt if needed ```elasticsearch.url``` and ```server.host```.
4552

46-
1. Use docer compose with the provided [docker-compose.yml](docker-compose.yml):
53+
4. Start Kibana manually:
4754

4855
```
49-
cd es
50-
docker-compose up
56+
cd kibana/bin
57+
./kibana
5158
```
5259

53-
3. Check that it is running using your browser:
54-
55-
* Elasticsearch: http://localhost:9200
56-
* Kabana: http://localhost:5601
57-
5860
## Import Configuration
5961

6062
1. Kibana should be running from:
@@ -69,16 +71,17 @@ cd kibana/bin
6971
http://localhost:8080/geonetwork/dashboards
7072
```
7173

74+
7275
## Troubleshoot
7376

7477
If it does not start properly, check Kibana log files (eg. it may fail if Elasticsearch version
7578
is not compatible with Kibana version).
7679

77-
Visit Kibana in a browser using one of the above links and go to 'Saved Objects'. Import export.ndjson from https://github.com/geonetwork/core-geonetwork/blob/4.0.x/es/es-dashboards/data/export.ndjson
80+
Visit Kibana in a browser using one of the above links and go to 'Saved Objects'. Import export.ndjson from https://github.com/geonetwork/core-geonetwork/blob/main/es/es-dashboards/data/export.ndjson
7881

7982
### Production Use
8083

81-
Kibana can be installed from the debian files, and 7.3.2 is confirmed as working with Geonetwork 3.8.x.
84+
Kibana can be installed from the debian files, and Kibana 8.11.3 is confirmed as working with Geonetwork 4.4.x.
8285

8386
Set Kibana to start when the server starts up, using the instructions at https://www.elastic.co/guide/en/kibana/current/start-stop.html
8487

es/es-dashboards/pom.xml

+63-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,74 @@
2424
<modelVersion>4.0.0</modelVersion>
2525
<artifactId>gn-es-dashboards</artifactId>
2626
<name>GeoNetwork dashboard app based on Kibana</name>
27-
2827
<parent>
2928
<artifactId>gn-es</artifactId>
3029
<groupId>org.geonetwork-opensource</groupId>
3130
<version>4.4.4-SNAPSHOT</version>
3231
</parent>
32+
33+
<build>
34+
<plugins>
35+
<plugin>
36+
<groupId>org.apache.maven.plugins</groupId>
37+
<artifactId>maven-enforcer-plugin</artifactId>
38+
<executions>
39+
<execution>
40+
<id>check-readme</id>
41+
<goals>
42+
<goal>enforce</goal>
43+
</goals>
44+
<configuration combine.self="override">
45+
<rules>
46+
<evaluateBeanshell>
47+
<message>Update README.md examples for Elasticsearch ${es.version}</message>
48+
<condition>
49+
import java.util.regex.Pattern;
50+
51+
esVersion = "${es.version}";
52+
print("Scanning README for " + esVersion);
53+
54+
docker = Pattern.compile("Kibana (\\d.\\d\\d.\\d)");
55+
download = Pattern.compile("Download Kibana (\\d.\\d\\d.\\d)");
56+
57+
patterns = new Pattern[]{ docker, download};
58+
59+
readme = new BufferedReader(new FileReader("README.md"));
60+
61+
number = 0;
62+
while ((line = readme.readLine()) != null) {
63+
number++;
64+
for (pattern : patterns ){
65+
matcher = pattern.matcher(line);
66+
if (matcher.find()) {
67+
if (!esVersion.equals(matcher.group(1))) {
68+
print("README.md:"+number+" FAILURE: " + line);
69+
return false;
70+
}
71+
}
72+
}
73+
}
74+
readme.close();
75+
true;
76+
</condition>
77+
</evaluateBeanshell>
78+
</rules>
79+
</configuration>
80+
</execution>
81+
<execution>
82+
<id>check-docker</id>
83+
<goals>
84+
<goal>enforce</goal>
85+
</goals>
86+
<configuration combine.self="override">
87+
<skip>true</skip>
88+
</configuration>
89+
</execution>
90+
</executions>
91+
</plugin>
92+
</plugins>
93+
</build>
94+
3395
<profiles>
3496
<profile>
3597
<id>kb-download</id>

0 commit comments

Comments
 (0)