aboutsummaryrefslogtreecommitdiffstats
path: root/community/elasticsearch/APKBUILD
blob: a96fce9989c0ab77e280aa7b1114d4dd900ecdce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=elasticsearch
pkgver=6.4.1
pkgrel=3
pkgdesc="Open Source, Distributed, RESTful Search Engine"
url="https://www.elastic.co/products/elasticsearch"
arch="x86 x86_64 ppc64le"
license="Apache-2.0"
depends="java-jna-native>=4.1 openjdk8-jre bash"
makedepends=""
install="$pkgname.pre-install $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-x-pack:_x_pack"
options="!check" # no test suite
pkgusers="elastico"
pkggroups="elastico"
source="https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$pkgver.tar.gz
	default-config.patch
	$pkgname.initd
	$pkgname.confd
	$pkgname.logrotated
	README.alpine
	busybox-mktemp.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

_default_module=transport-netty4
_modules="
	aggs-matrix-stats
	analysis-common
	ingest-common
	lang-expression
	lang-mustache
	lang-painless
	mapper-extras
	parent-join
	percolator
	rank-eval
	reindex
	repository-url
	tribe
	"

for _mod in $_modules; do
	subpackages="$subpackages $pkgname-$_mod:_${_mod//-/_}"
	eval "_${_mod//-/_}() { _builtin_module $_mod; }"
done

_basedir="/usr/share/java/$pkgname"

package() {
	local destdir="$pkgdir/$_basedir"
	local confdir="$pkgdir/etc/$pkgname"
	local docdir="$pkgdir/usr/share/doc/elasticsearch"
	local heapsize="256m"

	cd "$builddir"
	install -dm755 "$destdir"/lib "$destdir"/modules "$destdir"/bin
	cp -R lib/* "$destdir"/lib

	install -dm755 "$docdir"
	install -dm755 -o elastico -g elastico "$confdir"
	install -m644 -t "$confdir" config/*

	# remove windows files
	find bin -type f -name *.bat -exec rm -f {} \;
	find bin -type f -name *.exe -exec rm -f {} \;

	# ES bin script parses the new jvm.options file
	cp -R bin/* "$destdir"/bin

	# ES does not run without a transport module
	install -dm755 "$destdir/modules/$_default_module"
	install -m644 -t "$destdir/modules/$_default_module" modules/"$_default_module"/*

	# reduce heap sizes
	sed -i \
		-e "s|^-Xms.*|-Xms$heapsize|" \
		-e "s|^-Xmx.*|-Xmx$heapsize|" \
		$confdir/jvm.options

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname

	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname

	install -m644 -D "$srcdir"/$pkgname.logrotated \
		"$pkgdir"/etc/logrotate.d/$pkgname

	install -m644 -D "$srcdir"/README.alpine \
		"$docdir"

	# Enforce plugins directory relocation
	# Passing the "path.plugins" or "es.default.path.plugins" arguments
	# at runtime does not seem to work in v6.4,
	# it generates an exception if "$destdir"/plugins does not exist.
	# The plugins directory will be shared among all ES instances.
	ln -s /var/lib/elasticsearch/_default/plugins "$destdir"/plugins
}

_builtin_module() {
	local name="$1"
	local destdir="$subpkgdir/$_basedir/modules/$name"

	install -dm755 "$destdir"
	install -m644 -t "$destdir" "$builddir"/modules/$name/*
}

_x_pack() {
	install -dm755 "$subpkgdir"/$_basedir/modules
	mv "$builddir"/modules/x-pack* "$subpkgdir"/$_basedir/modules

	# remove module compiled against GLIBC
	rm -rf "$subpkgdir"/$_basedir/modules/x-pack-ml
}

sha512sums="a023a6db5554dee6f10718dfa297aa06a735c7857542c2db80fa5c2b86ff4bf405bb8167578c5b60741ad05ed96a64b54bc71d128a0ff955468b0449588b053c  elasticsearch-6.4.1.tar.gz
dffe445d62e45bcec5ccffc8e140e19ac35613c008a956481521d0b6b74a8899f5a8852c6b45c58fa1c6d8f80466491d9a7b8bdea40c2a2614ba8b46889fd1ac  default-config.patch
24d17bdfad1d4e53a3568c77e14a712ab0cd17144eb95b2bdf659466dbe5cf48d1ac48285c644c0bf1dc7f309012ccb99956fcd5134e6ac85651c94bee8b5add  elasticsearch.initd
2ab1baf1b5c8782f3f371ba221aadd3e841abc62175f0b1ddcfc68d711e2370465124e076f8cc2e549c25a1da9db8c90172b2f410bd6bbe4153f0e831620b6ba  elasticsearch.confd
450879a8ab49c4debac3f8ed484918d48428cabf300b8196db785930a9bc56ce8a153b8d4c91655cfbe9ff50bb978b3c0f87eef99ed36213463f206b68d06590  elasticsearch.logrotated
6de81485cdc059afef58382862e4155482463fde0b604aaa8dbe904c778b841467c4a383a5e54acd09e3436f1fb7be9923e001fb77bd3d7894e113a5e0f4036b  README.alpine
1f9d13bbc42c04c523ef4e9ce734f919ec3d79748d78f288ed3dd725cf7c74e83d66d8b48fbc782b27b1a760096a647cb33773578071710542b19fda18ea0b84  busybox-mktemp.patch"