diff --git a/.gitignore b/.gitignore index 706fd07f..ebf869bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea .vscode +.DS_Store \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 445db324..5becb2d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,29 +1,44 @@ image: registry.gitlab.com/openstapps/projectmanagement/builder +default: + tags: + - docker + stages: + - test - publish -publish:version: +image build: + stage: test + variables: + DOCKER_DRIVER: overlay2 + services: + - docker:dind + script: + - export CI_ES_VERSION=$(sed -n '/FROM elasticsearch/p' Dockerfile | cut -d ":" -f 2) + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY + - docker build -t $CI_REGISTRY_IMAGE:$CI_ES_VERSION . + - docker tag $CI_REGISTRY_IMAGE:$CI_ES_VERSION $CI_REGISTRY_IMAGE:latest + only: + - branches + +main: stage: publish variables: DOCKER_DRIVER: overlay2 services: - docker:dind script: - - export CI_BUILD_SEM_VERSION=$(echo -n "$CI_BUILD_REF_NAME" | cut -c 2-) + - export CI_ES_VERSION=$(sed -n '/FROM elasticsearch/p' Dockerfile | cut -d ":" -f 2) - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - - docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_SEM_VERSION . - - docker tag $CI_REGISTRY_IMAGE:$CI_BUILD_SEM_VERSION $CI_REGISTRY_IMAGE:latest + - docker build -t $CI_REGISTRY_IMAGE:$CI_ES_VERSION . + - docker tag $CI_REGISTRY_IMAGE:$CI_ES_VERSION $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest - - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_SEM_VERSION + - docker push $CI_REGISTRY_IMAGE:$CI_ES_VERSION only: - - /v[0-9]+\.[0-9]+\.[0-9]+/ - except: - - branches - tags: - - docker + - main -publish:branch: +develop: stage: publish variables: DOCKER_DRIVER: overlay2 @@ -34,7 +49,4 @@ publish:branch: - docker build -t $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME . - docker push $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME only: - - /(^master$|^develop$)/ - tags: - - docker - + - develop diff --git a/Dockerfile b/Dockerfile index 54e54f49..defd70e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ -FROM elasticsearch:5.6-alpine +FROM elasticsearch:8.4.2 + +EXPOSE 9200 +EXPOSE 9300 -# log4j2 -RUN echo "-Dlog4j2.formatMsgNoLookups=true" >> /usr/share/elasticsearch/config/jvm.options ADD config/ /usr/share/elasticsearch/config/ diff --git a/README.md b/README.md index 1ecad4b1..212018d4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Database docker image -[![pipeline status](https://img.shields.io/gitlab/pipeline/openstapps/database.svg?style=flat-square)](https://gitlab.com/openstapps/database/commits/master) +[![pipeline status](https://img.shields.io/gitlab/pipeline/openstapps/database.svg?style=flat-square)](https://gitlab.com/openstapps/database/commits/main) [![license)](https://img.shields.io/badge/license-GPL--3.0--only-lightgrey.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html) -The used database is Elasticsearch 5.6.x. This images is based on -[elasticsearch:5.6](https://hub.docker.com/r/library/elasticsearch/) from the +The used database is Elasticsearch 8.4.x. This images is based on +[elasticsearch:8.4](https://hub.docker.com/r/library/elasticsearch/) from the [offical Docker Library project](https://docs.docker.com/docker-hub/official_repos/) and uses openjdk:8-jre-alpine as a base image. -Additionally the [ICU Analysis Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/5.6/analysis-icu.html) is +Additionally the [ICU Analysis Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/8.4/analysis-icu.html) is installed to provide unicode collation which is used for sorting. ## Usage for testing purposes: @@ -18,5 +18,5 @@ Currently there is an issue with elasticsearch and java on linux machines that t To set it permanently, you will have to add it to `/etc/sysctl.conf` on machines that run systemd as a init deamon. ## For production use: -Please set `vm.max_map_count=262144` permanently. It is explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html#docker-cli-run-prod-mode) +Please set `vm.max_map_count=262144` permanently. It is explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/8.4/docker.html#docker-prod-prerequisites) diff --git a/config/elasticsearch.yml b/config/elasticsearch.yml index e6ebf49c..dbae1e8b 100644 --- a/config/elasticsearch.yml +++ b/config/elasticsearch.yml @@ -1,7 +1,5 @@ -network.host: 0.0.0.0 - -# this value is required because we set "network.host" -# be sure to modify it appropriately for a production cluster deployment -discovery.zen.minimum_master_nodes: 1 -bootstrap.system_call_filter: false - +bootstrap.memory_lock: true +discovery.type: "single-node" +cluster.routing.allocation.disk.threshold_enabled: false +network.bind_host: 0.0.0.0 +xpack.security.enabled: false