[elasticsearch/f22] Initial push

jiri vanek jvanek at fedoraproject.org
Tue Feb 24 09:38:56 UTC 2015


commit 7f97f3639c880023405411fe0272b44fbbe86cd7
Author: Jiri Vanek <jvanek at redhat.com>
Date:   Tue Feb 24 10:38:47 2015 +0100

    Initial push

 .gitignore                                     |   1 +
 elasticsearch-1.3.2-remove-sigar-service.patch |  47 ++++++
 elasticsearch.in                               |  81 ++++++++++
 elasticsearch.service.in                       |  22 +++
 elasticsearch.spec                             | 211 +++++++++++++++++++++++++
 localhostByDefault.patch                       |  18 +++
 netty-version.patch                            |  12 ++
 repack.sh                                      |  18 +++
 sources                                        |   1 +
 unbundleBase64.patch                           |  43 +++++
 10 files changed, 454 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index e69de29..21e2467 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/elasticsearch-1.4.4-fedora.tar.xz
diff --git a/elasticsearch-1.3.2-remove-sigar-service.patch b/elasticsearch-1.3.2-remove-sigar-service.patch
new file mode 100644
index 0000000..885e343
--- /dev/null
+++ b/elasticsearch-1.3.2-remove-sigar-service.patch
@@ -0,0 +1,47 @@
+--- src/main/java/org/elasticsearch/monitor/MonitorModule.java	2014-08-13 16:27:50.000000000 +0200
++++ src/main/java/org/elasticsearch/monitor/MonitorModule.java-gil	2014-09-06 20:17:45.009937288 +0200
+@@ -28,22 +28,17 @@
+ import org.elasticsearch.monitor.fs.FsProbe;
+ import org.elasticsearch.monitor.fs.FsService;
+ import org.elasticsearch.monitor.fs.JmxFsProbe;
+-import org.elasticsearch.monitor.fs.SigarFsProbe;
+ import org.elasticsearch.monitor.jvm.JvmMonitorService;
+ import org.elasticsearch.monitor.jvm.JvmService;
+ import org.elasticsearch.monitor.network.JmxNetworkProbe;
+ import org.elasticsearch.monitor.network.NetworkProbe;
+ import org.elasticsearch.monitor.network.NetworkService;
+-import org.elasticsearch.monitor.network.SigarNetworkProbe;
+ import org.elasticsearch.monitor.os.JmxOsProbe;
+ import org.elasticsearch.monitor.os.OsProbe;
+ import org.elasticsearch.monitor.os.OsService;
+-import org.elasticsearch.monitor.os.SigarOsProbe;
+ import org.elasticsearch.monitor.process.JmxProcessProbe;
+ import org.elasticsearch.monitor.process.ProcessProbe;
+ import org.elasticsearch.monitor.process.ProcessService;
+-import org.elasticsearch.monitor.process.SigarProcessProbe;
+-import org.elasticsearch.monitor.sigar.SigarService;
+ 
+ import java.util.Map;
+ 
+@@ -65,21 +60,6 @@
+     @Override
+     protected void configure() {
+         boolean sigarLoaded = false;
+-        try {
+-            settings.getClassLoader().loadClass("org.hyperic.sigar.Sigar");
+-            SigarService sigarService = new SigarService(settings);
+-            if (sigarService.sigarAvailable()) {
+-                bind(SigarService.class).toInstance(sigarService);
+-                bind(ProcessProbe.class).to(SigarProcessProbe.class).asEagerSingleton();
+-                bind(OsProbe.class).to(SigarOsProbe.class).asEagerSingleton();
+-                bind(NetworkProbe.class).to(SigarNetworkProbe.class).asEagerSingleton();
+-                bind(FsProbe.class).to(SigarFsProbe.class).asEagerSingleton();
+-                sigarLoaded = true;
+-            }
+-        } catch (Throwable e) {
+-            // no sigar
+-            Loggers.getLogger(SigarService.class).trace("failed to load sigar", e);
+-        }
+         if (!sigarLoaded) {
+             // bind non sigar implementations
+             bind(ProcessProbe.class).to(JmxProcessProbe.class).asEagerSingleton();
diff --git a/elasticsearch.in b/elasticsearch.in
new file mode 100644
index 0000000..c8048c9
--- /dev/null
+++ b/elasticsearch.in
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+# elasticsearch script
+# JPackage Project <http://www.jpackage.org/>
+
+# Source functions library
+_prefer_jre="true"
+. /usr/share/java-utils/java-functions
+
+# Source system prefs
+if [ -f /etc/java/elasticsearch.conf ] ; then
+  . /etc/java/elasticsearch.conf
+fi
+
+# Source user prefs
+if [ -f $HOME/.elasticsearchrc ] ; then
+  . $HOME/.elasticsearchrc
+fi
+
+ES=@NAME@
+VLIB=@VLIB@
+if [ `whoami` = "$ES" ] ; then
+  BASE=$VLIB/$ES
+else
+  BASE=$XDG_CONFIG_HOME
+  if  [ "$BASE" = "" ] ; then 
+    BASE=$HOME/.config/$ES
+  else
+   BASE=$BASE/$ES
+  fi
+fi
+
+
+
+ES_HOME=$BASE
+LOG_DIR=$BASE/logs
+DATA_DIR=$BASE/data
+WORK_DIR=$BASE/work
+CONF_DIR=$BASE/conf
+CONF_FILE=$CONF_DIR/$ES.yml
+LOG_CONF_FILE=$CONF_DIR/logging.yml
+
+mkdir -p $BASE
+mkdir -p $LOG_DIR
+mkdir -p $DATA_DIR
+mkdir -p $WORK_DIR
+mkdir -p $CONF_DIR
+
+# copy base config files if not already created
+if [ ! `whoami` = "$ES" ] ; then
+  if [ ! -f $CONF_FILE ] ; then
+    cp $VLIB/$ES/conf/$ES.yml $CONF_FILE
+  fi
+  if [ ! -f $LOG_CONF_FILE ] ; then
+    cp $VLIB/$ES/conf/logging.yml $LOG_CONF_FILE
+  fi
+fi
+
+# Configuration
+MAIN_CLASS=org.elasticsearch.bootstrap.Elasticsearch
+if [ -f $CONF_FILE ] ; then 
+  FLAGS="-Des.default.config=$CONF_FILE "
+else
+  FLAGS=""
+fi
+FLAGS=$FLAGS" -Des.default.path.home=$ES_HOME -Des.default.path.logs=$LOG_DIR -Des.default.path.data=$DATA_DIR -Des.default.path.work=$WORK_DIR -Des.default.path.conf=$CONF_DIR"
+
+BASE_OPTIONS=""
+BASE_JARS="@NAME@ netty3-3.9.3 lucene-sandbox hppc jackson-core jackson-dataformat-cbor jackson-dataformat-smile jackson-dataformat-yaml snakeyaml guava compress-lzf t-digest commons-cli joda-time antlr3-runtime apache-commons-lang3 lucene-core lucene-highlighter lucene-join lucene-memory lucene-queries lucene-queryparser lucene-spatial lucene-suggest joda-convert java-base64"
+
+# Set parameters
+set_jvm
+set_classpath $BASE_JARS
+#not working, using FLAGS directly rather
+#set_flags $BASE_FLAGS
+#same here, but it is currently unused
+#set_options $BASE_OPTIONS
+
+
+# Let's start
+run  "$@"
diff --git a/elasticsearch.service.in b/elasticsearch.service.in
new file mode 100644
index 0000000..135f0ad
--- /dev/null
+++ b/elasticsearch.service.in
@@ -0,0 +1,22 @@
+[Unit]
+Description=ElasticSearch search engine
+Documentation=https://www.elasticsearch.org/guide/en/elasticsearch/guide/current/index.html
+
+[Service]
+# ExecStart=/usr/libexec/elasticsearch
+ExecStart=@LAUNCHER@
+ProtectHome=yes
+ProtectSystem=yes
+SuccessExitStatus=143
+# See MAX_OPEN_FILES in sysconfig
+LimitNOFILE=65535
+# See MAX_LOCKED_MEMORY in sysconfig, use "infinity" when MAX_LOCKED_MEMORY=unlimited and using bootstrap.mlockall: true
+#LimitMEMLOCK=infinity
+# Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)
+TimeoutStopSec=20
+User=@USER@
+Group=@USER@
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/elasticsearch.spec b/elasticsearch.spec
new file mode 100644
index 0000000..66dc1d3
--- /dev/null
+++ b/elasticsearch.spec
@@ -0,0 +1,211 @@
+#%%global reltag .Beta1
+%global namedversion %{version}%{?reltag}
+%global _docdir_fmt %{name}
+
+Name:          elasticsearch
+Version:       1.4.4
+Release:       0%{?reltag}%{?dist}
+Summary:       Open source, flexible, distributed search and analytics engine
+License:       ASL 2.0
+URL:           http://www.elasticsearch.org/
+# wget https://github.com/elasticsearch/elasticsearch/archive/v1.4.4.tar.gz
+# repacked by repack.sh 
+Source0:       %{name}-%{namedversion}-fedora.tar.xz
+Source1:       repack.sh
+Source2:       %{name}.service.in
+Source3:       %{name}.in
+Patch0:        %{name}-1.3.2-remove-sigar-service.patch
+Patch1:        unbundleBase64.patch
+Patch2:        localhostByDefault.patch
+#Patch3:        netty-version.patch
+
+
+BuildRequires: netty3
+BuildRequires: java-base64 >= 2.3.8-7
+BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
+BuildRequires: mvn(com.carrotsearch:hppc)
+BuildRequires: mvn(com.fasterxml.jackson.core:jackson-core)
+BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-cbor)
+BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-smile)
+BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-yaml)
+BuildRequires: mvn(com.github.spullara.mustache.java:compiler)
+BuildRequires: mvn(com.google.guava:guava)
+BuildRequires: mvn(com.ning:compress-lzf)
+BuildRequires: mvn(com.spatial4j:spatial4j)
+BuildRequires: mvn(com.tdunning:t-digest)
+BuildRequires: mvn(com.vividsolutions:jts)
+BuildRequires: mvn(joda-time:joda-time)
+BuildRequires: mvn(net.java.dev.jna:jna)
+BuildRequires: mvn(org.antlr:antlr-runtime)
+BuildRequires: mvn(org.codehaus.groovy:groovy)
+BuildRequires: mvn(org.joda:joda-convert)
+BuildRequires: mvn(org.mvel:mvel2)
+BuildRequires: mvn(org.slf4j:slf4j-api)
+BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
+BuildRequires: mvn(log4j:log4j:1.2.17)
+BuildRequires: mvn(org.apache.lucene:lucene-analyzers-common)
+BuildRequires: mvn(org.apache.lucene:lucene-codecs)
+BuildRequires: mvn(org.apache.lucene:lucene-core)
+BuildRequires: mvn(org.apache.lucene:lucene-expressions)
+BuildRequires: mvn(org.apache.lucene:lucene-highlighter)
+BuildRequires: mvn(org.apache.lucene:lucene-join)
+BuildRequires: mvn(org.apache.lucene:lucene-memory)
+BuildRequires: mvn(org.apache.lucene:lucene-queries)
+BuildRequires: mvn(org.apache.lucene:lucene-queryparser)
+BuildRequires: mvn(org.apache.lucene:lucene-spatial)
+BuildRequires: mvn(org.apache.lucene:lucene-suggest)
+
+%if 0
+# Test deps
+BuildRequires: mvn(com.carrotsearch.randomizedtesting:junit4-maven-plugin)
+BuildRequires: mvn(com.carrotsearch.randomizedtesting:junit4-ant)
+BuildRequires: mvn(com.carrotsearch.randomizedtesting:randomizedtesting-runner)
+BuildRequires: mvn(de.thetaphi:forbiddenapis)
+BuildRequires: mvn(org.hamcrest:hamcrest-all)
+BuildRequires: mvn(org.apache.lucene:lucene-test-framework)
+BuildRequires: mvn(org.apache.httpcomponents:httpclient)
+%endif
+
+BuildRequires: maven-local
+#service build
+BuildRequires: systemd
+# not added by autogenerated stuff
+Requires: lucene-sandbox
+Requires: snakeyaml
+# xmvn do not set up versions
+Requires: java-base64 >= 2.3.8-7
+# service setup
+Requires(post):   systemd
+Requires(preun):  systemd
+Requires(postun): systemd
+# user and group creation
+Requires(pre): shadow-utils
+
+BuildArch:     noarch
+
+%description
+Elasticsearch is a search server based on Lucene. It provides a distributed, 
+multitenant-capable full-text search engine with a RESTful web interface and 
+schema-free JSON documents. Elasticsearch is developed in Java and is released 
+as open source under the terms of the Apache License.
+
+It is a flexible and powerful open source, distributed, real-time 
+search and analytics engine. 
+
+Architected from the ground up for use in distributed environments where 
+reliability and scalability are must haves, Elasticsearch gives you the ability 
+to move easily beyond simple full-text search. 
+
+Through its robust set of APIs and query DSLs, plus clients for the most popular 
+programming languages, Elasticsearch delivers on the near limitless promises of 
+search technology.
+
+%package javadoc
+Summary:       Javadoc for %{name}
+
+%description javadoc
+This package contains javadoc for %{name}.
+
+%prep
+%autosetup -n elasticsearch-%{namedversion} -p0
+# Cleanup
+find . -name "*.class" -print -delete
+find . -name "*.jar" -print -delete
+find . -name "*.bat" -print -delete
+find . -name "*.exe" -print -delete
+# Unused/unavailable plugins
+%pom_remove_plugin de.thetaphi:forbiddenapis
+%pom_remove_plugin com.mycila:license-maven-plugin
+%pom_remove_plugin org.vafer:jdeb
+%pom_remove_plugin :maven-shade-plugin
+%pom_remove_plugin :maven-source-plugin
+%pom_remove_plugin :rpm-maven-plugin
+%pom_remove_plugin com.carrotsearch.randomizedtesting:junit4-maven-plugin
+%pom_remove_plugin :buildnumber-maven-plugin
+%pom_remove_plugin :maven-dependency-plugin
+%pom_remove_plugin :maven-assembly-plugin
+#%%pom_add_dep com.carrotsearch.randomizedtesting:junit4-ant::test
+%pom_add_dep net.iharder:base64
+
+# Disable test task
+%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-antrun-plugin']/pom:executions/pom:execution[pom:id = 'tests']"
+
+# package org.antlr.runtime.tree does not exist
+%pom_add_dep org.antlr:antlr-runtime
+
+%pom_remove_dep org.fusesource:sigar
+rm -rfv src/main/java/org/elasticsearch/monitor/sigar \
+ src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java \
+ src/main/java/org/elasticsearch/monitor/network/SigarNetworkProbe.java \
+ src/main/java/org/elasticsearch/monitor/os/SigarOsProbe.java \
+ src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java
+
+#removal of bundled class
+rm -vf src/main/java/org/elasticsearch/common/Base64.java
+
+%build
+%mvn_file : %{name}
+%mvn_build -f
+
+
+%install
+%mvn_install
+# the target/bin/elasticsearch.in.sh is not packed, as it do not honor packaging guidelines
+# proper mixture of it and rpm based launcher will be subject of further work
+# todo, discover origin of elasticsearch launcher script, does not seems to be based on in file
+# the in file seems to be only strangely included
+mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}/
+cat %{SOURCE2} | sed  "s;@LAUNCHER@;%{_libexecdir}/%{name};g" | sed  "s;@USER@;%{name};g"  > $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
+# because of bugs in set_flags/options and custom code, using .in file instead of %%jpackage_script 
+cat %{SOURCE3} | sed "s;@NAME@;%{name};g" | sed "s;@VLIB@;%{_sharedstatedir};g" >$RPM_BUILD_ROOT/%{_libexecdir}/%{name}
+chmod 755 $RPM_BUILD_ROOT/%{_libexecdir}/%{name}
+# setup config templates target dirs
+mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
+# setup config files in /etc/elasticsearch
+cp config/%{name}.yml $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
+cp config/logging.yml $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
+# they are 755 by defualt in sources
+chmod 644 $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/*.yml
+# link them to ES home
+ln -s %{_sysconfdir}/%{name}/%{name}.yml $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/
+ln -s %{_sysconfdir}/%{name}/logging.yml  $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/
+
+
+%pre
+# add the elasticsearch user and group
+getent group  %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
+getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s %{_sbindir}/nologin \
+    -c "Elastic Search shared service user" elasticsearch
+exit 0
+
+%post
+# install but don't activate
+%systemd_post %{name}.service
+
+
+%preun
+%systemd_preun %{name}.service
+
+
+%postun
+%systemd_postun_with_restart %{name}.service 
+# %%systemd_postun %%{name}.service 
+
+%files -f .mfiles
+%license LICENSE.txt NOTICE.txt
+%doc README.textile CONTRIBUTING.md TESTING.asciidoc
+%{_libexecdir}/%{name}
+%{_sysconfdir}/%{name}
+%{_unitdir}/%{name}.service
+%attr(755, %{name}, %{name}) %{_sharedstatedir}/%{name}
+%config(noreplace) %{_sharedstatedir}/%{name}/conf/%{name}.yml
+%config(noreplace) %{_sharedstatedir}/%{name}/conf/logging.yml
+
+%files javadoc -f .mfiles-javadoc
+%license LICENSE.txt NOTICE.txt
+
+%changelog
+* Mon Feb 16 2015 Jiri Vanek <jvanek at redhat.com> - 1.4.4-0
+- initial build
diff --git a/localhostByDefault.patch b/localhostByDefault.patch
new file mode 100644
index 0000000..a8f3d3d
--- /dev/null
+++ b/localhostByDefault.patch
@@ -0,0 +1,18 @@
+--- config/elasticsearch.yml
++++ config/elasticsearch (copy).yml
+@@ -211,6 +211,14 @@
+ #
+ #network.host: 192.168.0.1
+ 
++# use only localhost by default
++network.host: "127.0.0.1"
++
++# If you want only http transport to listen on localhost
++# comment out 'network.host: "127.0.0.1"' anduncomment the following line instead.
++#http.host: "127.0.0.1"
++
++
+ # Set a custom port for the node to node communication (9300 by default):
+ #
+ #transport.tcp.port: 9300
+
diff --git a/netty-version.patch b/netty-version.patch
new file mode 100644
index 0000000..bce2b60
--- /dev/null
+++ b/netty-version.patch
@@ -0,0 +1,12 @@
+--- pom.xml
++++ pom.xml
+@@ -253,7 +253,7 @@
+         <dependency>
+             <groupId>io.netty</groupId>
+             <artifactId>netty</artifactId>
+-            <version>3.9.3.Final</version>
++            <version>3</version>
+             <scope>compile</scope>
+         </dependency>
+ 
+
diff --git a/repack.sh b/repack.sh
new file mode 100644
index 0000000..7a2fd43
--- /dev/null
+++ b/repack.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+NAME=$1
+FNAME=$NAME.tar.gz
+
+if [ -e $NAME ]  ; then
+ echo  "$NAME exists. Remove it in orderto continue"
+ exit -1
+fi
+tar -xf $FNAME
+pushd $NAME
+rm -rf .git
+pushd bin
+rm elasticsearch elasticsearch.bat elasticsearch-service-mgr.exe elasticsearch-service-x64.exe elasticsearch-service-x86.exe plugin plugin.bat service.bat
+popd;
+rm -rf lib
+popd;
+tar -cJf $NAME-fedora.tar.xz $NAME
+rm -rf $NAME 
diff --git a/sources b/sources
index e69de29..ad7a5be 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1cc49714e5f2fda874e76f75fea810e7  elasticsearch-1.4.4-fedora.tar.xz
diff --git a/unbundleBase64.patch b/unbundleBase64.patch
new file mode 100644
index 0000000..23ba341
--- /dev/null
+++ b/unbundleBase64.patch
@@ -0,0 +1,43 @@
+--- src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java
++++ src/main/java/org/elasticsearch/action/search/type/TransportSearchHelper.java
+@@ -29,7 +29,7 @@
+ import org.elasticsearch.action.search.SearchScrollRequest;
+ import org.elasticsearch.action.search.SearchType;
+ import org.elasticsearch.cluster.routing.ShardRouting;
+-import org.elasticsearch.common.Base64;
++import net.iharder.Base64;
+ import org.elasticsearch.common.Nullable;
+ import org.elasticsearch.common.Strings;
+ import org.elasticsearch.common.collect.Tuple;
+--- src/main/java/org/elasticsearch/common/RandomBasedUUIDGenerator.java
++++ src/main/java/org/elasticsearch/common/RandomBasedUUIDGenerator.java
+@@ -23,6 +23,7 @@
+ 
+ import java.io.IOException;
+ import java.util.Random;
++import net.iharder.Base64;
+ 
+ class RandomBasedUUIDGenerator implements UUIDGenerator {
+ 
+--- src/main/java/org/elasticsearch/common/TimeBasedUUIDGenerator.java
++++ src/main/java/org/elasticsearch/common/TimeBasedUUIDGenerator.java
+@@ -25,6 +25,7 @@
+ import java.util.Random;
+ import java.util.concurrent.atomic.AtomicInteger;
+ import java.util.concurrent.atomic.AtomicLong;
++import net.iharder.Base64;
+ 
+ /** These are essentially flake ids (http://boundary.com/blog/2012/01/12/flake-a-decentralized-k-ordered-unique-id-generator-in-erlang) but
+  *  we use 6 (not 8) bytes for timestamp, and use 3 (not 2) bytes for sequence number. */
+--- src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java
++++ src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java
+@@ -27,7 +27,7 @@
+ import org.apache.lucene.util.BytesRef;
+ import org.elasticsearch.ElasticsearchException;
+ import org.elasticsearch.ElasticsearchParseException;
+-import org.elasticsearch.common.Base64;
++import net.iharder.Base64;
+ import org.elasticsearch.common.Nullable;
+ import org.elasticsearch.common.Strings;
+ import org.elasticsearch.common.bytes.BytesArray;
+


More information about the scm-commits mailing list