commit: dba0110302a1012a7e34b08ca145c1818ec533e3 Author: Matt Jolly <Matt.Jolly <AT> footclan <DOT> ninja> AuthorDate: Mon Apr 25 12:19:47 2022 +0000 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> CommitDate: Thu May 26 12:58:03 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dba01103
app-misc/elasticsearch: add 8.2.0 Signed-off-by: Matt Jolly <Matt.Jolly <AT> footclan.ninja> Closes: https://github.com/gentoo/gentoo/pull/25192 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> app-misc/elasticsearch/Manifest | 1 + app-misc/elasticsearch/elasticsearch-8.2.0.ebuild | 94 ++++++++++++++++++++++ .../elasticsearch/files/elasticsearch-env.patch | 24 ++++++ .../elasticsearch/files/elasticsearch.service.4 | 67 +++++++++++++++ 4 files changed, 186 insertions(+) diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest index 3d6ab7a0e4eb..07a9024d0448 100644 --- a/app-misc/elasticsearch/Manifest +++ b/app-misc/elasticsearch/Manifest @@ -1,3 +1,4 @@ DIST elasticsearch-6.8.23.tar.gz 149672445 BLAKE2B dd7b080f1496f3a20755c183befae74194eab05b04c6f77679e9dad6067eef5222a4c7ce43d6267f1233a7bf864c6f8b23d5caf52278e1fe5f48f465e6603113 SHA512 73258b400cd194768058105a74ca0e811962ccf81bed8c4d3a824d4e5b97a8178a31150e60602fa1e04c6764b139980eb45ae6f246864702120653b45120b597 DIST elasticsearch-7.17.3-no-jdk-linux-x86_64.tar.gz 167378547 BLAKE2B 4bacb075e94587351bb4638da15644ed372ec1ad2b72e1c9b84c511e84666f6b79ccc8519ce5fede119e6c134ac500a1209578f18a26fd8566646e870a17f9ba SHA512 f2d5953710adfe31f1e30a0fdf4c091c0493f613a83927ddec4bbc74d2eccb839e1ffa6d44636ad0ad9c07613915847cc7a68fc87e465a8a851c96e023917bf1 +DIST elasticsearch-8.2.0-linux-x86_64.tar.gz 529729465 BLAKE2B e176a047e49b343673c6f20e45d6ff96650e4ebb6b0d9d09450e4fb435ac56e22527be32c4327b5667ce6b4dbd6824477fc445c1db3e78a42e9c6bd01a1f5934 SHA512 f5e48538a835d61b7321133158c988b536945451f783964a10f50a0208aa46c013c2e55b86a5f4ec06c7ac61700c0f41d47124c91e4bf93b24ad3f150933a77d DIST elasticsearch-oss-6.8.23.tar.gz 68573265 BLAKE2B 80366fdc4eaaf45161a36da112397938a82d08d842d82dd5a9311abf63ca20afb93ecc06387c6852bbb1a861306382d6e7c2314e67635b6f2e75cdc183057ad8 SHA512 14dbb2809b06499373c3ec5035d829d62255c2c93103618fbfe3d7d03cecf8847f654e83c78f765f23224126ff18ed713b959857e8ecf435c475b11bcd143d3f diff --git a/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild b/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild new file mode 100644 index 000000000000..e9c1024cd240 --- /dev/null +++ b/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit systemd tmpfiles + +DESCRIPTION="Free and Open, Distributed, RESTful Search Engine" +HOMEPAGE="https://www.elastic.co/elasticsearch/" +SRC_URI="https://artifacts.elastic.co/downloads/${PN}/${P}-linux-x86_64.tar.gz" +LICENSE="Apache-2.0 BSD-2 Elastic-2.0 LGPL-3 MIT public-domain" +SLOT="0" +KEYWORDS="~amd64" + +PATCHES=( + "${FILESDIR}/${PN}-env.patch" +) + +BDEPEND="acct-group/elasticsearch + acct-user/elasticsearch" + +RDEPEND="acct-group/elasticsearch + acct-user/elasticsearch + sys-libs/zlib + virtual/jre:17" + +QA_PREBUILT="usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/\(bin\|lib\)/.*" +QA_PRESTRIPPED="usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/\(bin\|lib\)/.*" + +src_prepare() { + default + rm -rf jdk || die + sed -i -e "s:logs/:/var/log/${PN}/:g" config/jvm.options || die + rm LICENSE.txt NOTICE.txt || die + rmdir logs || die +} + +src_install() { + keepdir /etc/${PN} + keepdir /etc/${PN}/scripts + + insinto /etc/${PN} + doins -r config/. + rm -r config || die + + fowners -R root:${PN} /etc/${PN} + fperms -R 2750 /etc/${PN} + + insinto /usr/share/${PN} + doins -r . + + keepdir /usr/share/${PN}/plugins + + exeinto /usr/share/${PN}/bin + doexe ${FILESDIR}/elasticsearch-systemd-pre-exec + + fperms -R +x /usr/share/${PN}/bin + fperms -R +x /usr/share/${PN}/modules/x-pack-ml/platform/linux-x86_64/bin + + keepdir /var/{lib,log}/${PN} + fowners ${PN}:${PN} /var/{lib,log}/${PN} + fperms 0750 /var/{lib,log}/${PN} + + insinto /etc/sysctl.d + newins "${FILESDIR}/${PN}.sysctl.d" ${PN}.conf + + newconfd "${FILESDIR}/${PN}.conf.4" ${PN} + newinitd "${FILESDIR}/${PN}.init.8" ${PN} + + systemd_install_serviced "${FILESDIR}/${PN}.service.conf" + systemd_newunit "${FILESDIR}"/${PN}.service.4 ${PN}.service + + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.d ${PN}.conf +} + +pkg_postinst() { + # Elasticsearch will choke on our keep file and dodir will not preserve the empty dir + rm /usr/share/${PN}/plugins/.keep* || die + tmpfiles_process /usr/lib/tmpfiles.d/${PN}.conf + if [ ! systemd_is_booted ]; then + 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 + fi + ewarn "Please make sure you have proper permissions on /etc/${PN}" + ewarn "prior to keystore generation or you may experience startup failures." + 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-env.patch b/app-misc/elasticsearch/files/elasticsearch-env.patch new file mode 100644 index 000000000000..fb150bb51db3 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch-env.patch @@ -0,0 +1,24 @@ +Since ES 8.0.0 upstream stopped distributing a 'no-JDK' package. +This requires us to set `ES_JAVA_HOME` else it fails to find the +JDK that we unbundled and will not start. +--- a/bin/elasticsearch-env ++++ b/bin/elasticsearch-env +@@ -36,6 +36,18 @@ ES_HOME=`dirname "$ES_HOME"` + ES_CLASSPATH="$ES_HOME/lib/*" + LAUNCHERS_CLASSPATH="$ES_CLASSPATH:$ES_HOME/lib/launchers/*" + ++# Set our JVM in a Gentoo-specific manner ++if [ -z "$ES_JAVA_HOME" ]; then ++ GENTOO_VM=$(depend-java-query --get-vm virtual/jre:17) ++ if [ ! -z "$GENTOO_VM" ]; then ++ ES_JAVA_HOME=$(java-config-2 --select-vm=${GENTOO_VM} --jre-home) ++ else ++ echo "Unable to automatically detect a supported Java 17 VM. Elasticsearch is unlikely to launch." ++ echo "Please ensure that you have installed an appropriate Java VM using portage" ++ echo "OR pass the ES_JAVA_HOME environment variable." ++ fi ++fi ++ + # now set the path to java + if [ ! -z "$ES_JAVA_HOME" ]; then + JAVA="$ES_JAVA_HOME/bin/java" diff --git a/app-misc/elasticsearch/files/elasticsearch.service.4 b/app-misc/elasticsearch/files/elasticsearch.service.4 new file mode 100644 index 000000000000..6c5b256706c9 --- /dev/null +++ b/app-misc/elasticsearch/files/elasticsearch.service.4 @@ -0,0 +1,67 @@ +[Unit] +Description=Elasticsearch +Documentation=https://www.elastic.co +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +RuntimeDirectory=elasticsearch +PrivateTmp=true +Environment=ES_HOME=/usr/share/elasticsearch +Environment=ES_PATH_CONF=/etc/elasticsearch + +WorkingDirectory=/usr/share/elasticsearch + +ExecStartPre=+"/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec" + +User=elasticsearch +Group=elasticsearch + +ExecStart=/usr/share/elasticsearch/bin/elasticsearch \ + -p ${PID_DIR}/elasticsearch.pid \ + -Epath.logs=${LOG_DIR} \ + -Epath.data=${DATA_DIR} \ + --quiet + +# StandardOutput is configured to redirect to journalctl since +# some error messages may be logged in standard output before +# elasticsearch logging system is initialized. Elasticsearch +# stores its logs in /var/log/elasticsearch and does not use +# journalctl by default. If you also want to enable journalctl +# logging, you can simply remove the "quiet" option from ExecStart. +StandardOutput=journal +StandardError=inherit + +# Specifies the maximum file descriptor number that can be opened by this process +LimitNOFILE=65535 + +# Specifies the maximum number of processes +LimitNPROC=4096 + +# Specifies the maximum size of virtual memory +LimitAS=infinity + +# Specifies the maximum file size +LimitFSIZE=infinity + +# Disable timeout logic and wait until process is stopped +TimeoutStopSec=0 + +# SIGTERM signal is used to stop the Java process +KillSignal=SIGTERM + +# Send the signal only to the JVM rather than its control group +KillMode=process + +# Java process is never killed +SendSIGKILL=no + +# When a JVM receives a SIGTERM signal it exits with code 143 +SuccessExitStatus=143 + +# Allow a slow startup before the systemd notifier module kicks in to extend the timeout +TimeoutStartSec=75 + +[Install] +WantedBy=multi-user.target