1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00

nixos/elasticsearch: Do not try to run sysctl if running in container, since it fails

This commit is contained in:
Rickard Nilsson 2017-10-24 22:31:06 +02:00
parent c0ce917c77
commit 2fd11b762f

View file

@ -174,11 +174,13 @@ in {
LimitNOFILE = "1024000";
};
preStart = ''
# Only set vm.max_map_count if lower than ES required minimum
# This avoids conflict if configured via boot.kernel.sysctl
if [ `${pkgs.procps}/bin/sysctl -n vm.max_map_count` -lt 262144 ]; then
${pkgs.procps}/bin/sysctl -w vm.max_map_count=262144
fi
${optionalString (!config.boot.isContainer) ''
# Only set vm.max_map_count if lower than ES required minimum
# This avoids conflict if configured via boot.kernel.sysctl
if [ `${pkgs.procps}/bin/sysctl -n vm.max_map_count` -lt 262144 ]; then
${pkgs.procps}/bin/sysctl -w vm.max_map_count=262144
fi
''}
mkdir -m 0700 -p ${cfg.dataDir}