redis service: add firewall and VM overcommit options
- Add vm.over_commit setting for background saving - Add openFirewall setting Closes #10193
This commit is contained in:
parent
3e0943d5ba
commit
3a1beb6347
@ -68,6 +68,22 @@ in
|
|||||||
description = "The port for Redis to listen to.";
|
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 {
|
bind = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
default = null; # All interfaces
|
default = null; # All interfaces
|
||||||
@ -193,6 +209,14 @@ in
|
|||||||
|
|
||||||
config = mkIf config.services.redis.enable {
|
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 =
|
users.extraUsers.redis =
|
||||||
{ name = cfg.user;
|
{ name = cfg.user;
|
||||||
uid = config.ids.uids.redis;
|
uid = config.ids.uids.redis;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user