add math-project

This commit is contained in:
mtgmonkey 2025-06-12 06:49:33 -04:00
parent e7ab4a2172
commit a6d6637b3e
3 changed files with 60 additions and 2 deletions

View file

@ -21,6 +21,10 @@
domain = "blog.mtgmonkey.net";
proxyTo = "http://localhost:9181/";
}
{
domain = "math.mtgmonkey.net";
proxyTo = "http://localhost:9282/";
}
{
domain = "git.mtgmonkey.net";
proxyTo = "http://localhost:8000/";
@ -35,9 +39,8 @@
}
{
domain = "translate.mtgmonkey.net";
proxyTo = "http://localhost:9109/"
proxyTo = "http://localhost:9109/";
}
];
};
in {

49
services/math-project.nix Executable file
View file

@ -0,0 +1,49 @@
{
pkgs,
lib,
math-project,
...
}: let
botPolicies-nix = {
dnsbl = false;
status_codes = {
CHALLENGE = 200;
DENY = 200;
};
bots = [
{
name = "catch-everything";
user_agent_regex = ".*";
action = "CHALLENGE";
}
];
};
in {
services.anubis = {
instances.math-project = {
enable = true;
settings = {
BIND = "[::1]:9282";
BIND_NETWORK = "tcp";
DIFFICULTY = 4;
METRICS_BIND = "[::1]:9283";
METRICS_BIND_NETWORK = "tcp";
POLICY_FNAME = "/etc/anubis/math-project.botPolicies.yaml";
TARGET = "http://localhost:8080";
};
};
};
environment.etc."anubis/math-project.botPolicies.yaml" = {
source = (pkgs.formats.yaml {}).generate "" botPolicies-nix;
mode = "644";
};
systemd.services.math-project = {
serviceConfig = {
Type = "simple";
ExecStart = "${lib.getExe math-project}";
RemainAfterExit = true;
};
};
}