From fdee1ab1bea4c7558abdfb05d531286d85cb187a Mon Sep 17 00:00:00 2001 From: Samuli Saarinen Date: Sun, 1 Jan 2023 16:56:48 +0200 Subject: [PATCH] Add docker files for easier development setup --- README.md | 10 ++++++++++ etc/Dockerfile | 8 ++++++++ etc/docker-compose.yml | 19 +++++++++++++++++++ etc/test-analyzer.http | 10 ++++++++++ 4 files changed, 47 insertions(+) create mode 100644 etc/Dockerfile create mode 100644 etc/docker-compose.yml diff --git a/README.md b/README.md index 0c8c833..fc7a55a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,16 @@ To install the plugin, run the following command, changing the version in URL to bin/elasticsearch-plugin install https://github.com/EvidentSolutions/elasticsearch-analysis-raudikko/releases/download/v0.1.1/elasticsearch-analysis-raudikko-0.1.1-es7.16.3.zip ``` +### Docker +Building the plugin and running with docker +``` +./gradlew build --DelastisearchVersion=8.5.3 +cd etc +docker compose build --build-arg "ES_VERSION=8.5.3" +docker compose up +``` +Elasticsearch should be running and available at port 9200 + ### Verify installation After installing the plugin, you can quickly verify that it works by executing: diff --git a/etc/Dockerfile b/etc/Dockerfile new file mode 100644 index 0000000..ace4ee0 --- /dev/null +++ b/etc/Dockerfile @@ -0,0 +1,8 @@ +ARG ES_VERSION=8.5.3 +FROM elasticsearch:${ES_VERSION} +# Needs to repeat the ARG here or it won't work +# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact +ARG ES_VERSION +COPY /build/distributions/elasticsearch-analysis-raudikko-0.1-es${ES_VERSION}.zip /install/elasticsearch-analysis-raudikko.zip +RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install \ + --batch file:///install/elasticsearch-analysis-raudikko.zip \ diff --git a/etc/docker-compose.yml b/etc/docker-compose.yml new file mode 100644 index 0000000..077dc14 --- /dev/null +++ b/etc/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.9" +services: + elasticsearch: + build: + dockerfile: /etc/Dockerfile + context: ../ + # change version here or use + # docker compose build --build-arg "ES_VERSION=" + #args: + #ES_VERSION: 8.5.3 + ports: + - "9200:9200" + environment: + - discovery.type=single-node + - ES_JAVA_OPTS=-Xms1g -Xmx1g + - xpack.security.enabled=false + # NOTE on WSL needed to adjust following + # wsl -d docker-desktop + # sysctl -w vm.max_map_count=262144 diff --git a/etc/test-analyzer.http b/etc/test-analyzer.http index ef58c35..ec4b7fc 100644 --- a/etc/test-analyzer.http +++ b/etc/test-analyzer.http @@ -1,3 +1,4 @@ +### test analyzer GET localhost:9200/_analyze Content-Type: application/json; charset=UTF-8 @@ -6,3 +7,12 @@ Content-Type: application/json; charset=UTF-8 "filter" : ["raudikko"], "text" : "Testataan raudikon analyysiä tällä tavalla yksinkertaisesti." } + +### check status +GET http://localhost:9200/_cluster/health?pretty + +### check version +GET http://localhost:9200 + +### show plugins +GET http://localhost:9200/_cat/plugins?v=true&s=component&h=component,version,description \ No newline at end of file