summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO32
-rw-r--r--PKGBUILD77
-rw-r--r--elasticsearch-sysctl.conf1
-rw-r--r--elasticsearch-tmpfile.conf6
-rw-r--r--elasticsearch-user.conf1
-rw-r--r--elasticsearch.default13
-rw-r--r--elasticsearch.install14
-rw-r--r--elasticsearch.service39
-rw-r--r--elasticsearch@.service39
9 files changed, 222 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..807109a7d5ef
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,32 @@
+pkgbase = elasticsearch2
+ pkgdesc = Distributed RESTful search engine built on top of Lucene
+ pkgver = 2.4.1
+ pkgrel = 1
+ url = https://www.elastic.co/products/elasticsearch
+ install = elasticsearch.install
+ arch = any
+ license = APACHE
+ depends = java-runtime-headless
+ depends = systemd
+ provides = elasticsearch=2.4.1
+ conflicts = elasticsearch
+ backup = etc/elasticsearch/elasticsearch.yml
+ backup = etc/elasticsearch/logging.yml
+ backup = etc/default/elasticsearch
+ source = http://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
+ source = elasticsearch.service
+ source = elasticsearch@.service
+ source = elasticsearch-sysctl.conf
+ source = elasticsearch-user.conf
+ source = elasticsearch-tmpfile.conf
+ source = elasticsearch.default
+ sha256sums = 23a369ef42955c19aaaf9e34891eea3a055ed217d7fbe76da0998a7a54bbe167
+ sha256sums = 339a16452c89d55dba3c693e5979fd331981e79decc5eceb2e9be25670d946d9
+ sha256sums = 5705be6546922d5c0c7aded3b839af25b369ace2af7024ea11e2bce9426ae2f6
+ sha256sums = b3feb1e9c7e7ce6b33cea6c727728ed700332aae942ca475c3bcc1d56b9f113c
+ sha256sums = 815f6a39db6f54bb40750c382ffbdc298d2c4c187ee8ea7e2f855923e2ff354b
+ sha256sums = 6578cacc9fdbdf4713e9f607710701edcd46b026e99743af0fbb63e177eed9b1
+ sha256sums = bb74e5fb8bc28f2125e015395ab05bea117b72bfc6dadbca827694b362ee0bf8
+
+pkgname = elasticsearch2
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..9001eeab950b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,77 @@
+# Maintainer: Atte Lautanala <atte dot lautanala at gmail dot com>
+# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+# Contributor: Marcello "mererghost" Rocha <https://github.com/mereghost>
+# Refactored by Blaž "Speed" Hrastnik <https://github.com/archSeer>
+
+_pkgname=elasticsearch
+pkgname=elasticsearch2
+pkgver=2.4.1
+pkgrel=1
+pkgdesc="Distributed RESTful search engine built on top of Lucene"
+arch=('any')
+url="https://www.elastic.co/products/elasticsearch"
+license=('APACHE')
+depends=('java-runtime-headless' 'systemd')
+conflicts=('elasticsearch')
+provides=("elasticsearch=$pkgver")
+install='elasticsearch.install'
+source=(
+ "http://download.elasticsearch.org/$_pkgname/release/org/$_pkgname/distribution/tar/$_pkgname/$pkgver/$_pkgname-$pkgver.tar.gz"
+ elasticsearch.service
+ elasticsearch@.service
+ elasticsearch-sysctl.conf
+ elasticsearch-user.conf
+ elasticsearch-tmpfile.conf
+ elasticsearch.default
+)
+sha256sums=('23a369ef42955c19aaaf9e34891eea3a055ed217d7fbe76da0998a7a54bbe167'
+ '339a16452c89d55dba3c693e5979fd331981e79decc5eceb2e9be25670d946d9'
+ '5705be6546922d5c0c7aded3b839af25b369ace2af7024ea11e2bce9426ae2f6'
+ 'b3feb1e9c7e7ce6b33cea6c727728ed700332aae942ca475c3bcc1d56b9f113c'
+ '815f6a39db6f54bb40750c382ffbdc298d2c4c187ee8ea7e2f855923e2ff354b'
+ '6578cacc9fdbdf4713e9f607710701edcd46b026e99743af0fbb63e177eed9b1'
+ 'bb74e5fb8bc28f2125e015395ab05bea117b72bfc6dadbca827694b362ee0bf8')
+
+backup=('etc/elasticsearch/elasticsearch.yml'
+ 'etc/elasticsearch/logging.yml'
+ 'etc/default/elasticsearch')
+
+prepare() {
+ cd "$srcdir"/$_pkgname-$pkgver
+
+ for script in plugin elasticsearch; do
+ sed -e 's|^ES_HOME=.*dirname.*|ES_HOME=/usr/share/elasticsearch|' \
+ -e '/^ES_HOME=.*pwd/d' \
+ -e 's|$ES_HOME/config|/etc/elasticsearch|' \
+ -i bin/$script
+ done
+
+ sed -re 's;#\s*(path\.conf:).*$;\1 /etc/elasticsearch;' \
+ -e '0,/#\s*(path\.data:).*$/s;;\1 /var/lib/elasticsearch;' \
+ -e 's;#\s*(path\.work:).*$;\1 /tmp/elasticsearch;' \
+ -e 's;#\s*(path\.logs:).*$;\1 /var/log/elasticsearch;' \
+ -i config/elasticsearch.yml
+}
+
+package() {
+ cd "$pkgdir"
+ install -dm750 etc/elasticsearch/scripts
+ install -dm755 usr/share/elasticsearch/plugins
+ install -dm755 var/lib/elasticsearch
+ install -dm755 var/log/elasticsearch
+
+ install -Dm644 "$srcdir"/elasticsearch.service usr/lib/systemd/system/elasticsearch.service
+ install -Dm644 "$srcdir"/elasticsearch@.service usr/lib/systemd/system/elasticsearch@.service
+ install -Dm644 "$srcdir"/elasticsearch-user.conf usr/lib/sysusers.d/elasticsearch.conf
+ install -Dm644 "$srcdir"/elasticsearch-tmpfile.conf usr/lib/tmpfiles.d/elasticsearch.conf
+ install -Dm644 "$srcdir"/elasticsearch-sysctl.conf usr/lib/sysctl.d/elasticsearch.conf
+ install -Dm644 "$srcdir"/elasticsearch.default etc/default/elasticsearch
+
+ cd "$srcdir"/$_pkgname-$pkgver
+ cp -R lib modules "$pkgdir"/usr/share/elasticsearch/
+ cp config/* "$pkgdir"/etc/elasticsearch/
+
+ install -Dm755 bin/elasticsearch "$pkgdir"/usr/bin/elasticsearch
+ install -Dm755 bin/plugin "$pkgdir"/usr/bin/elasticsearch-plugin
+ install -Dm644 bin/elasticsearch.in.sh "$pkgdir"/usr/share/elasticsearch/bin/elasticsearch.in.sh
+}
diff --git a/elasticsearch-sysctl.conf b/elasticsearch-sysctl.conf
new file mode 100644
index 000000000000..32da2c91cf27
--- /dev/null
+++ b/elasticsearch-sysctl.conf
@@ -0,0 +1 @@
+vm.max_map_count=262144 \ No newline at end of file
diff --git a/elasticsearch-tmpfile.conf b/elasticsearch-tmpfile.conf
new file mode 100644
index 000000000000..7acb4da27d32
--- /dev/null
+++ b/elasticsearch-tmpfile.conf
@@ -0,0 +1,6 @@
+d /var/log/elasticsearch 0755 elasticsearch elasticsearch -
+d /var/lib/elasticsearch 0755 elasticsearch elasticsearch -
+d /usr/share/elasticsearch/plugins 0755 elasticsearch elasticsearch -
+
+d /etc/elasticsearch 0755 - elasticsearch -
+d /etc/elasticsearch/scripts 0750 - elasticsearch -
diff --git a/elasticsearch-user.conf b/elasticsearch-user.conf
new file mode 100644
index 000000000000..d67b6c3fdde1
--- /dev/null
+++ b/elasticsearch-user.conf
@@ -0,0 +1 @@
+u elasticsearch - "Elasticsearch user"
diff --git a/elasticsearch.default b/elasticsearch.default
new file mode 100644
index 000000000000..ade7ae924ddd
--- /dev/null
+++ b/elasticsearch.default
@@ -0,0 +1,13 @@
+JAVA_HOME=/usr/lib/jvm/default-runtime
+
+# Heap Size (defaults to 256m min, 1g max)
+#ES_HEAP_SIZE=1g
+
+# Heap new generation
+#ES_HEAP_NEWSIZE=
+
+# max direct memory
+#ES_DIRECT_SIZE=
+
+# Additional Java OPTS
+#ES_JAVA_OPTS=
diff --git a/elasticsearch.install b/elasticsearch.install
new file mode 100644
index 000000000000..6077726f4f22
--- /dev/null
+++ b/elasticsearch.install
@@ -0,0 +1,14 @@
+post_install() {
+ systemd-sysusers elasticsearch.conf
+ systemd-tmpfiles --create elasticsearch.conf
+}
+
+post_upgrade(){
+ systemd-tmpfiles --create elasticsearch.conf
+
+ if [ "$(vercmp $2 2.0.0)" -lt 0 ]; then
+ echo " >> "
+ echo " >> Major version update. Please take a look at breaking changes https://www.elastic.co/guide/en/elasticsearch/reference/2.0/breaking-changes-2.0.html and remove incompatible plugins from /usr/share/elasticsearch/plugins"
+ echo " >> "
+ fi
+}
diff --git a/elasticsearch.service b/elasticsearch.service
new file mode 100644
index 000000000000..76d6a521ca7e
--- /dev/null
+++ b/elasticsearch.service
@@ -0,0 +1,39 @@
+[Unit]
+Description=Elasticsearch
+Documentation=http://www.elastic.co
+Wants=network.target
+After=network.target
+
+[Service]
+Type=forking
+RuntimeDirectory=elasticsearch
+PIDFile=/run/elasticsearch/elasticsearch.pid
+
+Environment=JAVA_HOME=/usr/lib/jvm/default-runtime
+Environment=ES_HOME=/usr/share/elasticsearch
+Environment=CONF_DIR=/etc/elasticsearch
+Environment=DATA_DIR=/var/lib/elasticsearch
+Environment=LOG_DIR=/var/log/elasticsearch
+EnvironmentFile=-/etc/default/elasticsearch
+
+WorkingDirectory=/usr/share/elasticsearch
+
+User=elasticsearch
+Group=elasticsearch
+
+ExecStart=/usr/bin/elasticsearch -d \
+ -p /run/elasticsearch/elasticsearch.pid \
+ -Des.default.path.home=${ES_HOME} \
+ -Des.default.path.logs=${LOG_DIR} \
+ -Des.default.path.data=${DATA_DIR} \
+ -Des.default.path.conf=${CONF_DIR}
+
+SuccessExitStatus=143
+
+LimitNOFILE=65535
+LimitMEMLOCK=infinity
+TimeoutStopSec=120
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/elasticsearch@.service b/elasticsearch@.service
new file mode 100644
index 000000000000..a51a5454a02d
--- /dev/null
+++ b/elasticsearch@.service
@@ -0,0 +1,39 @@
+[Unit]
+Description=Elasticsearch
+Documentation=http://www.elastic.co
+Wants=network.target
+After=network.target
+
+[Service]
+Type=forking
+RuntimeDirectory=elasticsearch
+PIDFile=/run/elasticsearch/%I.pid
+
+Environment=JAVA_HOME=/usr/lib/jvm/default-runtime
+Environment=ES_HOME=/usr/share/elasticsearch
+Environment=CONF_DIR=/etc/elasticsearch/%I
+Environment=DATA_DIR=/var/lib/elasticsearch/%I
+Environment=LOG_DIR=/var/log/elasticsearch
+EnvironmentFile=-/etc/default/elasticsearch
+
+WorkingDirectory=/usr/share/elasticsearch
+
+User=elasticsearch
+Group=elasticsearch
+
+ExecStart=/usr/bin/elasticsearch -d \
+ -p /run/elasticsearch/%I.pid \
+ -Des.default.path.home=${ES_HOME} \
+ -Des.default.path.logs=${LOG_DIR} \
+ -Des.default.path.data=${DATA_DIR} \
+ -Des.default.path.conf=${CONF_DIR}
+
+SuccessExitStatus=143
+
+LimitNOFILE=65535
+LimitMEMLOCK=infinity
+TimeoutStopSec=120
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target