git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commit4bc9e8a785b9e8754ca533f64df30a040b195d30 authorMarkus Wotringer <markus@wotringer.de> dateFri 4 Dec 2015, 01:12 (11 years ago) parentc2b5783
4 files changed+82−4
nixos/modules/services/search/elasticsearch.nix+9−4 pkgs/servers/search/elasticsearch/2.x.nix+41 pkgs/servers/search/elasticsearch/es-home-2.x.patch+31 pkgs/top-level/all-packages.nix+1
nixos/modules/services/search/elasticsearch.nix+9−4
@@ -9,6 +9,8 @@ let
99 network.host: ${cfg.listenAddress}
1010 network.port: ${toString cfg.port}
1111 network.tcp.port: ${toString cfg.tcp_port}
12+ # TODO: find a way to enable security manager
13+ security.manager.enabled: false
1214 cluster.name: ${cfg.cluster_name}
1315 ${cfg.extraConf}
1416 '';
@@ -39,8 +41,8 @@ in {
3941
4042 package = mkOption {
4143 description = "Elasticsearch package to use.";
42− default = pkgs.elasticsearch;
43− defaultText = "pkgs.elasticsearch";
44+ default = pkgs.elasticsearch2;
45+ defaultText = "pkgs.elasticsearch2";
4446 type = types.package;
4547 };
4648
@@ -129,7 +131,9 @@ in {
129131 wantedBy = [ "multi-user.target" ];
130132 after = [ "network-interfaces.target" ];
131133 path = [ pkgs.inetutils ];
132− environment = { ES_HOME = cfg.dataDir; };
134+ environment = {
135+ ES_HOME = cfg.dataDir;
136+ };
133137 serviceConfig = {
134138 ExecStart = "${cfg.package}/bin/elasticsearch -Des.path.conf=${configDir} ${toString cfg.extraCmdLineOptions}";
135139 User = "elasticsearch";
@@ -137,10 +141,11 @@ in {
137141 };
138142 preStart = ''
139143 mkdir -m 0700 -p ${cfg.dataDir}
140− if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
141144
142145 # Install plugins
143146 ln -sfT ${esPlugins}/plugins ${cfg.dataDir}/plugins
147+ ln -sfT ${cfg.package}/lib ${cfg.dataDir}/lib
148+ if [ "$(id -u)" = 0 ]; then chown -R elasticsearch ${cfg.dataDir}; fi
144149 '';
145150 postStart = mkBefore ''
146151 until ${pkgs.curl}/bin/curl -s -o /dev/null ${cfg.listenAddress}:${toString cfg.port}; do
pkgs/servers/search/elasticsearch/2.x.nixnew file+41
@@ -0,0 +1,41 @@
1+{ stdenv, fetchurl, makeWrapper, jre, utillinux, getopt }:
2+
3+with stdenv.lib;
4+
5+stdenv.mkDerivation rec {
6+ version = "2.2.0";
7+ name = "elasticsearch-${version}";
8+
9+ src = fetchurl {
10+ url = "https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/${version}/${name}.tar.gz";
11+ sha256 = "0c2d0mpcr8lpvifvgp2pfj7avdi7fa8a5vib0gqdap7mw60wqw7d";
12+ };
13+
14+ patches = [ ./es-home-2.x.patch ];
15+
16+ buildInputs = [ makeWrapper jre ] ++
17+ (if (!stdenv.isDarwin) then [utillinux] else [getopt]);
18+
19+ installPhase = ''
20+ mkdir -p $out
21+ cp -R bin config lib $out
22+
23+ # don't want to have binary with name plugin
24+ mv $out/bin/plugin $out/bin/elasticsearch-plugin
25+ wrapProgram $out/bin/elasticsearch ${if (!stdenv.isDarwin)
26+ then ''--prefix PATH : "${utillinux}/bin/"''
27+ else ''--prefix PATH : "${getopt}/bin"''} \
28+ --set JAVA_HOME "${jre}"
29+ wrapProgram $out/bin/elasticsearch-plugin --set JAVA_HOME "${jre}"
30+ '';
31+
32+ meta = {
33+ description = "Open Source, Distributed, RESTful Search Engine";
34+ license = licenses.asl20;
35+ platforms = platforms.unix;
36+ maintainers = [
37+ maintainers.offline
38+ maintainers.markWot
39+ ];
40+ };
41+}
pkgs/servers/search/elasticsearch/es-home-2.x.patchnew file+31
@@ -0,0 +1,31 @@
1+diff -rupN a/bin/elasticsearch b/bin/elasticsearch
2+--- a/bin/elasticsearch 2015-11-18 21:48:18.000000000 +0100
3++++ b/bin/elasticsearch 2015-12-04 00:52:21.032475098 +0100
4+@@ -72,7 +72,11 @@ while [ -h "$SCRIPT" ] ; do
5+ done
6+
7+ # determine elasticsearch home
8+-ES_HOME=`dirname "$SCRIPT"`/..
9++
10++if [ -z "$ES_HOME" ]; then
11++ echo "You must set the ES_HOME var" >&2
12++ exit 1
13++fi
14+
15+ # make ELASTICSEARCH_HOME absolute
16+ ES_HOME=`cd "$ES_HOME"; pwd`
17+diff -rupN a/bin/plugin b/bin/plugin
18+--- a/bin/plugin 2015-11-18 21:48:18.000000000 +0100
19++++ b/bin/plugin 2015-12-04 00:52:55.947453619 +0100
20+@@ -17,7 +17,10 @@ while [ -h "$SCRIPT" ] ; do
21+ done
22+
23+ # determine elasticsearch home
24+-ES_HOME=`dirname "$SCRIPT"`/..
25++if [ -z "$ES_HOME" ]; then
26++ echo "You must set the ES_HOME var" >&2
27++ exit 1
28++fi
29+
30+ # make ELASTICSEARCH_HOME absolute
31+ ES_HOME=`cd "$ES_HOME"; pwd`
pkgs/top-level/all-packages.nix+1
@@ -1437,6 +1437,7 @@ let
14371437 evemu = callPackage ../tools/system/evemu { };
14381438
14391439 elasticsearch = callPackage ../servers/search/elasticsearch { };
1440+ elasticsearch2 = callPackage ../servers/search/elasticsearch/2.x.nix { };
14401441
14411442 elasticsearchPlugins = recurseIntoAttrs (
14421443 callPackage ../servers/search/elasticsearch/plugins.nix { }