Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/files/, app-misc/elasticsearch/
Date: Thu, 26 May 2022 12:58:15
Message-Id: 1653569883.dba0110302a1012a7e34b08ca145c1818ec533e3.juippis@gentoo
1 commit: dba0110302a1012a7e34b08ca145c1818ec533e3
2 Author: Matt Jolly <Matt.Jolly <AT> footclan <DOT> ninja>
3 AuthorDate: Mon Apr 25 12:19:47 2022 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 12:58:03 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dba01103
7
8 app-misc/elasticsearch: add 8.2.0
9
10 Signed-off-by: Matt Jolly <Matt.Jolly <AT> footclan.ninja>
11 Closes: https://github.com/gentoo/gentoo/pull/25192
12 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
13
14 app-misc/elasticsearch/Manifest | 1 +
15 app-misc/elasticsearch/elasticsearch-8.2.0.ebuild | 94 ++++++++++++++++++++++
16 .../elasticsearch/files/elasticsearch-env.patch | 24 ++++++
17 .../elasticsearch/files/elasticsearch.service.4 | 67 +++++++++++++++
18 4 files changed, 186 insertions(+)
19
20 diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest
21 index 3d6ab7a0e4eb..07a9024d0448 100644
22 --- a/app-misc/elasticsearch/Manifest
23 +++ b/app-misc/elasticsearch/Manifest
24 @@ -1,3 +1,4 @@
25 DIST elasticsearch-6.8.23.tar.gz 149672445 BLAKE2B dd7b080f1496f3a20755c183befae74194eab05b04c6f77679e9dad6067eef5222a4c7ce43d6267f1233a7bf864c6f8b23d5caf52278e1fe5f48f465e6603113 SHA512 73258b400cd194768058105a74ca0e811962ccf81bed8c4d3a824d4e5b97a8178a31150e60602fa1e04c6764b139980eb45ae6f246864702120653b45120b597
26 DIST elasticsearch-7.17.3-no-jdk-linux-x86_64.tar.gz 167378547 BLAKE2B 4bacb075e94587351bb4638da15644ed372ec1ad2b72e1c9b84c511e84666f6b79ccc8519ce5fede119e6c134ac500a1209578f18a26fd8566646e870a17f9ba SHA512 f2d5953710adfe31f1e30a0fdf4c091c0493f613a83927ddec4bbc74d2eccb839e1ffa6d44636ad0ad9c07613915847cc7a68fc87e465a8a851c96e023917bf1
27 +DIST elasticsearch-8.2.0-linux-x86_64.tar.gz 529729465 BLAKE2B e176a047e49b343673c6f20e45d6ff96650e4ebb6b0d9d09450e4fb435ac56e22527be32c4327b5667ce6b4dbd6824477fc445c1db3e78a42e9c6bd01a1f5934 SHA512 f5e48538a835d61b7321133158c988b536945451f783964a10f50a0208aa46c013c2e55b86a5f4ec06c7ac61700c0f41d47124c91e4bf93b24ad3f150933a77d
28 DIST elasticsearch-oss-6.8.23.tar.gz 68573265 BLAKE2B 80366fdc4eaaf45161a36da112397938a82d08d842d82dd5a9311abf63ca20afb93ecc06387c6852bbb1a861306382d6e7c2314e67635b6f2e75cdc183057ad8 SHA512 14dbb2809b06499373c3ec5035d829d62255c2c93103618fbfe3d7d03cecf8847f654e83c78f765f23224126ff18ed713b959857e8ecf435c475b11bcd143d3f
29
30 diff --git a/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild b/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild
31 new file mode 100644
32 index 000000000000..e9c1024cd240
33 --- /dev/null
34 +++ b/app-misc/elasticsearch/elasticsearch-8.2.0.ebuild
35 @@ -0,0 +1,94 @@
36 +# Copyright 1999-2022 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=8
40 +
41 +inherit systemd tmpfiles
42 +
43 +DESCRIPTION="Free and Open, Distributed, RESTful Search Engine"
44 +HOMEPAGE="https://www.elastic.co/elasticsearch/"
45 +SRC_URI="https://artifacts.elastic.co/downloads/${PN}/${P}-linux-x86_64.tar.gz"
46 +LICENSE="Apache-2.0 BSD-2 Elastic-2.0 LGPL-3 MIT public-domain"
47 +SLOT="0"
48 +KEYWORDS="~amd64"
49 +
50 +PATCHES=(
51 + "${FILESDIR}/${PN}-env.patch"
52 +)
53 +
54 +BDEPEND="acct-group/elasticsearch
55 + acct-user/elasticsearch"
56 +
57 +RDEPEND="acct-group/elasticsearch
58 + acct-user/elasticsearch
59 + sys-libs/zlib
60 + virtual/jre:17"
61 +
62 +QA_PREBUILT="usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/\(bin\|lib\)/.*"
63 +QA_PRESTRIPPED="usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/\(bin\|lib\)/.*"
64 +
65 +src_prepare() {
66 + default
67 + rm -rf jdk || die
68 + sed -i -e "s:logs/:/var/log/${PN}/:g" config/jvm.options || die
69 + rm LICENSE.txt NOTICE.txt || die
70 + rmdir logs || die
71 +}
72 +
73 +src_install() {
74 + keepdir /etc/${PN}
75 + keepdir /etc/${PN}/scripts
76 +
77 + insinto /etc/${PN}
78 + doins -r config/.
79 + rm -r config || die
80 +
81 + fowners -R root:${PN} /etc/${PN}
82 + fperms -R 2750 /etc/${PN}
83 +
84 + insinto /usr/share/${PN}
85 + doins -r .
86 +
87 + keepdir /usr/share/${PN}/plugins
88 +
89 + exeinto /usr/share/${PN}/bin
90 + doexe ${FILESDIR}/elasticsearch-systemd-pre-exec
91 +
92 + fperms -R +x /usr/share/${PN}/bin
93 + fperms -R +x /usr/share/${PN}/modules/x-pack-ml/platform/linux-x86_64/bin
94 +
95 + keepdir /var/{lib,log}/${PN}
96 + fowners ${PN}:${PN} /var/{lib,log}/${PN}
97 + fperms 0750 /var/{lib,log}/${PN}
98 +
99 + insinto /etc/sysctl.d
100 + newins "${FILESDIR}/${PN}.sysctl.d" ${PN}.conf
101 +
102 + newconfd "${FILESDIR}/${PN}.conf.4" ${PN}
103 + newinitd "${FILESDIR}/${PN}.init.8" ${PN}
104 +
105 + systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
106 + systemd_newunit "${FILESDIR}"/${PN}.service.4 ${PN}.service
107 +
108 + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.d ${PN}.conf
109 +}
110 +
111 +pkg_postinst() {
112 + # Elasticsearch will choke on our keep file and dodir will not preserve the empty dir
113 + rm /usr/share/${PN}/plugins/.keep* || die
114 + tmpfiles_process /usr/lib/tmpfiles.d/${PN}.conf
115 + if [ ! systemd_is_booted ]; then
116 + elog "You may create multiple instances of ${PN} by"
117 + elog "symlinking the init script:"
118 + elog "ln -sf /etc/init.d/${PN} /etc/init.d/${PN}.instance"
119 + elog
120 + elog "Please make sure you put elasticsearch.yml, log4j2.properties and scripts"
121 + elog "from /etc/${PN} into the configuration directory of the instance:"
122 + elog "/etc/${PN}/instance"
123 + elog
124 + fi
125 + ewarn "Please make sure you have proper permissions on /etc/${PN}"
126 + ewarn "prior to keystore generation or you may experience startup failures."
127 + ewarn "chown root:${PN} /etc/${PN} && chmod 2750 /etc/${PN}"
128 + ewarn "chown root:${PN} /etc/${PN}/${PN}.keystore && chmod 0660 /etc/${PN}/${PN}.keystore"
129 +}
130
131 diff --git a/app-misc/elasticsearch/files/elasticsearch-env.patch b/app-misc/elasticsearch/files/elasticsearch-env.patch
132 new file mode 100644
133 index 000000000000..fb150bb51db3
134 --- /dev/null
135 +++ b/app-misc/elasticsearch/files/elasticsearch-env.patch
136 @@ -0,0 +1,24 @@
137 +Since ES 8.0.0 upstream stopped distributing a 'no-JDK' package.
138 +This requires us to set `ES_JAVA_HOME` else it fails to find the
139 +JDK that we unbundled and will not start.
140 +--- a/bin/elasticsearch-env
141 ++++ b/bin/elasticsearch-env
142 +@@ -36,6 +36,18 @@ ES_HOME=`dirname "$ES_HOME"`
143 + ES_CLASSPATH="$ES_HOME/lib/*"
144 + LAUNCHERS_CLASSPATH="$ES_CLASSPATH:$ES_HOME/lib/launchers/*"
145 +
146 ++# Set our JVM in a Gentoo-specific manner
147 ++if [ -z "$ES_JAVA_HOME" ]; then
148 ++ GENTOO_VM=$(depend-java-query --get-vm virtual/jre:17)
149 ++ if [ ! -z "$GENTOO_VM" ]; then
150 ++ ES_JAVA_HOME=$(java-config-2 --select-vm=${GENTOO_VM} --jre-home)
151 ++ else
152 ++ echo "Unable to automatically detect a supported Java 17 VM. Elasticsearch is unlikely to launch."
153 ++ echo "Please ensure that you have installed an appropriate Java VM using portage"
154 ++ echo "OR pass the ES_JAVA_HOME environment variable."
155 ++ fi
156 ++fi
157 ++
158 + # now set the path to java
159 + if [ ! -z "$ES_JAVA_HOME" ]; then
160 + JAVA="$ES_JAVA_HOME/bin/java"
161
162 diff --git a/app-misc/elasticsearch/files/elasticsearch.service.4 b/app-misc/elasticsearch/files/elasticsearch.service.4
163 new file mode 100644
164 index 000000000000..6c5b256706c9
165 --- /dev/null
166 +++ b/app-misc/elasticsearch/files/elasticsearch.service.4
167 @@ -0,0 +1,67 @@
168 +[Unit]
169 +Description=Elasticsearch
170 +Documentation=https://www.elastic.co
171 +Wants=network-online.target
172 +After=network-online.target
173 +
174 +[Service]
175 +Type=simple
176 +RuntimeDirectory=elasticsearch
177 +PrivateTmp=true
178 +Environment=ES_HOME=/usr/share/elasticsearch
179 +Environment=ES_PATH_CONF=/etc/elasticsearch
180 +
181 +WorkingDirectory=/usr/share/elasticsearch
182 +
183 +ExecStartPre=+"/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec"
184 +
185 +User=elasticsearch
186 +Group=elasticsearch
187 +
188 +ExecStart=/usr/share/elasticsearch/bin/elasticsearch \
189 + -p ${PID_DIR}/elasticsearch.pid \
190 + -Epath.logs=${LOG_DIR} \
191 + -Epath.data=${DATA_DIR} \
192 + --quiet
193 +
194 +# StandardOutput is configured to redirect to journalctl since
195 +# some error messages may be logged in standard output before
196 +# elasticsearch logging system is initialized. Elasticsearch
197 +# stores its logs in /var/log/elasticsearch and does not use
198 +# journalctl by default. If you also want to enable journalctl
199 +# logging, you can simply remove the "quiet" option from ExecStart.
200 +StandardOutput=journal
201 +StandardError=inherit
202 +
203 +# Specifies the maximum file descriptor number that can be opened by this process
204 +LimitNOFILE=65535
205 +
206 +# Specifies the maximum number of processes
207 +LimitNPROC=4096
208 +
209 +# Specifies the maximum size of virtual memory
210 +LimitAS=infinity
211 +
212 +# Specifies the maximum file size
213 +LimitFSIZE=infinity
214 +
215 +# Disable timeout logic and wait until process is stopped
216 +TimeoutStopSec=0
217 +
218 +# SIGTERM signal is used to stop the Java process
219 +KillSignal=SIGTERM
220 +
221 +# Send the signal only to the JVM rather than its control group
222 +KillMode=process
223 +
224 +# Java process is never killed
225 +SendSIGKILL=no
226 +
227 +# When a JVM receives a SIGTERM signal it exits with code 143
228 +SuccessExitStatus=143
229 +
230 +# Allow a slow startup before the systemd notifier module kicks in to extend the timeout
231 +TimeoutStartSec=75
232 +
233 +[Install]
234 +WantedBy=multi-user.target