The Simulacrum: Stage 2 #109
4 changed files with 25 additions and 7 deletions
|
@ -22,6 +22,11 @@ in
|
||||||
];
|
];
|
||||||
ready = ./ready.nix;
|
ready = ./ready.nix;
|
||||||
};
|
};
|
||||||
|
simulacrum = {
|
||||||
|
enable = true;
|
||||||
|
deps = [ "wireguard" ];
|
||||||
|
settings = ./test.nix;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
dns.records."consul-remote.internal".consulService = "consul-remote";
|
dns.records."consul-remote.internal".consulService = "consul-remote";
|
||||||
|
|
20
cluster/services/consul/test.nix
Normal file
20
cluster/services/consul/test.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
testScript = ''
|
||||||
|
import json
|
||||||
|
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
with subtest("should form cluster"):
|
||||||
|
nodes = [ n for n in machines if n != nowhere ]
|
||||||
|
for machine in nodes:
|
||||||
|
machine.succeed("systemctl start consul-ready.service")
|
||||||
|
for machine in nodes:
|
||||||
|
consulConfig = json.loads(machine.succeed("cat /etc/consul.json"))
|
||||||
|
addr = consulConfig["addresses"]["http"]
|
||||||
|
port = consulConfig["ports"]["http"]
|
||||||
|
setEnv = f"CONSUL_HTTP_ADDR={addr}:{port}"
|
||||||
|
memberList = machine.succeed(f"{setEnv} consul members --status=alive")
|
||||||
|
for machine2 in nodes:
|
||||||
|
assert machine2.name in memberList
|
||||||
|
'';
|
||||||
|
}
|
|
@ -29,7 +29,6 @@ in
|
||||||
reflection = ./reflection;
|
reflection = ./reflection;
|
||||||
shell-config = ./shell-config;
|
shell-config = ./shell-config;
|
||||||
ssh = ./ssh;
|
ssh = ./ssh;
|
||||||
system-info = ./system-info;
|
|
||||||
system-recovery = ./system-recovery;
|
system-recovery = ./system-recovery;
|
||||||
systemd-extras = ./systemd-extras;
|
systemd-extras = ./systemd-extras;
|
||||||
tested = ./tested;
|
tested = ./tested;
|
||||||
|
@ -56,7 +55,6 @@ in
|
||||||
motd
|
motd
|
||||||
networking
|
networking
|
||||||
nix-config-server
|
nix-config-server
|
||||||
system-info
|
|
||||||
system-recovery
|
system-recovery
|
||||||
tested
|
tested
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
{ depot, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
system.configurationRevision = depot.rev or null;
|
|
||||||
}
|
|
Loading…
Reference in a new issue