74 lines
1.9 KiB
Nix
74 lines
1.9 KiB
Nix
{
|
|
self,
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
name = "website";
|
|
|
|
hostPkgs = pkgs;
|
|
|
|
node.pkgs = pkgs;
|
|
node.specialArgs = self.outputs.nixosConfigurations.pioneer._module.specialArgs;
|
|
|
|
nodes = {
|
|
dns-server.imports = [ ./support/dns-server.nix ];
|
|
acme-server.imports = [ ./support/acme-server.nix ];
|
|
website-server =
|
|
{ config, ... }:
|
|
{
|
|
imports = [
|
|
self.nixosModules.momo-cloud
|
|
./support/global.nix
|
|
];
|
|
|
|
virtualisation.cores = 1;
|
|
virtualisation.memorySize = 4096;
|
|
|
|
networking.interfaces.eth0.ipv4.addresses = [
|
|
{
|
|
address = "192.168.1.3";
|
|
prefixLength = 32;
|
|
}
|
|
];
|
|
|
|
systemd.tmpfiles.rules = [
|
|
"f /var/www/html/index.html 1444 nginx nginx 10d Hello World!"
|
|
];
|
|
|
|
momo-cloud.nginx.enable = true;
|
|
momo-cloud.static-website = {
|
|
enable = true;
|
|
root = "/var/www/html";
|
|
};
|
|
|
|
security.acme.certs."${config.momo-cloud.networking.domain}" = {
|
|
dnsProvider = null;
|
|
webroot = "/var/lib/acme/acme-challenge";
|
|
|
|
};
|
|
security.acme.certs."www.${config.momo-cloud.networking.domain}" = {
|
|
dnsProvider = null;
|
|
webroot = "/var/lib/acme/acme-challenge";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
dns_server.start()
|
|
acme_server.start()
|
|
|
|
acme_server.wait_for_unit("step-ca.service")
|
|
acme_server.wait_for_open_port(443)
|
|
|
|
website_server.start()
|
|
|
|
website_server.wait_for_unit("default.target")
|
|
acme_server.wait_until_succeeds("ping www.test.momo-cloud -c 2")
|
|
website_server.wait_until_succeeds("ping ca.test.momo-cloud -c 2")
|
|
website_server.wait_for_unit("nginx.service")
|
|
website_server.wait_for_open_port(443, "www.test.momo-cloud")
|
|
website_server.wait_until_succeeds("curl https://test.momo-cloud/")
|
|
website_server.wait_until_succeeds("curl https://www.test.momo-cloud/")
|
|
'';
|
|
}
|