Gentoo Archives: gentoo-commits

From: Patrick Lauer <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/elasticsearch/, app-misc/elasticsearch/files/
Date: Fri, 06 May 2016 10:51:09
Message-Id: 1462531856.21dc3e1a5708d888c4d5fefdf124b03a309d5db0.patrick@gentoo
1 commit: 21dc3e1a5708d888c4d5fefdf124b03a309d5db0
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 6 10:50:02 2016 +0000
4 Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org>
5 CommitDate: Fri May 6 10:50:56 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21dc3e1a
7
8 app-misc/elasticsearch: Bump
9
10 Fix #569116
11 New init script and systemd unit, closer to upstream
12 Small bugfixes etc.
13 Thanks to Ferenc Erki for preparing and testing
14
15 Package-Manager: portage-2.2.28
16
17 app-misc/elasticsearch/Manifest | 1 +
18 app-misc/elasticsearch/elasticsearch-2.3.2.ebuild | 76 +++++++++++++++
19 .../files/elasticsearch-systemd-pre-exec | 7 ++
20 app-misc/elasticsearch/files/elasticsearch.conf2 | 67 ++++++++++++++
21 app-misc/elasticsearch/files/elasticsearch.init6 | 102 +++++++++++++++++++++
22 .../elasticsearch/files/elasticsearch.service5 | 53 +++++++++++
23 6 files changed, 306 insertions(+)
24
25 diff --git a/app-misc/elasticsearch/Manifest b/app-misc/elasticsearch/Manifest
26 index cab832a..cf1672e 100644
27 --- a/app-misc/elasticsearch/Manifest
28 +++ b/app-misc/elasticsearch/Manifest
29 @@ -6,3 +6,4 @@ DIST elasticsearch-2.2.0.tar.gz 29419005 SHA256 ed70cc81e1f55cd5f0032beea2907227
30 DIST elasticsearch-2.2.2.tar.gz 29425370 SHA256 c706db594f1feb5051d90697c6c412eadd60e00a9ec3b4f345a122801183af69 SHA512 144ca47dd3b9730e5ff81dd93e5db09d57a6f0d61d4445e8609c0ece833f57ca05d81fdf702d56008bc5e370604deb83d2d527132783467d5ae1eddc6cefeb84 WHIRLPOOL 4d6ced926237490a6ee8531ccf09128cc6bff5d73cff6f36159552a4a7a0dfbe01df0dfafb583d1c7ddc47ad5fa054ab6dd8c188cc7e3fe196f6917519e1afac
31 DIST elasticsearch-2.3.0.tar.gz 27556947 SHA256 d68482c7633f2986263bc5f11f93b8a58c54c6cf5e337b615446d0a7c6fdcd8b SHA512 26671d64e6cd3406ad1de4543d84c66f58be4906d00ad22584350c5b28359c2b878850fb7cd0e49c9913d968380e8e386d77376c4f32fc37d3a43913c21558db WHIRLPOOL d26a3128d12630fca4defb669b7e23749f9742e1bf7c9497860effdbe6f51c8e86b467d3a16c78c77b7dd93efaa25e21c9694308292567eaa8e07794c57d60db
32 DIST elasticsearch-2.3.1.tar.gz 27540442 SHA256 f0092e73038e0472fcdd923e5f2792e13692ea0f09ca034a54dd49b217110ebb SHA512 447d8824c4bfbec9b8431d213e3a8ae6720d1486e1389c271cc67cce5546861a817ef8c7db1c3c3669a50a61b5305739ac26f46b04d5674bbca203c3b5dbcf2f WHIRLPOOL e55501ca7fa702c33cd826d51c2d90dcfcc2843fb5b24b2d20df917cc291fe53f203360bfac6249b57c4c2914d92da92ca56b6505b6be885ece196983c176b9c
33 +DIST elasticsearch-2.3.2.tar.gz 27543334 SHA256 04c4d3913d496d217e038da88df939108369ae2e78eea29cb1adf1c4ab3a000a SHA512 73c4ca82eb0f4dc22907a94b9025e79183f6fcd38dbb82795800d10fc810dbee412784e62f9247390f0fb9aa19545976584bd2b62f1afe79d2cd64bb55f76dc8 WHIRLPOOL 5cc44a827de5281a9fb823a8a2e43755e0853dc5aa27f5ef7f8d1c5605d80a2dbf4c8756f01811a54307938cb3030634be6c8af2ffa465e2f35cd2a4aabeeb20
34
35 diff --git a/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild b/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild
36 new file mode 100644
37 index 0000000..a0baa8b
38 --- /dev/null
39 +++ b/app-misc/elasticsearch/elasticsearch-2.3.2.ebuild
40 @@ -0,0 +1,76 @@
41 +# Copyright 1999-2016 Gentoo Foundation
42 +# Distributed under the terms of the GNU General Public License v2
43 +# $Id$
44 +
45 +EAPI=5
46 +
47 +inherit eutils systemd user
48 +
49 +MY_PN="${PN%-bin}"
50 +DESCRIPTION="Open Source, Distributed, RESTful, Search Engine"
51 +HOMEPAGE="https://www.elastic.co/products/elasticsearch"
52 +SRC_URI="https://download.elasticsearch.org/${MY_PN}/release/org/${MY_PN}/distribution/tar/${MY_PN}/${PV}/${P}.tar.gz"
53 +LICENSE="Apache-2.0"
54 +SLOT="0"
55 +KEYWORDS="~amd64"
56 +
57 +RESTRICT="strip"
58 +
59 +RDEPEND="|| ( virtual/jre:1.8 virtual/jre:1.7 )"
60 +
61 +pkg_preinst() {
62 + if has_version '<app-misc/elasticsearch-2.3.2'; then
63 + export UPDATE_NOTES=1
64 + fi
65 +}
66 +
67 +pkg_setup() {
68 + enewgroup ${MY_PN}
69 + enewuser ${MY_PN} -1 /bin/bash /usr/share/${MY_PN} ${MY_PN}
70 + esethome ${MY_PN} /usr/share/${MY_PN}
71 +}
72 +
73 +src_prepare() {
74 + rm -rf bin/*.{bat,exe}
75 + rm LICENSE.txt
76 +}
77 +
78 +src_install() {
79 + dodir /etc/${MY_PN}
80 + dodir /etc/${MY_PN}/scripts
81 +
82 + insinto /etc/${MY_PN}
83 + doins config/*
84 + rm -rf config
85 +
86 + insinto /usr/share/${MY_PN}
87 + doins -r ./*
88 +
89 + insinto /usr/share/${MY_PN}/bin
90 + doins "${FILESDIR}/elasticsearch-systemd-pre-exec"
91 +
92 + chmod +x "${D}"/usr/share/${MY_PN}/bin/*
93 +
94 + keepdir /var/{lib,log}/${MY_PN}
95 + keepdir /usr/share/${MY_PN}/plugins
96 +
97 + newinitd "${FILESDIR}/elasticsearch.init6" "${MY_PN}"
98 + newconfd "${FILESDIR}/${MY_PN}.conf2" "${MY_PN}"
99 + systemd_newunit "${FILESDIR}"/${PN}.service5 "${PN}.service"
100 +}
101 +
102 +pkg_postinst() {
103 + elog
104 + elog "You may create multiple instances of ${MY_PN} by"
105 + elog "symlinking the init script:"
106 + elog "ln -sf /etc/init.d/${MY_PN} /etc/init.d/${MY_PN}.instance"
107 + elog
108 + elog "Please make sure you put elasticsearch.yml and logging.yml"
109 + elog "into the configuration directory of the instance:"
110 + elog "/etc/${MY_PN}/instance"
111 + elog
112 + if ! [ -z ${UPDATE_NOTES} ]; then
113 + elog "This update changes some configuration variables. Please review"
114 + elog "/etc/conf.d/elasticsearch before restarting your services."
115 + fi
116 +}
117
118 diff --git a/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec
119 new file mode 100755
120 index 0000000..a51d639
121 --- /dev/null
122 +++ b/app-misc/elasticsearch/files/elasticsearch-systemd-pre-exec
123 @@ -0,0 +1,7 @@
124 +#!/bin/sh
125 +
126 +# CONF_FILE setting was removed
127 +if [ ! -z "$CONF_FILE" ]; then
128 + echo "CONF_FILE setting is no longer supported. elasticsearch.yml must be placed in the config directory and cannot be renamed."
129 + exit 1
130 +fi
131
132 diff --git a/app-misc/elasticsearch/files/elasticsearch.conf2 b/app-misc/elasticsearch/files/elasticsearch.conf2
133 new file mode 100644
134 index 0000000..053cd18
135 --- /dev/null
136 +++ b/app-misc/elasticsearch/files/elasticsearch.conf2
137 @@ -0,0 +1,67 @@
138 +################################
139 +# Elasticsearch
140 +################################
141 +
142 +# Elasticsearch configuration directory
143 +#CONF_DIR=/etc/elasticsearch
144 +
145 +# Elasticsearch data directory
146 +#DATA_DIR=/var/lib/elasticsearch
147 +
148 +# Elasticsearch logs directory
149 +#LOG_DIR=/var/log/elasticsearch
150 +
151 +# Elasticsearch PID directory
152 +#PID_DIR=/run/elasticsearch
153 +
154 +# Heap size defaults to 256m min, 1g max
155 +# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
156 +#ES_HEAP_SIZE=2g
157 +
158 +# Heap new generation
159 +#ES_HEAP_NEWSIZE=
160 +
161 +# Maximum direct memory
162 +#ES_DIRECT_SIZE=
163 +
164 +# Additional Java OPTS
165 +#ES_JAVA_OPTS=
166 +
167 +# Path to the GC log file
168 +#ES_GC_LOG_FILE=/var/log/elasticsearch/gc.log
169 +
170 +################################
171 +# Elasticsearch service
172 +################################
173 +
174 +# When executing the init script, this user will be used to run the elasticsearch service.
175 +# The default value is 'elasticsearch' and is declared in the init.d file.
176 +# Note that this setting is only used by the init script. If changed, make sure that
177 +# the configured user can read and write into the data, work, plugins and log directories.
178 +# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service
179 +#ES_USER=elasticsearch
180 +#ES_GROUP=elasticsearch
181 +
182 +# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
183 +#ES_STARTUP_SLEEP_TIME=5
184 +
185 +################################
186 +# System properties
187 +################################
188 +
189 +# Specifies the maximum file descriptor number that can be opened by this process
190 +# When using Systemd, this setting is ignored and the LimitNOFILE defined in
191 +# /usr/lib/systemd/system/elasticsearch.service takes precedence
192 +#MAX_OPEN_FILES=65535
193 +
194 +# The maximum number of bytes of memory that may be locked into RAM
195 +# Set to "unlimited" if you use the 'bootstrap.mlockall: true' option
196 +# in elasticsearch.yml (ES_HEAP_SIZE must also be set).
197 +# When using Systemd, the LimitMEMLOCK property must be set
198 +# in /usr/lib/systemd/system/elasticsearch.service
199 +#MAX_LOCKED_MEMORY=unlimited
200 +
201 +# Maximum number of VMA (Virtual Memory Areas) a process can own
202 +# When using Systemd, this setting is ignored and the 'vm.max_map_count'
203 +# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
204 +#MAX_MAP_COUNT=262144
205
206 diff --git a/app-misc/elasticsearch/files/elasticsearch.init6 b/app-misc/elasticsearch/files/elasticsearch.init6
207 new file mode 100644
208 index 0000000..9225f48
209 --- /dev/null
210 +++ b/app-misc/elasticsearch/files/elasticsearch.init6
211 @@ -0,0 +1,102 @@
212 +#!/sbin/runscript
213 +
214 +name="Elasticsearch"
215 +description="Elasticsearch Server"
216 +
217 +ES_INSTANCE=${SVCNAME#*.}
218 +PID_DIR=${PID_DIR:="/run/elasticsearch"}
219 +
220 +if [ -n "${ES_INSTANCE}" ] && [ ${SVCNAME} != "elasticsearch" ]; then
221 + PIDFILE="${PID_DIR}/elasticsearch.${ES_INSTANCE}.pid"
222 + ES_BASE_PATH="/var/lib/elasticsearch/${ES_INSTANCE}"
223 + CONF_DIR="/etc/elasticsearch/${ES_INSTANCE}"
224 + LOG_DIR="/var/log/elasticsearch/${ES_INSTANCE}"
225 +else
226 + PIDFILE="${PID_DIR}/elasticsearch.pid"
227 + ES_BASE_PATH="/var/lib/elasticsearch/_default"
228 + CONF_DIR="/etc/elasticsearch"
229 + LOG_DIR="/var/log/elasticsearch/_default"
230 +fi
231 +
232 +ES_HOME=${ES_HOME:="/usr/share/elasticsearch"}
233 +ES_USER=${ES_USER:="elasticsearch"}
234 +ES_GROUP=${ES_GROUP:="elasticsearch"}
235 +ES_GC_LOG_FILE=${ES_GC_LOG_FILE:="${LOG_DIR}/gc.log"}
236 +MAX_OPEN_FILES=${MAX_OPEN_FILES:=65535}
237 +MAX_MAP_COUNT=${MAX_MAP_COUNT:=262144}
238 +
239 +DATA_DIR="${ES_BASE_PATH}/data"
240 +
241 +if [ -f "${CONF_DIR}/elasticsearch.in.sh" ]; then
242 + ES_INCLUDE="${CONF_DIR}/elasticsearch.in.sh"
243 +fi
244 +
245 +export ES_INCLUDE
246 +export JAVA_OPTS
247 +export ES_JAVA_OPTS
248 +export ES_HEAP_SIZE
249 +export ES_HEAP_NEWSIZE
250 +export ES_DIRECT_SIZE
251 +export ES_GC_LOG_FILE
252 +export ES_STARTUP_SLEEP_TIME
253 +
254 +server_command="/usr/share/elasticsearch/bin/elasticsearch"
255 +server_args="-d -p ${PIDFILE} --default.path.home=${ES_HOME} --default.path.logs=${LOG_DIR} --default.path.data=${DATA_DIR} --default.path.conf=${CONF_DIR}"
256 +
257 +depend() {
258 + use net
259 +}
260 +
261 +start() {
262 + local conf
263 + local conf_file
264 + for conf in elasticsearch.yml logging.yml; do
265 + conf_file="${CONF_DIR}/${conf}"
266 + if [ ! -f "${conf_file}" ]; then
267 + eerror "${conf_file} must be copied into place"
268 + return 1
269 + fi
270 + done
271 +
272 + if [ -n "${MAX_LOCKED_MEMORY}" -a -z "${ES_HEAP_SIZE}" ]; then
273 + eerror "MAX_LOCKED_MEMORY is set - ES_HEAP_SIZE must also be set"
274 + return 1
275 + fi
276 +
277 + if [ -n "${MAX_MAP_COUNT}" -a -f /proc/sys/vm/max_map_count ]; then
278 + sysctl -q -w vm.max_map_count=${MAX_MAP_COUNT}
279 + fi
280 +
281 + ebegin "Starting ${SVCNAME}"
282 +
283 + if [ -n "${MAX_LOCKED_MEMORY}" ]; then
284 + rc_ulimit="${rc_ulimit} -l ${MAX_LOCKED_MEMORY}"
285 + fi
286 +
287 + if [ -n "${MAX_OPEN_FILES}" ]; then
288 + rc_ulimit="${rc_ulimit} -n ${MAX_OPEN_FILES}"
289 + fi
290 +
291 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/lib/elasticsearch"
292 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "/var/log/elasticsearch"
293 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${PID_DIR}"
294 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${ES_BASE_PATH}"
295 + checkpath -d -o "${ES_USER}:${ES_GROUP}" -m750 "${LOG_DIR}"
296 +
297 + start-stop-daemon --start \
298 + --background \
299 + --chdir "${ES_HOME}" \
300 + --user="${ES_USER}" \
301 + --pidfile="${PIDFILE}" \
302 + --exec ${server_command} -- ${server_args}
303 + eend $?
304 +}
305 +
306 +stop() {
307 + ebegin "Stopping ${SVCNAME}"
308 + start-stop-daemon --stop \
309 + --pidfile=${PIDFILE} \
310 + --user="${ES_USER}" \
311 + --retry=TERM/20
312 + eend $?
313 +}
314
315 diff --git a/app-misc/elasticsearch/files/elasticsearch.service5 b/app-misc/elasticsearch/files/elasticsearch.service5
316 new file mode 100644
317 index 0000000..80ece64
318 --- /dev/null
319 +++ b/app-misc/elasticsearch/files/elasticsearch.service5
320 @@ -0,0 +1,53 @@
321 +[Unit]
322 +Description=Elasticsearch
323 +Documentation=http://www.elastic.co
324 +Wants=network.target
325 +After=network.target
326 +
327 +[Service]
328 +Environment=ES_HOME=/usr/share/elasticsearch
329 +Environment=CONF_DIR=/etc/elasticsearch
330 +Environment=DATA_DIR=/var/lib/elasticsearch
331 +Environment=LOG_DIR=/var/log/elasticsearch
332 +Environment=PID_DIR=/run/elasticsearch
333 +EnvironmentFile=-/etc/conf.d/elasticsearch
334 +
335 +WorkingDirectory=/usr/share/elasticsearch
336 +
337 +User=elasticsearch
338 +Group=elasticsearch
339 +
340 +ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec
341 +
342 +ExecStart=/usr/share/elasticsearch/bin/elasticsearch \
343 + -Des.pidfile=${PID_DIR}/elasticsearch.pid \
344 + -Des.default.path.home=${ES_HOME} \
345 + -Des.default.path.logs=${LOG_DIR} \
346 + -Des.default.path.data=${DATA_DIR} \
347 + -Des.default.path.conf=${CONF_DIR}
348 +
349 +StandardOutput=journal
350 +StandardError=inherit
351 +
352 +# Specifies the maximum file descriptor number that can be opened by this process
353 +LimitNOFILE=65535
354 +
355 +# Specifies the maximum number of bytes of memory that may be locked into RAM
356 +# Set to "infinity" if you use the 'bootstrap.mlockall: true' option
357 +# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/conf.d/elasticsearch
358 +#LimitMEMLOCK=infinity
359 +
360 +# Disable timeout logic and wait until process is stopped
361 +TimeoutStopSec=0
362 +
363 +# SIGTERM signal is used to stop the Java process
364 +KillSignal=SIGTERM
365 +
366 +# Java process is never killed
367 +SendSIGKILL=no
368 +
369 +# When a JVM receives a SIGTERM signal it exits with code 143
370 +SuccessExitStatus=143
371 +
372 +[Install]
373 +WantedBy=multi-user.target