nixos/elasticsearch: fix crashes on large datanodes

https://github.com/NixOS/nixpkgs/commit/3a1e1f062432fbc867502187972b37f7a6f9fe63 adds a poststart script that
checks if ES successfully started by curling the HTTP endpoint. On nodes with a lot of data or slower disks,
this might take longer than the default systemd startup timeout of 90 seconds.
This commit is contained in:
illustris
2022-01-05 18:40:39 +05:30
parent 6d835d9cf5
commit 420f522dfa
@@ -143,6 +143,17 @@ in
example = lib.literalExpression "[ pkgs.elasticsearchPlugins.discovery-ec2 ]";
};
restartIfChanged = mkOption {
type = types.bool;
description = ''
Automatically restart the service on config change.
This can be set to false to defer restarts on a server or cluster.
Please consider the security implications of inadvertently running an older version,
and the possibility of unexpected behavior caused by inconsistent versions across a cluster when disabling this option.
'';
default = true;
};
};
###### implementation
@@ -153,6 +164,7 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
path = [ pkgs.inetutils ];
inherit (cfg) restartIfChanged;
environment = {
ES_HOME = cfg.dataDir;
ES_JAVA_OPTS = toString cfg.extraJavaOptions;
@@ -163,6 +175,8 @@ in
User = "elasticsearch";
PermissionsStartOnly = true;
LimitNOFILE = "1024000";
Restart = "always";
TimeoutStartSec = "infinity";
};
preStart = ''
${optionalString (!config.boot.isContainer) ''