diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-04 21:55:48 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-12-04 21:55:48 +0100 |
commit | 2150e0956bbffb995e15e29dc7f5415eb9a2e1dd (patch) | |
tree | 24025843220d032676cc91ee794fabdc09592c5e | |
parent | 3db6c9a5351b5a67dec18ff02dc60907eec30925 (diff) | |
download | nixcfg-2150e0956bbffb995e15e29dc7f5415eb9a2e1dd.tar.gz nixcfg-2150e0956bbffb995e15e29dc7f5415eb9a2e1dd.zip |
Nomad and consul: single region now
-rw-r--r-- | configuration.nix | 14 | ||||
-rw-r--r-- | node/carcajou.nix | 4 | ||||
-rw-r--r-- | node/caribou.nix | 4 | ||||
-rw-r--r-- | node/spoutnik.nix | 4 | ||||
-rw-r--r-- | site/neptune.nix | 3 | ||||
-rw-r--r-- | site/pluton.nix | 3 |
6 files changed, 20 insertions, 12 deletions
diff --git a/configuration.nix b/configuration.nix index a73a6eb..e2fbe3b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -217,24 +217,26 @@ in services.consul.extraConfig = let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips))); in + (if node_config.services.consul.extraConfig.server or false + then { bootstrap_expect = 3; } + else {}) // { - server = true; + datacenter = "staging"; ui = true; bind_addr = public_ip; addresses.http = "0.0.0.0"; retry_join = [ "10.42.0.2" "10.42.0.21" "10.42.0.22" "10.42.0.23" ]; - retry_join_wan = [ "10.42.0.2" "10.42.0.21" "10.42.0.22" "10.42.0.23" ]; }; services.nomad.enable = true; services.nomad.settings = let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips))); in + (if node_config.services.nomad.settings.server.enabled or false + then { server = { bootstrap_expect = 3; }; } + else {}) // { - region = site_config.services.nomad.settings.datacenter; - server = { - enabled = true; - }; + region = "staging"; advertise = { rpc = public_ip; http = public_ip; diff --git a/node/carcajou.nix b/node/carcajou.nix index 9cf6cde..bc90d76 100644 --- a/node/carcajou.nix +++ b/node/carcajou.nix @@ -25,4 +25,8 @@ # Enable netdata monitoring services.netdata.enable = true; + + # Activate as Nomad and Consul server node + services.nomad.settings.server.enabled = true; + services.consul.extraConfig.server = true; } diff --git a/node/caribou.nix b/node/caribou.nix index d4b186d..e354754 100644 --- a/node/caribou.nix +++ b/node/caribou.nix @@ -26,6 +26,10 @@ # OR use USB modem plugged in here #networking.interfaces.enp0s20u1.useDHCP = true; + # Activate as Nomad and Consul server node + services.nomad.settings.server.enabled = true; + services.consul.extraConfig.server = true; + # Enable netdata monitoring services.netdata.enable = true; diff --git a/node/spoutnik.nix b/node/spoutnik.nix index 4aa6f91..1554de9 100644 --- a/node/spoutnik.nix +++ b/node/spoutnik.nix @@ -25,6 +25,10 @@ listenPort = 42136; }; + # Activate as Nomad and Consul server node + services.nomad.settings.server.enabled = true; + services.consul.extraConfig.server = true; + # Nginx configuration: services.nginx = { diff --git a/site/neptune.nix b/site/neptune.nix index 7fa6252..a42e2a7 100644 --- a/site/neptune.nix +++ b/site/neptune.nix @@ -6,10 +6,7 @@ interface = "eno1"; }; - services.consul.extraConfig.datacenter = "neptune"; services.nomad.settings.datacenter = "neptune"; - services.consul.extraConfig.bootstrap_expect = 3; - services.nomad.settings.server.bootstrap_expect = 3; # ---- diff --git a/site/pluton.nix b/site/pluton.nix index 10ef4a5..22bea08 100644 --- a/site/pluton.nix +++ b/site/pluton.nix @@ -6,10 +6,7 @@ interface = "enp0s25"; }; - services.consul.extraConfig.datacenter = "pluton"; services.nomad.settings.datacenter = "pluton"; - services.consul.extraConfig.bootstrap_expect = 1; - services.nomad.settings.server.bootstrap_expect = 1; networking.firewall.allowedTCPPorts = [ 80 443 ]; } |