diff options
author | Rickard Nilsson <rickynils@gmail.com> | 2017-10-24 22:31:06 +0200 |
---|---|---|
committer | Rickard Nilsson <rickynils@gmail.com> | 2017-10-24 22:31:06 +0200 |
commit | 2fd11b762f0ae55a1f2879672d0e6688b4c24d61 (patch) | |
tree | 4791317f986a2051043796f44fae5eb3d2bebc0f /nixos/modules/services/search | |
parent | c0ce917c7764db5640d948283eb24e8bae0bfa81 (diff) |
nixos/elasticsearch: Do not try to run sysctl if running in container, since it fails
Diffstat (limited to 'nixos/modules/services/search')
-rw-r--r-- | nixos/modules/services/search/elasticsearch.nix | 12 |
1 files changed, 7 insertions, 5 deletions
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} |