Preinstall analysis-icu and drop runtime plugin install

This commit is contained in:
Your Name
2025-11-07 05:05:49 -06:00
parent ee566734a0
commit eeee0301c6
6 changed files with 12 additions and 63 deletions

View File

@@ -4,10 +4,6 @@
# Java memory settings - leave empty to auto-configure based on container limits
ES_JAVA_HEAP=
# Comma or space separated list of plugins to install automatically
# analysis-icu is required for Nextcloud full-text search with language analyzers
ES_PLUGINS_INSTALL=analysis-icu
# Security settings - DO NOT CHANGE
ES_JAVA_HOME=/app/data/jdk
ES_PATH_CONF=/app/data/config

View File

@@ -4,7 +4,7 @@
"author": "Elastic and Cloudron Community",
"description": "Elasticsearch is a distributed, open source search and analytics engine for all types of data. This package is designed for internal use only.",
"tagline": "Distributed search and analytics engine",
"version": "1.0.12",
"version": "1.0.13",
"healthCheckPath": "/_cluster/health?pretty",
"httpPort": 9200,
"manifestVersion": 2,

View File

@@ -35,10 +35,10 @@ RUN mkdir -p /usr/share/elasticsearch && \
# Create necessary directories
RUN mkdir -p /app/data/{elasticsearch,logs,config,secrets,jdk/bin,run} && \
mkdir -p /app/data/elasticsearch/plugins && \
chown -R elasticsearch:elasticsearch /app/data && \
rm -rf /usr/share/elasticsearch/plugins && \
ln -s /app/data/elasticsearch/plugins /usr/share/elasticsearch/plugins
chown -R elasticsearch:elasticsearch /app/data
# Preinstall required plugins
RUN ES_JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch analysis-icu
# Copy configuration files
COPY elasticsearch.yml /app/elasticsearch.yml

View File

@@ -32,17 +32,11 @@ After installation:
1. Check the app logs to ensure Elasticsearch has started correctly
2. Note the generated password from the logs or from `/app/data/credentials.txt`
3. Configure your other Cloudron apps to connect to Elasticsearch using the format: `http://elastic:<password>@localhost:9200`
4. (Recommended) Ensure the required analysis plugins are installed before integrating apps like Nextcloud:
1. Open the Cloudron File Manager for the Elasticsearch app and edit `/app/data/.env`
2. Set `ES_PLUGINS_INSTALL="analysis-icu"` (add extra plugins separated by spaces or commas)
3. Restart the Elasticsearch app so it installs the requested plugins on startup
4. Verify installation from the web terminal:
4. (Recommended) Verify the bundled `analysis-icu` plugin (required by Nextclouds full-text search):
```bash
curl -X GET -u elastic:<password> "localhost:9200/_nodes/plugins?pretty"
```
You should see `analysis-icu` listed before running any index commands.
The output should list `analysis-icu` before you kick off `occ fulltextsearch:index`. If you need additional plugins, rebuild this package with the desired plugin baked into the image (runtime installation is blocked by Elasticsearch 9s filesystem restrictions).
## Troubleshooting

View File

@@ -72,19 +72,13 @@ You can get the IP address from the Cloudron admin panel or by using the `cloudr
### Language Analysis Plugins
Many integrations (for example, Nextcloud Full-Text Search with German documents) require the `analysis-icu` plugin so Elasticsearch understands language-specific analyzers. This package installs `analysis-icu` automatically on every start. To add additional plugins, edit `/app/data/.env` via the Cloudron File Manager and tweak the `ES_PLUGINS_INSTALL` variable:
```
ES_PLUGINS_INSTALL="analysis-icu ingest-attachment"
```
Plugins are installed sequentially and skipped if already present. After restarting the app you can verify the installed plugins from the Elasticsearch web terminal:
Many integrations (for example, Nextcloud Full-Text Search with German documents) require the `analysis-icu` plugin so Elasticsearch understands language-specific analyzers. This package ships with `analysis-icu` preinstalled. You can verify it from the Elasticsearch web terminal:
```bash
curl -X GET -u elastic:<password> "localhost:9200/_nodes/plugins?pretty"
```
Look for `analysis-icu` (and any other requested plugins) in the output before running `occ fulltextsearch:index`.
Look for `analysis-icu` in the output before running `occ fulltextsearch:index`. If you need additional plugins, rebuild this package with the desired plugin installed in the Docker image (Elasticsearch 9 no longer allows runtime plugin installation into read-only filesystems).
## Security Notes

View File

@@ -144,7 +144,6 @@ configure_elasticsearch() {
ensure_setting "discovery.type" "single-node"
ensure_setting "path.data" "/app/data/elasticsearch"
ensure_setting "path.logs" "/app/data/logs"
ensure_setting "path.plugins" "/app/data/elasticsearch/plugins"
# CRITICAL FIX: Remove any index-level settings from elasticsearch.yml to prevent startup failure
if [ -f $ES_PATH_CONF/elasticsearch.yml ]; then
@@ -407,39 +406,6 @@ ensure_setting() {
fi
}
# Install optional Elasticsearch plugins (analysis-icu required for multi-language indexing)
install_plugins() {
local plugin_list="${ES_PLUGINS_INSTALL:-analysis-icu}"
local plugin_dir="/app/data/elasticsearch/plugins"
if [ -z "$plugin_list" ]; then
echo "No Elasticsearch plugins requested for installation."
return 0
fi
# Normalize separators (commas/semicolons/newlines) to whitespace
plugin_list=$(echo "$plugin_list" | tr ',;' ' ')
for plugin in $plugin_list; do
plugin=$(echo "$plugin" | xargs)
[ -z "$plugin" ] && continue
if [ -d "$plugin_dir/$plugin" ]; then
echo "Plugin '$plugin' already installed. Skipping."
continue
fi
echo "Installing Elasticsearch plugin '$plugin'..."
if ! su -c "ES_PATH_CONF=$ES_PATH_CONF ES_JAVA_HOME=/app/data/jdk ES_TMPDIR=/tmp $ES_HOME/bin/elasticsearch-plugin install --batch $plugin" elasticsearch; then
echo "ERROR: Failed to install plugin '$plugin'."
return 1
fi
done
echo "✅ Requested Elasticsearch plugins installed."
return 0
}
# Configure JVM heap size
configure_heap() {
# Calculate optimal heap size (50% of available memory)
@@ -541,7 +507,6 @@ chmod 600 /app/data/secrets/elastic_password
set_system_limits
configure_heap
install_plugins
start_elasticsearch
# Keep container running