feat: skynet 2016 is live!

This commit is contained in:
silver 2023-07-23 03:08:56 +01:00
parent 2ea0dc0d6b
commit 1c33c78c50
2 changed files with 63 additions and 23 deletions

View file

@ -0,0 +1,55 @@
{ config, pkgs, lib, inputs, ... }:
with lib;
let
cfg = config.services.skynet;
in {
imports = [
./acme.nix
./dns.nix
];
options.services.skynet = {
host = {
ip = mkOption {
type = types.str;
};
name = mkOption {
type = types.str;
};
};
};
config = {
skynet_dns.records = [
# means root domain, so skynet.ie
{record="@"; r_type="A"; value=cfg.host.ip;}
{record="2016"; r_type="CNAME"; value="skynet.ie";}
];
networking.firewall.allowedTCPPorts = [80 443];
services.httpd = {
enable = true;
group = "acme";
virtualHosts = {
# main site
"skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
documentRoot = "${inputs.skynet_website.defaultPackage."x86_64-linux"}";
# only on skynet.ie
# skynet.ie/~username
enableUserDir = true;
};
# archive of teh site as it was ~2012 to 2016
"2016.skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
documentRoot = "${inputs.skynet_website_2016.defaultPackage."x86_64-linux"}";
};
};
};
};
}

View file

@ -22,7 +22,7 @@ let
in {
imports = [
../applications/acme.nix
../applications/skynet.ie.nix
];
deployment = {
@ -35,13 +35,10 @@ in {
# it has two network devices so two
skynet_dns.records = [
{record=name; r_type="A"; value=ip_pub; server=true;}
#{record=name; r_type="A"; value=ip_pub; server=true;}
{record=name; r_type="A"; value=ip_priv; server=true;}
{record="${name}.int"; r_type="A"; value=ip_priv; server=true;}
# change to pub later
{record="@"; r_type="A"; value=ip_priv;}
{record=ip_pub; r_type="PTR"; value=hostname;}
{record=ip_priv; r_type="PTR"; value=hostname_int;}
];
@ -69,22 +66,10 @@ in {
}
];
networking.firewall.allowedTCPPorts = [80 443];
services.httpd = {
enable = true;
group = "acme";
virtualHosts = {
# main site
"skynet.ie" = {
forceSSL = true;
useACMEHost = "skynet";
documentRoot = "${inputs.skynet_website.defaultPackage."x86_64-linux"}";
# skynet.ie/~username
enableUserDir = true;
};
};
services.skynet = {
host = {
ip = ip_priv;
name = name;
};
};
}