wodby/elasticsearch

Plugins should be removed before installed

Opened this issue · 3 comments

Its a part of #1

If you have any plugins defined in ES_PLUGINS_INSTALL it will be installed at first but subsequent image stop/start will cause errors like this:

elasticsearch_1  | -> Downloading pl.allegro.tech.elasticsearch.plugin:elasticsearch-analysis-morfologik:6.8.0 from maven central
elasticsearch_1  | Warning: sha512 not found, falling back to sha1. This behavior is deprecated and will be removed in a future release. Please update the plugin to use a sha512 checksum.
elasticsearch_1  | ERROR: plugin directory [/usr/share/elasticsearch/plugins/analysis-morfologik] already exists; if you need to update the plugin, uninstall it first using command 'remove analysis-morfologik'
mybazecom_elasticsearch_1 exited with code 1

We should attempt to remove plugin first as described here: https://www.elastic.co/guide/en/elasticsearch/plugins/current/listing-removing-updating.html

sudo bin/elasticsearch-plugin remove [pluginname]
sudo bin/elasticsearch-plugin install [pluginname]

Use case:
ES_PLUGINS_INSTALL: pl.allegro.tech.elasticsearch.plugin:elasticsearch-analysis-morfologik:6.8.0,analysis-icu

The reason why your check here (https://github.com/wodby/elasticsearch/blob/master/bin/docker-entrypoint.sh#L17) fails is because plugins are identified differently than their installation names. For the plugins mentioned in original message list would output the following

/usr/share/elasticsearch # bin/elasticsearch-plugin list
analysis-icu
analysis-morfologik

What's the point in removing and then installing a plugin, wouldn't it be the same version? You know we all images rebuilt when a new ES version gets released, right?

you specified

ES_PLUGINS_INSTALL=pl.allegro.tech.elasticsearch.plugin:elasticsearch-analysis-morfologik:6.8.0,analysis-icu

to install plugins (separated by command):

pl.allegro.tech.elasticsearch.plugin:elasticsearch-analysis-morfologik:6.8.0
analysis-icu

I guess the first plugin isn't exactly analysis-morfologik and probably contrib

Yeah, problem is that is a contrib so list gives a different name. I'm not sure how elastic names it's contribs, if thats :: then we can try to parse this format. I just realize that uninstall would need a real module name too, so it wont work.