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/, app-misc/elasticsearch/files/
Date: Tue, 30 Mar 2021 07:25:36
Message-Id: 1617089119.85494c7240b9621bbda8a7baa97fb1fd9b7d8522.juippis@gentoo
1 commit: 85494c7240b9621bbda8a7baa97fb1fd9b7d8522
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Thu Mar 25 14:53:18 2021 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 30 07:25:19 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85494c72
7
8 app-misc/elasticsearch: bump to 7.12.0
9
10 Bug: https://bugs.gentoo.org/775059
11 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
12 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
13
14 app-misc/elasticsearch/Manifest | 1 +
15 app-misc/elasticsearch/elasticsearch-7.12.0.ebuild | 81 ++++++++++++++++++++++
16 app-misc/elasticsearch/files/elasticsearch.conf.4 | 62 +++++++++++++++++
17 app-misc/elasticsearch/files/elasticsearch.init.8 | 70 +++++++++++++++++++
18 4 files changed, 214 insertions(+)
19
20 diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest
21 index 81f9d442334..427f9d66345 100644
22 --- a/app-misc/elasticsearch/Manifest
23 +++ b/app-misc/elasticsearch/Manifest
24 @@ -1,5 +1,6 @@
25 DIST elasticsearch-6.8.14.tar.gz 149098495 BLAKE2B f1ccfcd9647a3584594a9db78f92488bc6bd5fe403c9b2cdff9001b87168136817084ce28eb8f14c6e54dd75b88118cf0eb6993e5502e74ecf826938f4c2ff57 SHA512 d7ca05707b9e3d8de19aaebc7811891a82897b2407f3de27ac95b2aad0d6669217c741e14bf768c3ea963977e3fa2ecc2f6d297aeafe985db52f6eb6780912b7
26 DIST elasticsearch-7.10.2-no-jdk-linux-x86_64.tar.gz 164380146 BLAKE2B 16797ed48c4cb6f91ed891014f275ad86a4852579232df1827413389fc9e505327412729f70783750252190a34b0e0d552ec0b5f25f3d0a811724191eccc6568 SHA512 bd3def00af04670ad04556c911ef8c68b639e1c3b621f36a8973d9700f95873d10bc706a4e3a98f892ac59c1b761d56035a236068d6958af772874e428940dc4
27 +DIST elasticsearch-7.12.0-no-jdk-linux-x86_64.tar.gz 173069694 BLAKE2B 5de74b1e6de743246cf48e32254f9646fa25c2820d0be9df886fdefe131a302ddb8906546147f0d284e2fc0faf8cc0238bf854fe1611d28bf1e7cb1518bd4e31 SHA512 205aa2a2fa2ab7eb7b54087420e0123aa97e5456e2e1f31cad9ea7b84be3f9823a2a7c47d4cf1697833e5f795359477d3a3b0ea4955a8f92583cf2228071827e
28 DIST elasticsearch-7.9.3-no-jdk-linux-x86_64.tar.gz 162808745 BLAKE2B e6a12ec3cc3bec0bdf8dd10680dd86214bf619b1abfdfeb8524b0b0f50a0f1faaf03b13f06ab62055f80c7987dd04b0dd9f2beba16dd59a5d346fc6cceb51acd SHA512 fea21591edc790b9d5c48151619921085d1b0e5dad1f8c43efbd44a58babeb8bfad52f4329f1f34c71d47618e24d7320c0e591f8eb65d15c2b9c3e1492d91680
29 DIST elasticsearch-oss-6.8.14.tar.gz 68236681 BLAKE2B 09c6c23517b880ee1afb1c3472d4518172927c226386c7d0f2f5b9312e7de236bd6fa7d527b949e3cace759af6a1fdfe7d72f1ccf8e2c6e15919c4c8c989ee9e SHA512 c0372969ec9e5f7aff551bc0aa13684fdaccd5a553e8ee896979488ab2f13181642222ab4eca4dc799181bce1405200b5aea4866c830483ce1e484fa6a714998
30 DIST elasticsearch-oss-7.10.2-no-jdk-linux-x86_64.tar.gz 76383466 BLAKE2B e99c04b0d10ef5755986515c7127ebde00b58e0eba69b6a05e12bd0bffee70266bbb023680584bfe0f321d5a3cf79af89cce3a5191923ad721a9f6039ab82743 SHA512 7b63237996569ccdc7c9d9e7cc097fcb23865396eddac30e5f02543484220d2fc70a7285b430877e5e76a5d8716d9682de9fc40d5e57a08f331e82011fc59756
31
32 diff --git a/app-misc/elasticsearch/elasticsearch-7.12.0.ebuild b/app-misc/elasticsearch/elasticsearch-7.12.0.ebuild
33 new file mode 100644
34 index 00000000000..1eba30da241
35 --- /dev/null
36 +++ b/app-misc/elasticsearch/elasticsearch-7.12.0.ebuild
37 @@ -0,0 +1,81 @@
38 +# Copyright 1999-2021 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=7
42 +
43 +inherit systemd tmpfiles
44 +
45 +DESCRIPTION="Free and Open, Distributed, RESTful Search Engine"
46 +HOMEPAGE="https://www.elastic.co/elasticsearch/"
47 +SRC_URI="https://artifacts.elastic.co/downloads/${PN}/${P}-no-jdk-linux-x86_64.tar.gz"
48 +LICENSE="Apache-2.0 BSD-2 Elastic-2.0 LGPL-3 MIT public-domain"
49 +SLOT="0"
50 +KEYWORDS="~amd64"
51 +
52 +RDEPEND="acct-group/elasticsearch
53 + acct-user/elasticsearch
54 + virtual/jre"
55 +
56 +QA_PRESTRIPPED="usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/\(bin\|lib\)/.*"
57 +
58 +src_prepare() {
59 + default
60 +
61 + rm LICENSE.txt NOTICE.txt || die
62 + rmdir logs || die
63 +}
64 +
65 +src_install() {
66 + keepdir /etc/${PN}
67 + keepdir /etc/${PN}/scripts
68 +
69 + insinto /etc/${PN}
70 + doins -r config/.
71 + rm -r config || die
72 +
73 + fowners root:${PN} /etc/${PN}
74 + fperms 2750 /etc/${PN}
75 +
76 + insinto /usr/share/${PN}
77 + doins -r .
78 +
79 + exeinto /usr/share/${PN}/bin
80 + doexe "${FILESDIR}/elasticsearch-systemd-pre-exec"
81 +
82 + fperms -R +x /usr/share/${PN}/bin
83 + fperms -R +x /usr/share/${PN}/modules/x-pack-ml/platform/linux-x86_64/bin
84 +
85 + keepdir /var/{lib,log}/${PN}
86 + fowners ${PN}:${PN} /var/{lib,log}/${PN}
87 + fperms 0750 /var/{lib,log}/${PN}
88 + dodir /usr/share/${PN}/plugins
89 +
90 + insinto /etc/sysctl.d
91 + newins "${FILESDIR}/${PN}.sysctl.d" ${PN}.conf
92 +
93 + newconfd "${FILESDIR}/${PN}.conf.4" ${PN}
94 + newinitd "${FILESDIR}/${PN}.init.8" ${PN}
95 +
96 + systemd_install_serviced "${FILESDIR}/${PN}.service.conf"
97 + systemd_newunit "${FILESDIR}"/${PN}.service.3 ${PN}.service
98 +
99 + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles.d ${PN}.conf
100 +}
101 +
102 +pkg_postinst() {
103 + tmpfiles_process /usr/lib/tmpfiles.d/${PN}.conf
104 +
105 + elog
106 + elog "You may create multiple instances of ${PN} by"
107 + elog "symlinking the init script:"
108 + elog "ln -sf /etc/init.d/${PN} /etc/init.d/${PN}.instance"
109 + elog
110 + elog "Please make sure you put elasticsearch.yml, log4j2.properties and scripts"
111 + elog "from /etc/${PN} into the configuration directory of the instance:"
112 + elog "/etc/${PN}/instance"
113 + elog
114 + ewarn "Please make sure you have proper permissions on /etc/${PN}"
115 + ewarn "prior to keystore generation or you may experience startup fails."
116 + ewarn "chown root:${PN} /etc/${PN} && chmod 2750 /etc/${PN}"
117 + ewarn "chown root:${PN} /etc/${PN}/${PN}.keystore && chmod 0660 /etc/${PN}/${PN}.keystore"
118 +}
119
120 diff --git a/app-misc/elasticsearch/files/elasticsearch.conf.4 b/app-misc/elasticsearch/files/elasticsearch.conf.4
121 new file mode 100644
122 index 00000000000..a76bc5b7be3
123 --- /dev/null
124 +++ b/app-misc/elasticsearch/files/elasticsearch.conf.4
125 @@ -0,0 +1,62 @@
126 +################################
127 +# Elasticsearch
128 +################################
129 +
130 +# Elasticsearch home directory
131 +#ES_HOME=/usr/share/elasticsearch
132 +
133 +# Elasticsearch Java path
134 +#ES_JAVA_HOME=
135 +
136 +# Elasticsearch configuration directory
137 +#CONF_DIR=/etc/elasticsearch
138 +
139 +# Elasticsearch data directory
140 +#DATA_DIR=/var/lib/elasticsearch
141 +
142 +# Elasticsearch logs directory
143 +#LOG_DIR=/var/log/elasticsearch
144 +
145 +# Additional Java OPTS
146 +#ES_JAVA_OPTS=
147 +
148 +################################
149 +# Elasticsearch service
150 +################################
151 +
152 +# When executing the init script, this user will be used to run the elasticsearch service.
153 +# The default value is 'elasticsearch' and is declared in the init.d file.
154 +# Note that this setting is only used by the init script. If changed, make sure that
155 +# the configured user can read and write into the data, work, plugins and log directories.
156 +# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service
157 +#ES_USER=elasticsearch
158 +#ES_GROUP=elasticsearch
159 +
160 +# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
161 +#ES_STARTUP_SLEEP_TIME=5
162 +
163 +################################
164 +# System properties
165 +################################
166 +
167 +# Specifies the maximum file descriptor number that can be opened by this process
168 +# When using Systemd, this setting is ignored and the LimitNOFILE defined in
169 +# /usr/lib/systemd/system/elasticsearch.service takes precedence
170 +MAX_OPEN_FILES=65536
171 +
172 +# The maximum number of bytes of memory that may be locked into RAM
173 +# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
174 +# in elasticsearch.yml.
175 +# When using Systemd, the LimitMEMLOCK property must be set
176 +# in /usr/lib/systemd/system/elasticsearch.service
177 +MAX_LOCKED_MEMORY=unlimited
178 +
179 +# Maximum number of VMA (Virtual Memory Areas) a process can own
180 +# When using Systemd, this setting is ignored and the 'vm.max_map_count'
181 +# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
182 +#MAX_MAP_COUNT=262144
183 +
184 +# https://www.elastic.co/guide/en/elasticsearch/reference/master/max-number-of-threads.html
185 +MAX_THREADS=4096
186 +
187 +rc_ulimit="-l $MAX_LOCKED_MEMORY -n $MAX_OPEN_FILES -u $MAX_THREADS"
188
189 diff --git a/app-misc/elasticsearch/files/elasticsearch.init.8 b/app-misc/elasticsearch/files/elasticsearch.init.8
190 new file mode 100644
191 index 00000000000..e45ece0829b
192 --- /dev/null
193 +++ b/app-misc/elasticsearch/files/elasticsearch.init.8
194 @@ -0,0 +1,70 @@
195 +#!/sbin/openrc-run
196 +
197 +name="Elasticsearch"
198 +description="Elasticsearch Server"
199 +
200 +ES_INSTANCE=${RC_SVCNAME#*.}
201 +
202 +if [ -n "${ES_INSTANCE}" ] && [ ${RC_SVCNAME} != "elasticsearch" ]; then
203 + ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}"
204 + CONF_DIR="/etc/elasticsearch/${ES_INSTANCE}"
205 + DEFAULT_LOG_DIR="/var/log/elasticsearch/${ES_INSTANCE}"
206 +else
207 + ES_BASE_PATH="/var/lib/elasticsearch/_default"
208 + CONF_DIR="/etc/elasticsearch"
209 + DEFAULT_LOG_DIR="/var/log/elasticsearch/_default"
210 +fi
211 +
212 +ES_HOME=${ES_HOME:="/usr/share/elasticsearch"}
213 +ES_USER=${ES_USER:="elasticsearch"}
214 +ES_GROUP=${ES_GROUP:="elasticsearch"}
215 +ES_STARTUP_SLEEP_TIME=${ES_STARTUP_TIME:=5}
216 +ES_JAVA_HOME=${ES_JAVA_HOME:=$(java-config -g JAVA_HOME)}
217 +MAX_OPEN_FILES=${MAX_OPEN_FILES:=65536}
218 +MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144}
219 +
220 +DATA_DIR=${DATA_DIR:="${ES_BASE_PATH}/data"}
221 +LOG_DIR=${LOG_DIR:="${DEFAULT_LOG_DIR}"}
222 +
223 +if [ -f "${CONF_DIR}/elasticsearch.in.sh" ]; then
224 + ES_INCLUDE="${CONF_DIR}/elasticsearch.in.sh"
225 +fi
226 +
227 +export ES_INCLUDE
228 +export ES_JAVA_HOME
229 +export ES_JAVA_OPTS
230 +export ES_JVM_OPTIONS
231 +export ES_STARTUP_SLEEP_TIME
232 +export ES_PATH_CONF="${CONF_DIR}"
233 +
234 +pidfile="/run/elasticsearch/${RC_SVCNAME}.pid"
235 +
236 +command="/usr/share/elasticsearch/bin/elasticsearch"
237 +command_args="-Epath.logs=${LOG_DIR} -Epath.data=${DATA_DIR}"
238 +command_args_background="--daemonize --pidfile=${pidfile}"
239 +command_user="${ES_USER}:${ES_GROUP}"
240 +required_files="${CONF_DIR}/elasticsearch.yml"
241 +retry="TERM/30/KILL/30"
242 +
243 +depend() {
244 + use net
245 +}
246 +
247 +start_pre() {
248 + if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then
249 + sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT}
250 + fi
251 +
252 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/lib/elasticsearch"
253 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/log/elasticsearch"
254 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/run/elasticsearch"
255 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${ES_BASE_PATH}"
256 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${LOG_DIR}"
257 +
258 + # fails to start without keystore
259 + if [ ! -f "${CONF_DIR}/elasticsearch.keystore" ]; then
260 + "${ES_HOME}/bin/elasticsearch-keystore" create
261 + else
262 + "${ES_HOME}/bin/elasticsearch-keystore" upgrade
263 + fi
264 +}