move uptime

This commit is contained in:
nora 2024-08-02 22:47:33 +02:00
parent b695131065
commit 1a2f1dfbfa
12 changed files with 89 additions and 53 deletions

View file

@ -0,0 +1,35 @@
{ lib, config, ... }: {
virtualisation.oci-containers.containers.uptime = {
/*
uptime:
container_name: uptime
image: "docker.noratrieb.dev/uptime:50d15bc4"
restart: always
volumes:
- "/apps/uptime:/app/config"
environment:
UPTIME_CONFIG_PATH: /app/config/uptime.json
ports:
- "5010:3000"
*/
image = "docker.noratrieb.dev/uptime:50d15bc4";
volumes = [
"${./uptime.json}:/uptime.json"
"/var/lib/uptime:/data"
];
environment = {
UPTIME_CONFIG_PATH = "/uptime.json";
};
ports = [ "5010:3000" ];
login = {
registry = "docker.noratrieb.dev";
username = "nils";
passwordFile = config.age.secrets.docker_registry_password.path;
};
};
system.activationScripts.makeUptimeDir = lib.stringAfter [ "var" ] ''
mkdir -p /var/lib/uptime/
'';
}

View file

@ -0,0 +1,50 @@
{
"interval_seconds": 30,
"db_url": "/data/uptime.db",
"websites": [
{
"name": "noratrieb.dev",
"url": "https://noratrieb.dev"
},
{
"name": "nilstrieb.dev",
"url": "https://nilstrieb.dev"
},
{
"name": "docker.nilstrieb.dev",
"url": "http://docker.nilstrieb.dev"
},
{
"name": "vps1.nilstrieb.dev",
"url": "http://vps1.nilstrieb.dev"
},
{
"name": "vps2.nilstrieb.dev",
"url": "http://vps2.nilstrieb.dev"
},
{
"name": "bisect-rustc.nilstrieb.dev",
"url": "http://bisect-rustc.nilstrieb.dev"
},
{
"name": "hugo-chat.nilstrieb.dev",
"url": "http://hugo-chat.nilstrieb.dev"
},
{
"name": "api.hugo-chat.nilstrieb.dev",
"url": "https://api.hugo-chat.nilstrieb.dev/api/v2/rooms"
},
{
"name": "cors-school.nilstrieb.dev",
"url": "http://cors-school.nilstrieb.dev"
},
{
"name": "api.cors-school.nilstrieb.dev",
"url": "https://api.cors-school.nilstrieb.dev/api/hugo"
},
{
"name": "olat.nilstrieb.dev",
"url": "https://olat.nilstrieb.dev/dmz/"
}
]
}

View file

@ -11,6 +11,10 @@ dig @dns2.infra.noratrieb.dev dns1.infra.noratrieb.dev +noall +answer | grep 154
dig @dns1.infra.noratrieb.dev nilstrieb.dev +noall +answer | grep 161.97.165.1
dig @dns2.infra.noratrieb.dev nilstrieb.dev +noall +answer | grep 161.97.165.1
# Check the NS records. The trailing dot matters!
dig @dns1.infra.noratrieb.dev NS noratrieb.dev | grep "noratrieb.dev..*86400.*IN.*NS.*ns1.noratrieb.dev."
dig @dns2.infra.noratrieb.dev NS noratrieb.dev | grep "noratrieb.dev..*86400.*IN.*NS.*ns1.noratrieb.dev."
# Check HTTP responses
curl --fail -s https://vps1.infra.noratrieb.dev -o /dev/null
curl --fail -s https://vps3.infra.noratrieb.dev -o /dev/null

View file

@ -142,6 +142,7 @@
./modules/ingress
./apps/widetom
./apps/hugo-chat
./apps/uptime
];
age.secrets.docker_registry_password.file = ./secrets/docker_registry_password.age;

View file

@ -14,11 +14,11 @@ let
};
in
with hostsToDns;
# point nilstrieb.dev to vps1
# point nilstrieb.dev to vps1 (retired)
vps1 // {
SOA = {
nameServer = "ns1.nilstrieb.dev";
adminEmail = "void@noratrieb.dev";
nameServer = "ns1.nilstrieb.dev.";
adminEmail = "void@nilstrieb.dev";
serial = 2024072601;
};
@ -41,34 +41,33 @@ let
ns1 = dns1;
ns2 = dns2;
www = vps2;
blog = vps1;
# apps
bisect-rustc = vps2;
cors-school = vps2 // {
subdomains.api = vps2;
};
docker = vps2;
hugo-chat = vps2 // {
subdomains.api = vps2;
};
olat = vps2;
uptime = vps2;
localhost.A = [ (a "127.0.0.1") ];
# --- retired:
blog = vps1;
www = vps1;
uptime = vps1;
hugo-chat = vps1 // {
subdomains.api = vps1;
};
# ---
# infra (legacy)
inherit vps1;
inherit vps2;
inherit dns1;
inherit dns2;
pronouns.TXT = [
"TODO"
];
newtest.TXT = [ "uwu it works" ];
bsky.subdomains.atproto.TXT = [ "did=did:plc:pqyzoyxk7gfcbxk65mjyncyl" ];
};
};

View file

@ -17,7 +17,7 @@ let
# vps1 contains root noratrieb.dev
vps1 // {
SOA = {
nameServer = "ns1.noratrieb.dev";
nameServer = "ns1.noratrieb.dev.";
adminEmail = "void@noratrieb.dev";
serial = 2024072601;
};
@ -28,28 +28,32 @@ let
];
subdomains = {
# --- NS records
ns1 = dns1;
ns2 = dns2;
# --- website stuff
blog.CNAME = map (ttl hour1) [ (cname "noratrieb.github.io") ];
www = vps1;
www.CNAME = [ (cname "noratrieb.dev") ];
pronouns.TXT = [
"she/her"
];
# --- legacy crap
vps2 = vps2; # TODO REMOVE
docker = vps2;
vps2 = vps2; # TODO REMOVE
# --- apps
uptime = vps1;
hugo-chat = vps1 // {
subdomains.api = vps1;
};
test1.A = vps1.A ++ vps3.A;
# --- fun shit
localhost.A = [ (a "127.0.0.1") ];
newtest.TXT = [ "uwu it works" ];
pronouns.TXT = [
"she/her"
];
# --- infra
infra.subdomains = hostsToDns;
};
};

View file

@ -24,12 +24,20 @@
}
}
www.noratrieb.dev {
redir https://noratrieb.dev{uri} permanent
}
uptime.noratrieb.dev {
reverse_proxy * vps1.local:5010
}
hugo-chat.noratrieb.dev {
reverse_proxy * vps1.local:5002
}
api.cors-school.noratrieb.dev {
import cors https://cors-school.noratrieb.dev "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,token,refresh-token,Authorization"
api.hugo-chat.noratrieb.dev {
import cors https://hugo-chat.noratrieb.dev "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"
reverse_proxy * vps1.local:5001
}
@ -39,6 +47,10 @@ nilstrieb.dev {
redir https://noratrieb.dev{uri} permanent
}
www.nilstrieb.dev {
redir https://noratrieb.dev{uri} permanent
}
blog.nilstrieb.dev {
redir https://blog.noratrieb.dev{uri} permanent
}
@ -50,3 +62,7 @@ hugo-chat.nilstrieb.dev {
api.hugo-chat.nilstrieb.dev {
redir https://api.hugo-chat.noratrieb.dev{uri} permanent
}
uptime.nilstrieb.dev {
redir https://uptime.noratrieb.dev{uri} permanent
}