Move common nix code one level up.
This commit is contained in:
32
common/consul.nix
Normal file
32
common/consul.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
servers = [ "c1" "c2" "c3" ];
|
||||
server_enabled = builtins.elem config.networking.hostName servers;
|
||||
in
|
||||
{
|
||||
services.consul = {
|
||||
enable = true;
|
||||
webUi = true;
|
||||
interface.advertise = "eno1";
|
||||
extraConfig = {
|
||||
client_addr = "0.0.0.0";
|
||||
datacenter = "alo";
|
||||
server = server_enabled;
|
||||
bootstrap_expect = (builtins.length servers + 2) / 2;
|
||||
retry_join = builtins.filter (elem: elem != config.networking.hostName) servers;
|
||||
telemetry = {
|
||||
prometheus_retention_time = "24h";
|
||||
disable_hostname = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = [
|
||||
"/var/lib/consul"
|
||||
];
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [ 8600 8500 8301 8302 8300 ];
|
||||
allowedUDPPorts = [ 8600 8301 8302 ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user