diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-03-28 20:14:40 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-03-30 08:28:30 +0000 |
commit | 9e7efafcb1a3084cf460671fadbe2f804cfe3897 (patch) | |
tree | 27ed10ec53912fc55e88b831905350bf2a5defcb /testing | |
parent | e379b72e209d55a68ac76a614c358e7bb8ea23f1 (diff) | |
download | aports-9e7efafcb1a3084cf460671fadbe2f804cfe3897.tar.bz2 aports-9e7efafcb1a3084cf460671fadbe2f804cfe3897.tar.xz |
testing/elasticsearch: new abuild
https://www.elastic.co/products/elasticsearch
Open Source, Distributed, RESTful Search Engine
Diffstat (limited to 'testing')
-rw-r--r-- | testing/elasticsearch/APKBUILD | 73 | ||||
-rw-r--r-- | testing/elasticsearch/elasticsearch.confd | 59 | ||||
-rw-r--r-- | testing/elasticsearch/elasticsearch.initd | 78 | ||||
-rw-r--r-- | testing/elasticsearch/elasticsearch.pre-install | 7 |
4 files changed, 217 insertions, 0 deletions
diff --git a/testing/elasticsearch/APKBUILD b/testing/elasticsearch/APKBUILD new file mode 100644 index 0000000000..982d98cf13 --- /dev/null +++ b/testing/elasticsearch/APKBUILD @@ -0,0 +1,73 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +pkgname=elasticsearch +pkgver=2.2.1 +pkgrel=0 +pkgdesc="Open Source, Distributed, RESTful Search Engine" +url="https://www.elastic.co/products/elasticsearch" +arch="noarch" +license="ASL 2.0" +depends="openjdk8-jre" +makedepends="" +install="$pkgname.pre-install" +source="https://download.elasticsearch.org/$pkgname/release/org/$pkgname/distribution/tar/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz + $pkgname.initd + $pkgname.confd + " + +_modules="lang-expression lang-groovy" +for _mod in $_modules; do + subpackages="$subpackages $pkgname-$_mod:_${_mod//-/_}" + eval "_${_mod//-/_}() { _builtin_module $_mod; }" +done + +_builddir="$srcdir/$pkgname-$pkgver" +_basedir="/usr/share/java/$pkgname" + +build() { + sed "s/@@ES_VERSION@@/$pkgver/" "$srcdir"/$pkgname.initd \ + > "$_builddir"/$pkgname.initd +} + +package() { + local destdir="$pkgdir/$_basedir" + local confdir="$pkgdir/etc/$pkgname" + local user="elastico" + local group="$user" + + cd "$_builddir" + + install -dm755 "$destdir"/lib "$destdir"/modules + install -m644 -t "$destdir"/lib lib/* || return 1 + + install -dm755 "$confdir" + install -m644 -t "$confdir" config/* || return 1 + + install -dm750 -o $user -g $group "$pkgdir"/var/lib/$pkgname + install -dm755 -o $user -g $group "$pkgdir"/var/log/$pkgname + install -dm700 -o $user -g $group "$pkgdir"/var/tmp/$pkgname + + install -m755 -D $pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname || return 1 + + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname || return 1 +} + +_builtin_module() { + local name="$1" + local destdir="$subpkgdir/$_basedir/modules/$name" + + install -dm755 "$destdir" + install -m644 -t "$destdir" "$_builddir"/modules/$name/* || return 1 +} + +md5sums="3bf8349cc3cc9439e7c8aa9694dfb1da elasticsearch-2.2.1.tar.gz +01d8bdc0fd186f2bb5e0e0672ffd9c21 elasticsearch.initd +11ca8100933039b8433eac9342e9e326 elasticsearch.confd" +sha256sums="7d43d18a8ee8d715d827ed26b4ff3d939628f5a5b654c6e8de9d99bf3a9b2e03 elasticsearch-2.2.1.tar.gz +acaaa0e053e10d1823a742e888a4a56743d58d9d85b664c63e7000f471e6adda elasticsearch.initd +356989a74e111a50862712f877da1078ffbc77a4a2735090e2aa87bfa9cbf1e0 elasticsearch.confd" +sha512sums="9254175afff5c002625465fb5f398e4e53d121925a656af13e65d90eb3b3ef7507ef094cf44002f104a84e5147a8677a05f4071248140d6b48179b9057867cb5 elasticsearch-2.2.1.tar.gz +fd37a8883cda0ad6c065d9bf5ce06c3d62f3927bc88e81b22ca77714f0700b51f971d7c587191b340d021ca3ce3aca1ac99ac08251bcde4901ae3b791a24b1c8 elasticsearch.initd +e1e4b31f8bac2e79118e7bf9b25ca8a31eefa6fb00d35c57ccf2db718236a3255d5cbfe429009a98c6f4a8ded19d291e97e5a4d9c44fa044ed6f9961792f5d62 elasticsearch.confd" diff --git a/testing/elasticsearch/elasticsearch.confd b/testing/elasticsearch/elasticsearch.confd new file mode 100644 index 0000000000..d0852f42e9 --- /dev/null +++ b/testing/elasticsearch/elasticsearch.confd @@ -0,0 +1,59 @@ +# Notes for running multiple instances: +# +# If you want to run multiple instances on the same system, then simply create +# symlink for the runscript and copy this config for each instance as follows: +# +# ln -s /etc/init.d/elasticsearch /etc/init.d/elasticsearch.INSTANCE_NAME +# cp /etc/conf.d/elasticsearch /etc/conf.d/elasticsearch.INSTANCE_NAME +# +# and also copy configuration files: +# +# mkdir /etc/elasticsearch/INSTANCE_NAME +# cp /etc/elasticsearch/*.yml /etc/elasticsearch/INSTANCE_NAME/ +# +# Default INSTANCE_NAME is _default; this is used when running +# /etc/init.d/elasticsearch directly. +# +# Placeholder [INSTANCE_NAME] means that it's omitted for _default (for +# user convenient when running just single instance). +# + +# User to run this ElasticSearch instance. +#user="elastico" + +# Group to run this ElasticSearch instance. Defaults to primary group of $user. +#group= + +# Path of the config directory. +#conf_dir="/etc/elasticsearch/[INSTANCE_NAME]" + +# Path of the instance home (base) directory. +#home_dir="/var/lib/elasticsearch/<INSTANCE_NAME>" + +# Default path of the directory where to store index data. +# This may be overriden in $conf_dir/elasticsearch.yml. +#default_data_dir="$home_dir/data" + +# Default path of the directory where plugins are installed. +# This may be overriden in $conf_dir/elasticsearch.yml. +#default_plugins_dir="$home_dir/plugins" + +# Default path of the directory where to store log files. +# This may be overriden in $conf_dir/elasticsearch.yml. +#default_logs_dir="/var/log/elasticsearch/[INSTANCE_NAME]" + +# Should runscript create $default_logs_dir? +#create_logs_dir="yes" + +# The maximum number of filedescriptors to be allowed. +max_fd="65536" + +# Initial and maximum size of the heap in megabytes. +# Note: This sets parameters -Xms and -Xmx. +#java_heap_size="256" + +# Additional options to pass to the JVM. +java_opts="-Djna.nosys=true" + +# Additional options to pass to the Elasticsearch. +#elastic_opts= diff --git a/testing/elasticsearch/elasticsearch.initd b/testing/elasticsearch/elasticsearch.initd new file mode 100644 index 0000000000..1375baa0a7 --- /dev/null +++ b/testing/elasticsearch/elasticsearch.initd @@ -0,0 +1,78 @@ +#!/sbin/openrc-run + +description="A Distributed RESTful Search Engine." + +instance_name="${SVCNAME#elasticsearch.}" +instance_name="${instance_name/elasticsearch/_default}" + +name="Elasticsearch" +[ "$instance_name" != "_default" ] && name="$name ($instance_name)" + +: ${user:="elastico"} +: ${group:="$(id -gn $user)"} +: ${java_heap_size:="256"} + +: ${conf_dir:="/etc/elasticsearch/${instance_name#_default}"} +: ${home_dir:="/var/lib/elasticsearch/$instance_name"} +: ${default_data_dir:="$home_dir/data"} +: ${default_plugins_dir:="$home_dir/plugins"} +: ${default_logs_dir:="/var/log/elasticsearch/${instance_name#_default}"} +: ${default_script_dir:="$conf_dir/scripts"} +: ${default_work_dir:="/var/tmp/elasticsearch/$instance_name"} +: ${create_logs_dir:="yes"} + +java_opts=" + -server + -XX:+DisableExplicitGC + -Djava.awt.headless=true + -Dfile.encoding=utf-8 + -Xms${java_heap_size}M -Xmx${java_heap_size}M + ${java_max_direct_mem_size:+"-XX:MaxDirectMemorySize=$java_max_direct_mem_size"} + $java_opts" + +lib_dir="/usr/share/java/elasticsearch/lib" +classpath="$lib_dir/elasticsearch-@@ES_VERSION@@.jar:$lib_dir/*" + +command="java" +command_args=" + $java_opts + -Des.path.conf='$conf_dir' + -Des.path.home='$home_dir' + -Des.default.path.data='$default_data_dir' + -Des.default.path.plugins='$default_plugins_dir' + -Des.default.path.work='$default_work_dir' + -Des.default.path.logs='$default_logs_dir' + -Des.default.path.script='$default_script_dir' + -cp $classpath + org.elasticsearch.bootstrap.Elasticsearch start + $elastic_opts" +command_background="yes" + +start_stop_daemon_args=" + --interpreted + --chdir '$home_dir' + --user $user:$group" +pidfile="/run/$SVCNAME.pid" +retry="TERM/20/KILL/5" + +required_files="$conf_dir/elasticsearch.yml $conf_dir/logging.yml" + +depend() { + use net +} + +start_pre() { + checkpath -d -o $user:$group -m755 "$home_dir" || die + checkpath -d -o $user:$group -m700 "$default_data_dir" || die + checkpath -d -o $user:$group -m700 "$default_work_dir" || die + checkpath -d "$default_script_dir" || die + + if yesno "$create_logs_dir"; then + checkpath -d -o $user:$group -m755 "$default_logs_dir" || die + fi + + if [ -n "$max_fd" ]; then + ulimit -n "$max_fd" && einfo "Max open filedescriptors: $max_fd" + return 0 + fi +} diff --git a/testing/elasticsearch/elasticsearch.pre-install b/testing/elasticsearch/elasticsearch.pre-install new file mode 100644 index 0000000000..042588e5b7 --- /dev/null +++ b/testing/elasticsearch/elasticsearch.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +addgroup elastico +adduser -h /var/lib/elasticsearch -s /sbin/nologin -G elastico \ + -g "added by apk for elasticsearch" -SDH elastico + +exit 0 |