elasticsearch2: init at 2.2.0
changes by @globin: * updated 2.1.0 to 2.2.0 * moved to a new derivation closes #11446 Signed-off-by: Robin Gloster <mail@glob.in>
This commit is contained in:
parent
c2b578386e
commit
4bc9e8a785
|
@ -9,6 +9,8 @@ let
|
|||
network.host: ${cfg.listenAddress}
|
||||
network.port: ${toString cfg.port}
|
||||
network.tcp.port: ${toString cfg.tcp_port}
|
||||
# TODO: find a way to enable security manager
|
||||
security.manager.enabled: false
|
||||
cluster.name: ${cfg.cluster_name}
|
||||
${cfg.extraConf}
|
||||
'';
|
||||
|
@ -39,8 +41,8 @@ in {
|
|||
|
||||
package = mkOption {
|
||||
description = "Elasticsearch package to use.";
|
||||
default = pkgs.elasticsearch;
|
||||
defaultText = "pkgs.elasticsearch";
|
||||
default = pkgs.elasticsearch2;
|
||||
defaultText = "pkgs.elasticsearch2";
|
||||
type = types.package;
|
||||
};
|
||||
|
||||
|
@ -129,7 +131,9 @@ in {
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network-interfaces.target" ];
|
||||
path = [ pkgs.inetutils ];
|
||||
environment = { ES_HOME = cfg.dataDir; };
|
||||
environment = {
|
||||
ES_HOME = cfg.dataDir;
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.package}/bin/elasticsearch -Des.path.conf=${configDir} ${toString cfg.extraCmdLineOptions}";
|
||||
User = "elasticsearch";
|
||||
|
@ -137,10 +141,11 @@ in {
|
|||
};
|
||||
preStart = ''
|
||||
mkdir -m 0700 -p ${cfg.dataDir}
|
||||
if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
|
||||
|
||||
# Install plugins
|
||||
ln -sfT ${esPlugins}/plugins ${cfg.dataDir}/plugins
|
||||
ln -sfT ${cfg.package}/lib ${cfg.dataDir}/lib
|
||||
if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
|
||||
'';
|
||||
postStart = mkBefore ''
|
||||
until ${pkgs.curl}/bin/curl -s -o /dev/null ${cfg.listenAddress}:${toString cfg.port}; do
|
||||
|
|
41
pkgs/servers/search/elasticsearch/2.x.nix
Normal file
41
pkgs/servers/search/elasticsearch/2.x.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ stdenv, fetchurl, makeWrapper, jre, utillinux, getopt }:
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "2.2.0";
|
||||
name = "elasticsearch-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${version}/${name}.tar.gz";
|
||||
sha256 = "0c2d0mpcr8lpvifvgp2pfj7avdi7fa8a5vib0gqdap7mw60wqw7d";
|
||||
};
|
||||
|
||||
patches = [ ./es-home-2.x.patch ];
|
||||
|
||||
buildInputs = [ makeWrapper jre ] ++
|
||||
(if (!stdenv.isDarwin) then [utillinux] else [getopt]);
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -R bin config lib $out
|
||||
|
||||
# don't want to have binary with name plugin
|
||||
mv $out/bin/plugin $out/bin/elasticsearch-plugin
|
||||
wrapProgram $out/bin/elasticsearch ${if (!stdenv.isDarwin)
|
||||
then ''--prefix PATH : "${utillinux}/bin/"''
|
||||
else ''--prefix PATH : "${getopt}/bin"''} \
|
||||
--set JAVA_HOME "${jre}"
|
||||
wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre}"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Open Source, Distributed, RESTful Search Engine";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.unix;
|
||||
maintainers = [
|
||||
maintainers.offline
|
||||
maintainers.markWot
|
||||
];
|
||||
};
|
||||
}
|
31
pkgs/servers/search/elasticsearch/es-home-2.x.patch
Normal file
31
pkgs/servers/search/elasticsearch/es-home-2.x.patch
Normal file
|
@ -0,0 +1,31 @@
|
|||
diff -rupN a/bin/elasticsearch b/bin/elasticsearch
|
||||
--- a/bin/elasticsearch 2015-11-18 21:48:18.000000000 +0100
|
||||
+++ b/bin/elasticsearch 2015-12-04 00:52:21.032475098 +0100
|
||||
@@ -72,7 +72,11 @@ while [ -h "$SCRIPT" ] ; do
|
||||
done
|
||||
|
||||
# determine elasticsearch home
|
||||
-ES_HOME=`dirname "$SCRIPT"`/..
|
||||
+
|
||||
+if [ -z "$ES_HOME" ]; then
|
||||
+ echo "You must set the ES_HOME var" >&2
|
||||
+ exit 1
|
||||
+fi
|
||||
|
||||
# make ELASTICSEARCH_HOME absolute
|
||||
ES_HOME=`cd "$ES_HOME"; pwd`
|
||||
diff -rupN a/bin/plugin b/bin/plugin
|
||||
--- a/bin/plugin 2015-11-18 21:48:18.000000000 +0100
|
||||
+++ b/bin/plugin 2015-12-04 00:52:55.947453619 +0100
|
||||
@@ -17,7 +17,10 @@ while [ -h "$SCRIPT" ] ; do
|
||||
done
|
||||
|
||||
# determine elasticsearch home
|
||||
-ES_HOME=`dirname "$SCRIPT"`/..
|
||||
+if [ -z "$ES_HOME" ]; then
|
||||
+ echo "You must set the ES_HOME var" >&2
|
||||
+ exit 1
|
||||
+fi
|
||||
|
||||
# make ELASTICSEARCH_HOME absolute
|
||||
ES_HOME=`cd "$ES_HOME"; pwd`
|
|
@ -1437,6 +1437,7 @@ let
|
|||
evemu = callPackage ../tools/system/evemu { };
|
||||
|
||||
elasticsearch = callPackage ../servers/search/elasticsearch { };
|
||||
elasticsearch2 = callPackage ../servers/search/elasticsearch/2.x.nix { };
|
||||
|
||||
elasticsearchPlugins = recurseIntoAttrs (
|
||||
callPackage ../servers/search/elasticsearch/plugins.nix { }
|
||||
|
|
Loading…
Reference in a new issue