Simplify ElasticSearch to make it more robust 82/1782/5
authorFerenc Tóth <ferenc.2.toth@nokia.com>
Mon, 14 Oct 2019 18:57:11 +0000 (20:57 +0200)
committerFerenc Tóth <ferenc.2.toth@nokia.com>
Fri, 18 Oct 2019 10:11:07 +0000 (12:11 +0200)
- No more master/data nodes, only all-purpose ES nodes
- ES upgrade from 7.3.0 to 7.4.0
- Upgrade to `java-latest-openjdk-headless`, which is java 13
- Move supervisord.conf to ES image from configmap

Signed-off-by: Ferenc Tóth <ferenc.2.toth@nokia.com>
Change-Id: I5dbfe6ca3c3e21439a3e11302b622969b3e86870

SPECS/elasticsearch.spec
docker-build/elasticsearch/Dockerfile
docker-build/elasticsearch/elasticsearch-logrotate.sh
docker-build/elasticsearch/elasticsearch-setindex.sh
docker-build/elasticsearch/supervisord.conf [new file with mode: 0644]

index bd5f275..08c8022 100644 (file)
@@ -14,8 +14,8 @@
 
 %define COMPONENT elasticsearch
 %define RPM_NAME caas-%{COMPONENT}
-%define RPM_MAJOR_VERSION 7.3.0
-%define RPM_MINOR_VERSION 2
+%define RPM_MAJOR_VERSION 7.4.0
+%define RPM_MINOR_VERSION 0
 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
 %define centos_build 191001
 
index ab6d209..bf4ad19 100644 (file)
@@ -18,12 +18,11 @@ CMD ["/bin/bash"]
 MAINTAINER Levente Kale <levente.kale@nokia.com>
 
 ARG VERSION
-ENV ES_VERSION=$VERSION
 
 ENV PATH /usr/share/elasticsearch/bin:$PATH
-ENV JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk
+ENV JAVA_HOME /usr/lib/jvm/jre-13-openjdk
 ENV DOWNLOAD_URL "https://artifacts.elastic.co/downloads/elasticsearch"
-ENV ES_TARBAL "${DOWNLOAD_URL}/elasticsearch-oss-${ES_VERSION}-linux-x86_64.tar.gz"
+ENV ES_TARBAL "${DOWNLOAD_URL}/elasticsearch-oss-${VERSION}-linux-x86_64.tar.gz"
 
 WORKDIR /usr/share/elasticsearch
 
@@ -31,7 +30,7 @@ RUN groupadd -g 202 elasticsearch \
 &&  adduser -u 202 -g 202 -d /usr/share/elasticsearch elasticsearch \
 &&  yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
 &&  yum install -y --setopt=skip_missing_names_on_install=False \
-      java-1.8.0-openjdk-headless \
+      java-latest-openjdk-headless \
       unzip \
       which \
       coreutils \
@@ -49,3 +48,4 @@ RUN groupadd -g 202 elasticsearch \
 COPY elasticsearch-logrotate.sh /etc/cron.hourly/
 COPY elasticsearch-setindex.sh /usr/share/elasticsearch/
 COPY log4j2.properties /usr/share/elasticsearch/config/
+COPY supervisord.conf /etc/
index 989aedb..06e36e7 100755 (executable)
@@ -15,7 +15,7 @@
 
 FS_LIMIT=80
 DOCS_DROP=100000
-ES_URL="http://localhost:$ELASTICSEARCH_LOGGING_SERVICE_PORT"
+ES_URL="http://localhost:$ELASTICSEARCH_SERVICE_PORT"
 
 log () {
     echo "LOGROTATE: $*" >/proc/1/fd/1
@@ -23,13 +23,7 @@ log () {
 
 log "hourly job started"
 
-IFS='-' read es type num <<< "$HOSTNAME"
-if [[ "$type" != "data" ]]; then
-    log "non-data node -> exiting"
-    exit 0
-fi
-
-# sleep to avoid concurrent runs across multiple ES data Pods
+# sleep to avoid concurrent runs across multiple ES Pods
 let "SLEEP=($num * 600)+($RANDOM % 30)"
 log "sleeping $SLEEP seconds..."
 sleep $SLEEP
index d931e3b..df3467b 100755 (executable)
@@ -16,7 +16,7 @@
 ack="false"
 while [ "$ack" != "true" ]
 do
-  response=$(curl -sS -XPUT "http://localhost:$ELASTICSEARCH_LOGGING_SERVICE_PORT/_template/default_template" -H 'Content-Type: application/json' -d'
+  response=$(curl -sS -XPUT "http://localhost:$ELASTICSEARCH_SERVICE_PORT/_template/default_template" -H 'Content-Type: application/json' -d'
   {
     "index_patterns": ["*"],
     "settings": {
diff --git a/docker-build/elasticsearch/supervisord.conf b/docker-build/elasticsearch/supervisord.conf
new file mode 100644 (file)
index 0000000..0a87d34
--- /dev/null
@@ -0,0 +1,55 @@
+[unix_http_server]
+file=/run/supervisord.sock   ; (the path to the socket file)
+chmod = 0770
+chown = root:root
+username = dummy
+password = dummy
+
+[supervisord]
+user=root
+logfile=/dev/null
+logfile_maxbytes=0
+loglevel=info
+pidfile=/var/run/supervisor/supervisord.pid
+nodaemon=true
+minfds=1024
+minprocs=200
+
+[supervisorctl]
+serverurl=unix:///run/supervisord.sock
+username = dummy
+password = dummy
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[program:elasticsearch]
+command=/usr/share/elasticsearch/bin/elasticsearch
+user=202
+startsecs=3
+startretries=1
+stopwaitsecs = 3
+priority = 1
+redirect_stderr=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+
+[program:crond]
+command=/usr/sbin/crond -n -s
+startsecs=3
+startretries=1
+stopwaitsecs = 3
+priority = 2
+redirect_stderr=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+
+[program:setindex]
+command=/usr/share/elasticsearch/elasticsearch-setindex.sh
+startsecs=3
+startretries=1
+stopwaitsecs = 3
+priority = 2
+redirect_stderr=true
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0