From: "Göktürk Yüksek" <gokturk@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/, app-misc/elasticsearch/
Date: Thu, 5 Jan 2017 16:30:00 +0000 (UTC) [thread overview]
Message-ID: <1483633662.7ff18b81bb4e21ceb1132fc722c04c1732db8211.gokturk@gentoo> (raw)
commit: 7ff18b81bb4e21ceb1132fc722c04c1732db8211
Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
AuthorDate: Sun Dec 18 11:45:00 2016 +0000
Commit: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
CommitDate: Thu Jan 5 16:27:42 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ff18b81
app-misc/elasticsearch: fix initscript
.../elasticsearch/elasticsearch-5.0.1-r1.ebuild | 84 +++++++++++++++++++
app-misc/elasticsearch/files/elasticsearch.conf3 | 60 ++++++++++++++
app-misc/elasticsearch/files/elasticsearch.init7 | 95 ++++++++++++++++++++++
3 files changed, 239 insertions(+)
diff --git a/app-misc/elasticsearch/elasticsearch-5.0.1-r1.ebuild b/app-misc/elasticsearch/elasticsearch-5.0.1-r1.ebuild
new file mode 100644
index 00000000..ca759e0
--- /dev/null
+++ b/app-misc/elasticsearch/elasticsearch-5.0.1-r1.ebuild
@@ -0,0 +1,84 @@
+# 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://artifacts.elastic.co/downloads/${MY_PN}/${MY_PN}-${PV}.tar.gz"
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RESTRICT="strip"
+
+RDEPEND="|| ( virtual/jre:1.8 virtual/jre:1.7 )"
+
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+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
+
+ insinto /usr/lib/tmpfiles.d
+ newins "${FILESDIR}/${MY_PN}.tmpfiles.d" "${MY_PN}.conf"
+
+ insinto /etc/sysctl.d
+ newins "${FILESDIR}/${MY_PN}.sysctl.d" "${MY_PN}.conf"
+
+ newinitd "${FILESDIR}/elasticsearch.init7" "${MY_PN}"
+ newconfd "${FILESDIR}/${MY_PN}.conf3" "${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.conf3 b/app-misc/elasticsearch/files/elasticsearch.conf3
new file mode 100644
index 00000000..444ec53
--- /dev/null
+++ b/app-misc/elasticsearch/files/elasticsearch.conf3
@@ -0,0 +1,60 @@
+################################
+# Elasticsearch
+################################
+
+# Elasticsearch home directory
+#ES_HOME=/usr/share/elasticsearch
+
+# Elasticsearch Java path
+#JAVA_HOME=
+
+# 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
+
+# Additional Java OPTS
+#ES_JAVA_OPTS=
+
+################################
+# 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=65536
+
+# The maximum number of bytes of memory that may be locked into RAM
+# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
+# in elasticsearch.yml.
+# 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.init7 b/app-misc/elasticsearch/files/elasticsearch.init7
new file mode 100644
index 00000000..65072d5
--- /dev/null
+++ b/app-misc/elasticsearch/files/elasticsearch.init7
@@ -0,0 +1,95 @@
+#!/sbin/openrc-run
+
+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_STARTUP_SLEEP_TIME=${ES_STARTUP_TIME:=5}
+MAX_OPEN_FILES=${MAX_OPEN_FILES:=65536}
+MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144}
+
+DATA_DIR=${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_HOME
+export JAVA_OPTS
+export ES_JVM_OPTIONS
+export ES_JAVA_OPTS
+export ES_STARTUP_SLEEP_TIME
+
+server_command="/usr/share/elasticsearch/bin/elasticsearch"
+server_args="-d -p ${PIDFILE} -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR}"
+
+depend() {
+ use net
+}
+
+start() {
+ local conf
+ local conf_file
+ for conf in elasticsearch.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_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 $?
+}
next reply other threads:[~2017-01-05 16:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 16:30 Göktürk Yüksek [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-01-15 17:37 [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/, app-misc/elasticsearch/ Göktürk Yüksek
2017-01-15 17:37 Göktürk Yüksek
2017-03-02 5:31 Göktürk Yüksek
2017-03-16 14:34 Amy Liffey
2017-06-27 13:27 Patrice Clement
2018-03-10 12:29 Amy Liffey
2018-05-25 13:14 Aaron Bauman
2018-07-11 14:32 Manuel Rüger
2018-07-16 13:44 Tony Vroon
2018-07-23 22:47 William Hubbs
2019-04-25 12:00 Manuel Rüger
2020-04-13 8:31 Joonas Niilola
2020-06-12 14:33 Thomas Deutschmann
2022-05-26 12:58 Joonas Niilola
2022-11-18 8:51 Joonas Niilola
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1483633662.7ff18b81bb4e21ceb1132fc722c04c1732db8211.gokturk@gentoo \
--to=gokturk@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox