forked from Deuxfleurs/nixcfg
Nomad and consul: single region now
This commit is contained in:
parent
3db6c9a535
commit
2150e0956b
6 changed files with 20 additions and 12 deletions
|
@ -217,24 +217,26 @@ in
|
||||||
services.consul.extraConfig =
|
services.consul.extraConfig =
|
||||||
let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips)));
|
let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips)));
|
||||||
in
|
in
|
||||||
|
(if node_config.services.consul.extraConfig.server or false
|
||||||
|
then { bootstrap_expect = 3; }
|
||||||
|
else {}) //
|
||||||
{
|
{
|
||||||
server = true;
|
datacenter = "staging";
|
||||||
ui = true;
|
ui = true;
|
||||||
bind_addr = public_ip;
|
bind_addr = public_ip;
|
||||||
addresses.http = "0.0.0.0";
|
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 = [ "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.enable = true;
|
||||||
services.nomad.settings =
|
services.nomad.settings =
|
||||||
let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips)));
|
let public_ip = (builtins.head (builtins.split "/" (builtins.head node_config.networking.wireguard.interfaces.wg0.ips)));
|
||||||
in
|
in
|
||||||
|
(if node_config.services.nomad.settings.server.enabled or false
|
||||||
|
then { server = { bootstrap_expect = 3; }; }
|
||||||
|
else {}) //
|
||||||
{
|
{
|
||||||
region = site_config.services.nomad.settings.datacenter;
|
region = "staging";
|
||||||
server = {
|
|
||||||
enabled = true;
|
|
||||||
};
|
|
||||||
advertise = {
|
advertise = {
|
||||||
rpc = public_ip;
|
rpc = public_ip;
|
||||||
http = public_ip;
|
http = public_ip;
|
||||||
|
|
|
@ -25,4 +25,8 @@
|
||||||
|
|
||||||
# Enable netdata monitoring
|
# Enable netdata monitoring
|
||||||
services.netdata.enable = true;
|
services.netdata.enable = true;
|
||||||
|
|
||||||
|
# Activate as Nomad and Consul server node
|
||||||
|
services.nomad.settings.server.enabled = true;
|
||||||
|
services.consul.extraConfig.server = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
# OR use USB modem plugged in here
|
# OR use USB modem plugged in here
|
||||||
#networking.interfaces.enp0s20u1.useDHCP = true;
|
#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
|
# Enable netdata monitoring
|
||||||
services.netdata.enable = true;
|
services.netdata.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
listenPort = 42136;
|
listenPort = 42136;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Activate as Nomad and Consul server node
|
||||||
|
services.nomad.settings.server.enabled = true;
|
||||||
|
services.consul.extraConfig.server = true;
|
||||||
|
|
||||||
# Nginx configuration:
|
# Nginx configuration:
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
interface = "eno1";
|
interface = "eno1";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.consul.extraConfig.datacenter = "neptune";
|
|
||||||
services.nomad.settings.datacenter = "neptune";
|
services.nomad.settings.datacenter = "neptune";
|
||||||
services.consul.extraConfig.bootstrap_expect = 3;
|
|
||||||
services.nomad.settings.server.bootstrap_expect = 3;
|
|
||||||
|
|
||||||
# ----
|
# ----
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,7 @@
|
||||||
interface = "enp0s25";
|
interface = "enp0s25";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.consul.extraConfig.datacenter = "pluton";
|
|
||||||
services.nomad.settings.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 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue