diff options
author | Tomas Mozes <tmozes@sygic.com> | 2018-07-13 17:43:58 +0200 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2018-07-16 14:44:46 +0100 |
commit | 4f3426c43a9f455b0dcd039da1c313a1d2af7779 (patch) | |
tree | c34bc3137a3b6e6efdf51998262670038c4889f9 /app-misc/elasticsearch | |
parent | dev-python/mysql-connector-python: remove vulnerable version (diff) | |
download | gentoo-4f3426c43a9f455b0dcd039da1c313a1d2af7779.tar.gz gentoo-4f3426c43a9f455b0dcd039da1c313a1d2af7779.tar.bz2 gentoo-4f3426c43a9f455b0dcd039da1c313a1d2af7779.zip |
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
Diffstat (limited to 'app-misc/elasticsearch')
4 files changed, 139 insertions, 0 deletions
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 000000000000..1a6bec30a73a --- /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 a51d639bf7d4..30f773638d37 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 000000000000..69d3550e7d98 --- /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 000000000000..489f8c42c04d --- /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" |