diff options
author | Ben Smith <polynomial@gmail.com> | 2015-10-02 23:22:27 -0700 |
---|---|---|
committer | Joachim Fasting <joachifm@fastmail.fm> | 2016-05-21 18:17:36 +0200 |
commit | 3a1beb6347799a8d8f3290a6158b2d5249c7ecb8 (patch) | |
tree | 131e68185677b15237c3d760e448870793986db6 /nixos | |
parent | 3e0943d5ba27336109265db318515029c0d1e2de (diff) | |
download | nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar.gz nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar.bz2 nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar.lz nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar.xz nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.tar.zst nixlib-3a1beb6347799a8d8f3290a6158b2d5249c7ecb8.zip |
redis service: add firewall and VM overcommit options
- Add vm.over_commit setting for background saving - Add openFirewall setting Closes #10193
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/databases/redis.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 6323d2c8ce4e..480e1184ffa3 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -68,6 +68,22 @@ in description = "The port for Redis to listen to."; }; + vmOverCommit = mkOption { + type = types.bool; + default = false; + description = '' + Set vm.overcommit_memory to 1 (Suggested for Background Saving: http://redis.io/topics/faq) + ''; + }; + + openFirewall = mkOption { + type = types.bool; + default = false; + description = '' + Whether to open ports in the firewall for the server. + ''; + }; + bind = mkOption { type = with types; nullOr str; default = null; # All interfaces @@ -193,6 +209,14 @@ in config = mkIf config.services.redis.enable { + boot.kernel.sysctl = mkIf cfg.vmOverCommit { + "vm.overcommit_memory" = "1"; + }; + + networking.firewall = mkIf cfg.openFirewall { + allowedTCPPorts = [ cfg.port ]; + }; + users.extraUsers.redis = { name = cfg.user; uid = config.ids.uids.redis; |