diff options
author | Patrick Lauer <patrick@gentoo.org> | 2016-05-06 12:50:02 +0200 |
---|---|---|
committer | Patrick Lauer <patrick@gentoo.org> | 2016-05-06 12:50:56 +0200 |
commit | 21dc3e1a5708d888c4d5fefdf124b03a309d5db0 (patch) | |
tree | 6685329ba20730968ef08cf31ed411afa1b76f46 /app-misc | |
parent | sci-mathematics/cgal: Remove old (diff) | |
download | gentoo-21dc3e1a5708d888c4d5fefdf124b03a309d5db0.tar.gz gentoo-21dc3e1a5708d888c4d5fefdf124b03a309d5db0.tar.bz2 gentoo-21dc3e1a5708d888c4d5fefdf124b03a309d5db0.zip |
app-misc/elasticsearch: Bump
Fix #569116
New init script and systemd unit, closer to upstream
Small bugfixes etc.
Thanks to Ferenc Erki for preparing and testing
Package-Manager: portage-2.2.28
Diffstat (limited to 'app-misc')
-rw-r--r-- | app-misc/elasticsearch/Manifest | 1 | ||||
-rw-r--r-- | app-misc/elasticsearch/elasticsearch-2.3.2.ebuild | 76 | ||||
-rwxr-xr-x | app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec | 7 | ||||
-rw-r--r-- | app-misc/elasticsearch/files/elasticsearch.conf2 | 67 | ||||
-rw-r--r-- | app-misc/elasticsearch/files/elasticsearch.init6 | 102 | ||||
-rw-r--r-- | app-misc/elasticsearch/files/elasticsearch.service5 | 53 |
6 files changed, 306 insertions, 0 deletions
diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest index cab832a34d2d..cf1672ea34c9 100644 --- a/app-misc/elasticsearch/Manifest +++ b/app-misc/elasticsearch/Manifest @@ -6,3 +6,4 @@ DIST elasticsearch-2.2.0.tar.gz 29419005 SHA256 ed70cc81e1f55cd5f0032beea2907227 DIST elasticsearch-2.2.2.tar.gz 29425370 SHA256 c706db594f1feb5051d90697c6c412eadd60e00a9ec3b4f345a122801183af69 SHA512 144ca47dd3b9730e5ff81dd93e5db09d57a6f0d61d4445e8609c0ece833f57ca05d81fdf702d56008bc5e370604deb83d2d527132783467d5ae1eddc6cefeb84 WHIRLPOOL 4d6ced926237490a6ee8531ccf09128cc6bff5d73cff6f36159552a4a7a0dfbe01df0dfafb583d1c7ddc47ad5fa054ab6dd8c188cc7e3fe196f6917519e1afac DIST elasticsearch-2.3.0.tar.gz 27556947 SHA256 d68482c7633f2986263bc5f11f93b8a58c54c6cf5e337b615446d0a7c6fdcd8b SHA512 26671d64e6cd3406ad1de4543d84c66f58be4906d00ad22584350c5b28359c2b878850fb7cd0e49c9913d968380e8e386d77376c4f32fc37d3a43913c21558db WHIRLPOOL d26a3128d12630fca4defb669b7e23749f9742e1bf7c9497860effdbe6f51c8e86b467d3a16c78c77b7dd93efaa25e21c9694308292567eaa8e07794c57d60db DIST elasticsearch-2.3.1.tar.gz 27540442 SHA256 f0092e73038e0472fcdd923e5f2792e13692ea0f09ca034a54dd49b217110ebb SHA512 447d8824c4bfbec9b8431d213e3a8ae6720d1486e1389c271cc67cce5546861a817ef8c7db1c3c3669a50a61b5305739ac26f46b04d5674bbca203c3b5dbcf2f WHIRLPOOL e55501ca7fa702c33cd826d51c2d90dcfcc2843fb5b24b2d20df917cc291fe53f203360bfac6249b57c4c2914d92da92ca56b6505b6be885ece196983c176b9c +DIST elasticsearch-2.3.2.tar.gz 27543334 SHA256 04c4d3913d496d217e038da88df939108369ae2e78eea29cb1adf1c4ab3a000a SHA512 73c4ca82eb0f4dc22907a94b9025e79183f6fcd38dbb82795800d10fc810dbee412784e62f9247390f0fb9aa19545976584bd2b62f1afe79d2cd64bb55f76dc8 WHIRLPOOL 5cc44a827de5281a9fb823a8a2e43755e0853dc5aa27f5ef7f8d1c5605d80a2dbf4c8756f01811a54307938cb3030634be6c8af2ffa465e2f35cd2a4aabeeb20 diff --git a/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild b/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild new file mode 100644 index 000000000000..a0baa8b09d90 --- /dev/null +++ b/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit eutils systemd user + +MY_PN="${PN%-bin}" +DESCRIPTION="Open Source, Distributed, RESTful, Search Engine" +HOMEPAGE="https://www.elastic.co/products/elasticsearch" +SRC_URI="https://download.elasticsearch.org/${MY_PN}/release/org/${MY_PN}/distribution/tar/${MY_PN}/${PV}/${P}.tar.gz" +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="strip" + +RDEPEND="|| ( virtual/jre:1.8 virtual/jre:1.7 )" + +pkg_preinst() { + if has_version '<app-misc/elasticsearch-2.3.2'; then + export UPDATE_NOTES=1 + fi +} + +pkg_setup() { + enewgroup ${MY_PN} + enewuser ${MY_PN} -1 /bin/bash /usr/share/${MY_PN} ${MY_PN} + esethome ${MY_PN} /usr/share/${MY_PN} +} + +src_prepare() { + rm -rf bin/*.{bat,exe} + rm LICENSE.txt +} + +src_install() { + dodir /etc/${MY_PN} + dodir /etc/${MY_PN}/scripts + + insinto /etc/${MY_PN} + doins config/* + rm -rf config + + insinto /usr/share/${MY_PN} + doins -r ./* + + insinto /usr/share/${MY_PN}/bin + doins "${FILESDIR}/elasticsearch-systemd-pre-exec" + + chmod +x "${D}"/usr/share/${MY_PN}/bin/* + + keepdir /var/{lib,log}/${MY_PN} + keepdir /usr/share/${MY_PN}/plugins + + newinitd "${FILESDIR}/elasticsearch.init6" "${MY_PN}" + newconfd "${FILESDIR}/${MY_PN}.conf2" "${MY_PN}" + systemd_newunit "${FILESDIR}"/${PN}.service5 "${PN}.service" +} + +pkg_postinst() { + elog + elog "You may create multiple instances of ${MY_PN} by" + elog "symlinking the init script:" + elog "ln -sf /etc/init.d/${MY_PN} /etc/init.d/${MY_PN}.instance" + elog + elog "Please make sure you put elasticsearch.yml and logging.yml" + elog "into the configuration directory of the instance:" + elog "/etc/${MY_PN}/instance" + elog + if ! [ -z ${UPDATE_NOTES} ]; then + elog "This update changes some configuration variables. Please review" + elog "/etc/conf.d/elasticsearch before restarting your services." + fi +} diff --git a/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec new file mode 100755 index 000000000000..a51d639bf7d4 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec @@ -0,0 +1,7 @@ +#!/bin/sh + +# CONF_FILE setting was removed +if [ ! -z "$CONF_FILE" ]; then + echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed." + exit 1 +fi diff --git a/app-misc/elasticsearch/files/elasticsearch.conf2 b/app-misc/elasticsearch/files/elasticsearch.conf2 new file mode 100644 index 000000000000..053cd18d1471 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.conf2 @@ -0,0 +1,67 @@ +################################ +# Elasticsearch +################################ + +# Elasticsearch configuration directory +#CONF_DIR=/etc/elasticsearch + +# Elasticsearch data directory +#DATA_DIR=/var/lib/elasticsearch + +# Elasticsearch logs directory +#LOG_DIR=/var/log/elasticsearch + +# Elasticsearch PID directory +#PID_DIR=/run/elasticsearch + +# Heap size defaults to 256m min, 1g max +# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g +#ES_HEAP_SIZE=2g + +# Heap new generation +#ES_HEAP_NEWSIZE= + +# Maximum direct memory +#ES_DIRECT_SIZE= + +# Additional Java OPTS +#ES_JAVA_OPTS= + +# Path to the GC log file +#ES_GC_LOG_FILE=/var/log/elasticsearch/gc.log + +################################ +# Elasticsearch service +################################ + +# When executing the init script, this user will be used to run the elasticsearch service. +# The default value is 'elasticsearch' and is declared in the init.d file. +# Note that this setting is only used by the init script. If changed, make sure that +# the configured user can read and write into the data, work, plugins and log directories. +# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service +#ES_USER=elasticsearch +#ES_GROUP=elasticsearch + +# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process +#ES_STARTUP_SLEEP_TIME=5 + +################################ +# System properties +################################ + +# Specifies the maximum file descriptor number that can be opened by this process +# When using Systemd, this setting is ignored and the LimitNOFILE defined in +# /usr/lib/systemd/system/elasticsearch.service takes precedence +#MAX_OPEN_FILES=65535 + +# The maximum number of bytes of memory that may be locked into RAM +# Set to "unlimited" if you use the 'bootstrap.mlockall: true' option +# in elasticsearch.yml (ES_HEAP_SIZE must also be set). +# When using Systemd, the LimitMEMLOCK property must be set +# in /usr/lib/systemd/system/elasticsearch.service +#MAX_LOCKED_MEMORY=unlimited + +# Maximum number of VMA (Virtual Memory Areas) a process can own +# When using Systemd, this setting is ignored and the 'vm.max_map_count' +# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf +#MAX_MAP_COUNT=262144 diff --git a/app-misc/elasticsearch/files/elasticsearch.init6 b/app-misc/elasticsearch/files/elasticsearch.init6 new file mode 100644 index 000000000000..9225f4893f8e --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.init6 @@ -0,0 +1,102 @@ +#!/sbin/runscript + +name="Elasticsearch" +description="Elasticsearch Server" + +ES_INSTANCE=${SVCNAME#*.} +PID_DIR=${PID_DIR:="/run/elasticsearch"} + +if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then + PIDFILE="${PID_DIR}/elasticsearch.${ES_INSTANCE}.pid" + ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}" + CONF_DIR="/etc/elasticsearch/${ES_INSTANCE}" + LOG_DIR="/var/log/elasticsearch/${ES_INSTANCE}" +else + PIDFILE="${PID_DIR}/elasticsearch.pid" + ES_BASE_PATH="/var/lib/elasticsearch/_default" + CONF_DIR="/etc/elasticsearch" + LOG_DIR="/var/log/elasticsearch/_default" +fi + +ES_HOME=${ES_HOME:="/usr/share/elasticsearch"} +ES_USER=${ES_USER:="elasticsearch"} +ES_GROUP=${ES_GROUP:="elasticsearch"} +ES_GC_LOG_FILE=${ES_GC_LOG_FILE:="${LOG_DIR}/gc.log"} +MAX_OPEN_FILES=${MAX_OPEN_FILES:=65535} +MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144} + +DATA_DIR="${ES_BASE_PATH}/data" + +if [ -f "${CONF_DIR}/elasticsearch.in.sh" ]; then + ES_INCLUDE="${CONF_DIR}/elasticsearch.in.sh" +fi + +export ES_INCLUDE +export JAVA_OPTS +export ES_JAVA_OPTS +export ES_HEAP_SIZE +export ES_HEAP_NEWSIZE +export ES_DIRECT_SIZE +export ES_GC_LOG_FILE +export ES_STARTUP_SLEEP_TIME + +server_command="/usr/share/elasticsearch/bin/elasticsearch" +server_args="-d -p ${PIDFILE} --default.path.home=${ES_HOME} --default.path.logs=${LOG_DIR} --default.path.data=${DATA_DIR} --default.path.conf=${CONF_DIR}" + +depend() { + use net +} + +start() { + local conf + local conf_file + for conf in elasticsearch.yml logging.yml; do + conf_file="${CONF_DIR}/${conf}" + if [ ! -f "${conf_file}" ]; then + eerror "${conf_file} must be copied into place" + return 1 + fi + done + + if [ -n "${MAX_LOCKED_MEMORY}" -a -z "${ES_HEAP_SIZE}" ]; then + eerror "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set" + return 1 + fi + + if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then + sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT} + fi + + ebegin "Starting ${SVCNAME}" + + if [ -n "${MAX_LOCKED_MEMORY}" ]; then + rc_ulimit="${rc_ulimit} -l ${MAX_LOCKED_MEMORY}" + fi + + if [ -n "${MAX_OPEN_FILES}" ]; then + rc_ulimit="${rc_ulimit} -n ${MAX_OPEN_FILES}" + fi + + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/lib/elasticsearch" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/log/elasticsearch" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${PID_DIR}" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${ES_BASE_PATH}" + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${LOG_DIR}" + + start-stop-daemon --start \ + --background \ + --chdir "${ES_HOME}" \ + --user="${ES_USER}" \ + --pidfile="${PIDFILE}" \ + --exec ${server_command} -- ${server_args} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop \ + --pidfile=${PIDFILE} \ + --user="${ES_USER}" \ + --retry=TERM/20 + eend $? +} diff --git a/app-misc/elasticsearch/files/elasticsearch.service5 b/app-misc/elasticsearch/files/elasticsearch.service5 new file mode 100644 index 000000000000..80ece6480f10 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.service5 @@ -0,0 +1,53 @@ +[Unit] +Description=Elasticsearch +Documentation=http://www.elastic.co +Wants=network.target +After=network.target + +[Service] +Environment=ES_HOME=/usr/share/elasticsearch +Environment=CONF_DIR=/etc/elasticsearch +Environment=DATA_DIR=/var/lib/elasticsearch +Environment=LOG_DIR=/var/log/elasticsearch +Environment=PID_DIR=/run/elasticsearch +EnvironmentFile=-/etc/conf.d/elasticsearch + +WorkingDirectory=/usr/share/elasticsearch + +User=elasticsearch +Group=elasticsearch + +ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec + +ExecStart=/usr/share/elasticsearch/bin/elasticsearch \ + -Des.pidfile=${PID_DIR}/elasticsearch.pid \ + -Des.default.path.home=${ES_HOME} \ + -Des.default.path.logs=${LOG_DIR} \ + -Des.default.path.data=${DATA_DIR} \ + -Des.default.path.conf=${CONF_DIR} + +StandardOutput=journal +StandardError=inherit + +# Specifies the maximum file descriptor number that can be opened by this process +LimitNOFILE=65535 + +# Specifies the maximum number of bytes of memory that may be locked into RAM +# Set to "infinity" if you use the 'bootstrap.mlockall: true' option +# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/conf.d/elasticsearch +#LimitMEMLOCK=infinity + +# Disable timeout logic and wait until process is stopped +TimeoutStopSec=0 + +# SIGTERM signal is used to stop the Java process +KillSignal=SIGTERM + +# Java process is never killed +SendSIGKILL=no + +# When a JVM receives a SIGTERM signal it exits with code 143 +SuccessExitStatus=143 + +[Install] +WantedBy=multi-user.target |