diff --git a/elasticsearch/centos7/Dockerfile.24 b/elasticsearch/centos7/Dockerfile.24 new file mode 100644 index 00000000..891e9ee5 --- /dev/null +++ b/elasticsearch/centos7/Dockerfile.24 @@ -0,0 +1,18 @@ +FROM registry.centos.org/centos/centos:7 + +MAINTAINER Mohammed Zeeshan Ahmed + +RUN yum -y update && yum clean all + +ENV ELASTIC_MAJOR_VERSION="2.4.0" + +ADD fix-permissions.sh install_older_versions.sh run.sh passwd.template /opt/scripts/ + +RUN . /opt/scripts/install_older_versions.sh + +USER elasticsearch + +EXPOSE 9200 9300 + +ENTRYPOINT ["/opt/scripts/run.sh"] +CMD ["elastic"] diff --git a/elasticsearch/centos7/Dockerfile.53 b/elasticsearch/centos7/Dockerfile.53 new file mode 100644 index 00000000..2c68b0ed --- /dev/null +++ b/elasticsearch/centos7/Dockerfile.53 @@ -0,0 +1,16 @@ +FROM registry.centos.org/centos/centos:7 + +MAINTAINER Mohammed Zeeshan Ahmed + +RUN yum -y update && yum clean all + +ADD fix-permissions.sh install.sh run.sh passwd.template /opt/scripts/ + +RUN . /opt/scripts/install.sh + +USER 1001 + +EXPOSE 9200 9300 + +ENTRYPOINT ["/opt/scripts/run.sh"] +CMD ["elastic"] diff --git a/elasticsearch/centos7/cccp.yml b/elasticsearch/centos7/cccp.yml new file mode 100644 index 00000000..f5bf97f7 --- /dev/null +++ b/elasticsearch/centos7/cccp.yml @@ -0,0 +1 @@ +job-id: elasticsearch diff --git a/elasticsearch/centos7/fix-permissions.sh b/elasticsearch/centos7/fix-permissions.sh new file mode 100755 index 00000000..40df1386 --- /dev/null +++ b/elasticsearch/centos7/fix-permissions.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Fix permissions on the given directory to allow group read/write of +# regular files and execute of directories. +set -eux +find "$1" -exec chown ${2} {} \; +find "$1" -exec chgrp 0 {} \; +find "$1" -exec chmod g+rw {} \; +find "$1" -type d -exec chmod g+x {} + diff --git a/elasticsearch/centos7/install.sh b/elasticsearch/centos7/install.sh new file mode 100755 index 00000000..cb04fd4b --- /dev/null +++ b/elasticsearch/centos7/install.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +set -eux; + +# Initialize Variables + +ELASTIC_SEARCH_GPG_KEY="https://artifacts.elastic.co/GPG-KEY-elasticsearch" +ELASTIC_REPO_FILE_LOCATION="/etc/yum.repos.d/elastic.repo" +ELASTIC_CONFIG="/etc/elasticsearch/elasticsearch.yml" +ELASTIC_CONFIG_BAK="/etc/elasticsearch/elasticsearch.yml.bak" +ELASTIC_MAJOR_VERSION=${ELASTIC_MAJOR_VERSION:-"5.x"} +BASIC_PACKAGES="java-1.8.0-openjdk nss_wrapper gettext" +SYSCTL_CONF="/etc/sysctl.conf" + +# Install Begins + +# Install epel +yum -y install epel-release; + +# Configure Elastic Repo +cat >${ELASTIC_REPO_FILE_LOCATION} < /tmp/passwd; +export LD_PRELOAD=libnss_wrapper.so; +export NSS_WRAPPER_PASSWD=/tmp/passwd; +export NSS_WRAPPER_GROUP=/etc/group; +ELASTIC_CONFIG="/etc/elasticsearch/elasticsearch.yml"; +ELASTIC_CONFIG_BAK="/etc/elasticsearch/elasticsearch.yml.bak"; + +rm -rf ${ELASTIC_CONFIG}; +cp ${ELASTIC_CONFIG_BAK} ${ELASTIC_CONFIG}; + +cat >>${ELASTIC_CONFIG} <