Nomad and consul: single region now

This commit is contained in:
Alex 2021-12-04 21:55:48 +01:00
parent 3db6c9a535
commit 2150e0956b
No known key found for this signature in database
GPG key ID: EDABF9711E244EB1
6 changed files with 20 additions and 12 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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 = {

View file

@ -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;
# ----

View file

@ -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 ];
}