diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-05-18 14:55:53 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-05-18 13:08:51 +0000 |
commit | 60af0bb8bcf546079e767783ad5d9213716c59d2 (patch) | |
tree | 7c9c8f3f8c90c1249e49f977973dd57d14d3882f /community/elasticsearch | |
parent | 6eb97007e515e2b07e28406a186d653d1666392a (diff) | |
download | aports-60af0bb8bcf546079e767783ad5d9213716c59d2.tar.bz2 aports-60af0bb8bcf546079e767783ad5d9213716c59d2.tar.xz |
testing/elasticsearch: move to community repo
Diffstat (limited to 'community/elasticsearch')
-rw-r--r-- | community/elasticsearch/APKBUILD | 69 | ||||
-rw-r--r-- | community/elasticsearch/elasticsearch.confd | 59 | ||||
-rw-r--r-- | community/elasticsearch/elasticsearch.initd | 86 | ||||
-rw-r--r-- | community/elasticsearch/elasticsearch.pre-install | 7 |
4 files changed, 221 insertions, 0 deletions
diff --git a/community/elasticsearch/APKBUILD b/community/elasticsearch/APKBUILD new file mode 100644 index 0000000000..b43fd77d19 --- /dev/null +++ b/community/elasticsearch/APKBUILD @@ -0,0 +1,69 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +pkgname=elasticsearch +pkgver=2.3.2 +pkgrel=0 +pkgdesc="Open Source, Distributed, RESTful Search Engine" +url="https://www.elastic.co/products/elasticsearch" +arch="x86 x86_64" +license="ASL-2.0" +depends="java-jna-native>=4.1 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 + " +builddir="$srcdir/$pkgname-$pkgver" + +_modules="lang-expression lang-groovy reindex" +for _mod in $_modules; do + subpackages="$subpackages $pkgname-$_mod:_${_mod//-/_}" + eval "_${_mod//-/_}() { _builtin_module $_mod; }" +done + +_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 -m755 -D $pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname || return 1 + + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname +} + +_builtin_module() { + local name="$1" + local destdir="$subpkgdir/$_basedir/modules/$name" + + install -dm755 "$destdir" + install -m644 -t "$destdir" "$builddir"/modules/$name/* +} + +md5sums="c4a5c36ff5c602f537c06d02dc5d803a elasticsearch-2.3.2.tar.gz +8588526df39a4d7fab06cf885edec731 elasticsearch.initd +11ca8100933039b8433eac9342e9e326 elasticsearch.confd" +sha256sums="04c4d3913d496d217e038da88df939108369ae2e78eea29cb1adf1c4ab3a000a elasticsearch-2.3.2.tar.gz +b4cacc84afac4f4d51cad888b0dca034a91e3aed96543d43126a86fa7c3f2bb6 elasticsearch.initd +356989a74e111a50862712f877da1078ffbc77a4a2735090e2aa87bfa9cbf1e0 elasticsearch.confd" +sha512sums="73c4ca82eb0f4dc22907a94b9025e79183f6fcd38dbb82795800d10fc810dbee412784e62f9247390f0fb9aa19545976584bd2b62f1afe79d2cd64bb55f76dc8 elasticsearch-2.3.2.tar.gz +9fe933d6b1b53a02514d34377e6362d176148da3297edbea5902a1c4aff9762aa9c9cb00f053c9aec42db8dea22f722f8a3e16f5ed5b32f5b975e0b311a5e6ff elasticsearch.initd +e1e4b31f8bac2e79118e7bf9b25ca8a31eefa6fb00d35c57ccf2db718236a3255d5cbfe429009a98c6f4a8ded19d291e97e5a4d9c44fa044ed6f9961792f5d62 elasticsearch.confd" diff --git a/community/elasticsearch/elasticsearch.confd b/community/elasticsearch/elasticsearch.confd new file mode 100644 index 0000000000..d0852f42e9 --- /dev/null +++ b/community/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/community/elasticsearch/elasticsearch.initd b/community/elasticsearch/elasticsearch.initd new file mode 100644 index 0000000000..91dd6809be --- /dev/null +++ b/community/elasticsearch/elasticsearch.initd @@ -0,0 +1,86 @@ +#!/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() { + local dir + + # Note: checkpath doesn't create intermediate directories. + for dir in "$home_dir" "$default_data_dir" "$default_work_dir" "$default_script_dir"; do + mkdir -p "$(dirname "$dir")" + done + + checkpath -d -o $user:$group -m755 "$home_dir" + checkpath -d -o $user:$group -m700 "$default_data_dir" + checkpath -d -o $user:$group -m700 "$default_work_dir" + checkpath -d "$default_script_dir" + + if yesno "$create_logs_dir"; then + mkdir -p "$default_logs_dir" + checkpath -d -o $user:$group -m755 "$default_logs_dir" + fi + + if [ -n "$max_fd" ]; then + ulimit -n "$max_fd" && einfo "Max open filedescriptors: $max_fd" + return 0 + fi +} diff --git a/community/elasticsearch/elasticsearch.pre-install b/community/elasticsearch/elasticsearch.pre-install new file mode 100644 index 0000000000..fe4845bec9 --- /dev/null +++ b/community/elasticsearch/elasticsearch.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +addgroup -S elastico 2>/dev/null +adduser -SDH -h /var/lib/elasticsearch -s /sbin/nologin -G elastico \ + -g "added by apk for elasticsearch" elastico 2>/dev/null + +exit 0 |