public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Tony Vroon" <chainsaw@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/, app-misc/elasticsearch/
Date: Mon, 16 Jul 2018 13:44:57 +0000 (UTC)	[thread overview]
Message-ID: <1531748686.4f3426c43a9f455b0dcd039da1c313a1d2af7779.chainsaw@gentoo> (raw)

commit:     4f3426c43a9f455b0dcd039da1c313a1d2af7779
Author:     Tomas Mozes <tmozes <AT> sygic <DOT> com>
AuthorDate: Fri Jul 13 15:43:58 2018 +0000
Commit:     Tony Vroon <chainsaw <AT> gentoo <DOT> org>
CommitDate: Mon Jul 16 13:44:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4f3426c4

app-misc/elasticsearch: stop using /etc/conf.d for systemd

Closes: https://bugs.gentoo.org/646248
Package-Manager: Portage-2.3.42, Repoman-2.3.9
Closes: https://github.com/gentoo/gentoo/pull/9216
Closes: https://bugs.gentoo.org/646248

 .../elasticsearch/elasticsearch-6.3.1-r1.ebuild    | 77 ++++++++++++++++++++++
 .../files/elasticsearch-systemd-pre-exec           |  5 ++
 .../elasticsearch/files/elasticsearch.service.3    | 51 ++++++++++++++
 .../elasticsearch/files/elasticsearch.service.conf |  6 ++
 4 files changed, 139 insertions(+)

