Skip to content

Commit

Permalink
nixos/elasticsearch: Do not try to run sysctl if running in container…
Browse files Browse the repository at this point in the history
…, since it fails
  • Loading branch information
rickynils committed Oct 24, 2017
1 parent c0ce917 commit 2fd11b7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nixos/modules/services/search/elasticsearch.nix
Expand Up @@ -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}
Expand Down

0 comments on commit 2fd11b7

Please sign in to comment.