From 2fd11b762f0ae55a1f2879672d0e6688b4c24d61 Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Tue, 24 Oct 2017 22:31:06 +0200 Subject: nixos/elasticsearch: Do not try to run sysctl if running in container, since it fails --- nixos/modules/services/search/elasticsearch.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'nixos/modules') diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 2ea22a945940..c51dd5d94655 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -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} -- cgit 1.4.1