diff --git a/app-misc/elasticsearch/elasticsearch-6.3.1-r1.ebuild b/app-misc/elasticsearch/elasticsearch-6.3.1-r1.ebuild
new file mode 100644
index 00000000000..1a6bec30a73
--- /dev/null
+++ b/app-misc/elasticsearch/elasticsearch-6.3.1-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit systemd user
+
+DESCRIPTION="Open Source, Distributed, RESTful, Search Engine"
+HOMEPAGE="https://www.elastic.co/products/elasticsearch"
+SRC_URI="https://artifacts.elastic.co/downloads/${PN}/${PN}-oss-${PV}.tar.gz"
+LICENSE="Apache-2.0 BSD-2 LGPL-3 MIT public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="virtual/jre:1.8"
+
+pkg_setup() {
+	enewgroup ${PN}
+	enewuser ${PN} -1 /bin/bash /usr/share/${PN} ${PN}
+}
+
+src_prepare() {
+	default
+
+	rm -v bin/*.{bat,exe} LICENSE.txt || die
+}
+
+src_install() {
+	keepdir /etc/${PN}
+	keepdir /etc/${PN}/scripts
+
+	insinto /etc/${PN}
+	doins -r config/.
+	rm -rv config || die
+
+	fowners root:${PN} /etc/${PN}
+	fperms 2750 /etc/${PN}
+
+	insinto /usr/share/${PN}
+	doins -r .
+
+	exeinto /usr/share/${PN}/bin
+	doexe "${FILESDIR}/elasticsearch-systemd-pre-exec"
+
+	chmod +x "${ED}"/usr/share/${PN}/bin/* || die
+
+	keepdir /var/{lib,log}/${PN}
+	fowners ${PN}:${PN} /var/{lib,log}/${PN}
+	fperms 0750 /var/{lib,log}/${PN}
+	dodir /usr/share/${PN}/plugins
+
+	insinto /etc/sysctl.d
+	newins "${FILESDIR}/${PN}.sysctl.d" ${PN}.conf
+
+	newconfd "${FILESDIR}/${PN}.conf.3" ${PN}
+	newinitd "${FILESDIR}/${PN}.init.4" ${PN}
+
+	systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
+	systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles.d" ${PN}.conf
+	systemd_newunit "${FILESDIR}"/${PN}.service.3 ${PN}.service
+}
+
+pkg_postinst() {
+	elog
+	elog "You may create multiple instances of ${PN} by"
+	elog "symlinking the init script:"
+	elog "ln -sf /etc/init.d/${PN} /etc/init.d/${PN}.instance"
+	elog
+	elog "Please make sure you put elasticsearch.yml, log4j2.properties and scripts"
+	elog "from /etc/${PN} into the configuration directory of the instance:"
+	elog "/etc/${PN}/instance"
+	elog
+	ewarn "Please make sure you have proper permissions on /etc/${PN}"
+	ewarn "prior to keystore generation or you may experience startup fails."
+	ewarn "chown root:${PN} /etc/${PN} && chmod 2750 /etc/${PN}"
+	ewarn "chown root:${PN} /etc/${PN}/${PN}.keystore && chmod 0660 /etc/${PN}/${PN}.keystore"
+}

diff --git a/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec
index a51d639bf7d..30f773638d3 100755
--- a/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec
+++ b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec
@@ -5,3 +5,8 @@ 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
+
+# fails to start without keystore
+if [ ! -f "${ES_PATH_CONF}/elasticsearch.keystore" ]; then
+    "${ES_HOME}/bin/elasticsearch-keystore" create
+fi

diff --git a/app-misc/elasticsearch/files/elasticsearch.service.3 b/app-misc/elasticsearch/files/elasticsearch.service.3
new file mode 100644
index 00000000000..69d3550e7d9
--- /dev/null
+++ b/app-misc/elasticsearch/files/elasticsearch.service.3
@@ -0,0 +1,51 @@
+[Unit]
+Description=Elasticsearch
+Documentation=https://www.elastic.co
+Wants=network.target
+After=network.target
+
+[Service]
+Environment=ES_HOME=/usr/share/elasticsearch
+Environment=ES_PATH_CONF=/etc/elasticsearch
+Environment=DATA_DIR=/var/lib/elasticsearch
+Environment=LOG_DIR=/var/log/elasticsearch
+Environment=PID_DIR=/run/elasticsearch
+
+WorkingDirectory=/usr/share/elasticsearch
+
+User=elasticsearch
+Group=elasticsearch
+
+PermissionsStartOnly=true
+ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec
+
+ExecStart=/usr/share/elasticsearch/bin/elasticsearch \
+                                                -p ${PID_DIR}/elasticsearch.pid \
+                                                -Epath.logs=${LOG_DIR} \
+                                                -Epath.data=${DATA_DIR}
+
+StandardOutput=journal
+StandardError=inherit
+
+# Specifies the maximum file descriptor number that can be opened by this process
+LimitNOFILE=65536
+
+# Specifies the maximum number of bytes of memory that may be locked into RAM
+# Set to "infinity" if you use the 'bootstrap.memory_lock: 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

diff --git a/app-misc/elasticsearch/files/elasticsearch.service.conf b/app-misc/elasticsearch/files/elasticsearch.service.conf
new file mode 100644
index 00000000000..489f8c42c04
--- /dev/null
+++ b/app-misc/elasticsearch/files/elasticsearch.service.conf
@@ -0,0 +1,6 @@
+[Service]
+Environment="ES_HOME=/usr/share/elasticsearch"
+Environment="ES_PATH_CONF=/etc/elasticsearch"
+Environment="DATA_DIR=/var/lib/elasticsearch"
+Environment="LOG_DIR=/var/log/elasticsearch"
+Environment="PID_DIR=/run/elasticsearch"


             reply	other threads:[~2018-07-16 13:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 13:44 Tony Vroon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-18  8:51 [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/, app-misc/elasticsearch/ Joonas Niilola
2022-05-26 12:58 Joonas Niilola
2020-06-12 14:33 Thomas Deutschmann
2020-04-13  8:31 Joonas Niilola
2019-04-25 12:00 Manuel Rüger
2018-07-23 22:47 William Hubbs
2018-07-11 14:32 Manuel Rüger
2018-05-25 13:14 Aaron Bauman
2018-03-10 12:29 Amy Liffey
2017-06-27 13:27 Patrice Clement
2017-03-16 14:34 Amy Liffey
2017-03-02  5:31 Göktürk Yüksek
2017-01-15 17:37 Göktürk Yüksek
2017-01-15 17:37 Göktürk Yüksek
2017-01-05 16:30 Göktürk Yüksek

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=1531748686.4f3426c43a9f455b0dcd039da1c313a1d2af7779.chainsaw@gentoo \
    --to=chainsaw@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