This commit is contained in:
nora 2024-08-02 18:12:12 +02:00
parent a7aea77480
commit 51b9fc4d1b
13 changed files with 77 additions and 46 deletions

View file

@ -1,7 +1,7 @@
{ config, ... }:
{ config, lib, ... }:
let
dockerLogin = {
registry = "docker.nilstrieb.dev";
registry = "docker.noratrieb.dev";
username = "nils";
passwordFile = config.age.secrets.docker_registry_password.path;
};
@ -13,20 +13,20 @@ in
/*
hugo_chat_client:
container_name: hugo-chat-client
image: "docker.nilstrieb.dev/hugo-chat-client:63bd1922"
image: "docker.noratrieb.dev/hugo-chat-client:63bd1922"
restart: always
ports:
- "5002:80"
*/
hugo-chat-client = {
image = "docker.nilstrieb.dev/hugo-chat-client:63bd1922";
image = "docker.noratrieb.dev/hugo-chat-client:63bd1922";
login = dockerLogin;
ports = [ "5002:80" ];
};
/*
hugo_chat_server:
container_name: hugo-chat-server
image: "docker.nilstrieb.dev/hugo-chat-server:63bd1922"
image: "docker.noratrieb.dev/hugo-chat-server:63bd1922"
ports:
- "5001:8080"
environment:
@ -36,10 +36,10 @@ in
- hugo-chat
*/
hugo-chat-server = {
image = "docker.nilstrieb.dev/hugo-chat-server:63bd1922";
image = "docker.noratrieb.dev/hugo-chat-server:63bd1922";
ports = [ "5001:80" ];
environment = {
SPRING_DATASOURCE_URL = "jdbc:postgresql://vps1.local:5432/hugochat";
SPRING_DATASOURCE_URL = "jdbc:postgresql://vps1.local:5003/hugochat";
};
environmentFiles = [ config.age.secrets.hugochat_db_password.path ];
login = dockerLogin;
@ -60,7 +60,7 @@ in
*/
hugo-chat-db = {
image = "postgres:16";
ports = [ "5001:80" ];
ports = [ "5003:80" ];
volumes = [ "/var/lib/hugo-chat/data:/var/lib/postgresql/data" ];
environment = {
POSTGRES_PASSWORD = "\${HUGO_CHAT_DB_PASSWORD}";
@ -69,4 +69,9 @@ in
environmentFiles = [ config.age.secrets.hugochat_db_password.path ];
};
};
system.activationScripts.makeHugoChatDir = lib.stringAfter [ "var" ] ''
mkdir -p /var/lib/hugo-chat/data
'';
}

View file

@ -5,7 +5,7 @@
virtualisation.oci-containers.containers = {
/*
container_name: widetom
image: "docker.nilstrieb.dev/widetom:33d17387"
image: "docker.noratrieb.dev/widetom:33d17387"
restart: always
volumes:
- "/apps/widetom:/app/config"
@ -14,7 +14,7 @@
BOT_TOKEN_PATH: /app/config/bot_token
*/
widetom = {
image = "docker.nilstrieb.dev/widetom:33d17387";
image = "docker.noratrieb.dev/widetom:33d17387";
volumes = [
"${config.age.secrets.widetom_config_toml.path}:/config.toml"
"${config.age.secrets.widetom_bot_token.path}:/token"
@ -24,7 +24,7 @@
BOT_TOKEN_PATH = "/token";
};
login = {
registry = "docker.nilstrieb.dev";
registry = "docker.noratrieb.dev";
username = "nils";
passwordFile = config.age.secrets.docker_registry_password.path;
};

View file

@ -134,13 +134,14 @@
'';
};
vps1 = { name, nodes, modulesPath, config, ... }: {
vps1 = { name, nodes, modulesPath, config, lib, ... }: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
./modules/contabo
./modules/wg-mesh
./modules/ingress
./modules/widetom
./apps/widetom
./apps/hugo-chat
];
age.secrets.docker_registry_password.file = ./secrets/docker_registry_password.age;

View file

@ -9,6 +9,9 @@ let
lib.optionalAttrs (publicIPv4 != null) { A = [ (ttl hour1 (a publicIPv4)) ]; } //
lib.optionalAttrs (publicIPv6 != null) { AAAA = [ (ttl hour1 (aaaa publicIPv6)) ]; })
networkingConfig;
vps2 = {
A = [ "184.174.32.252" ];
};
in
with hostsToDns;
# vps1 contains root noratrieb.dev
@ -34,6 +37,13 @@ let
pronouns.TXT = [
"she/her"
];
docker = vps2;
vps2 = vps2; # TODO REMOVE
hugo-chat = vps1 // {
subdomains.api = vps1;
};
test1.A = vps1.A ++ vps3.A;

View file

@ -27,3 +27,30 @@
}
}
}
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"
reverse_proxy * vps1.local:5001
}
################################################################
# deadname redirects
nilstrieb.dev {
redir https://noratrieb.dev{uri} permanent
}
blog.nilstrieb.dev {
redir https://blog.noratrieb.dev{uri} permanent
}
hugo-chat.nilstrieb.dev {
redir https://hugo-chat.noratrieb.dev{uri} permanent
}
api.hugo-chat.nilstrieb.dev {
redir https://api.hugo-chat.noratrieb.dev{uri} permanent
}

View file

@ -7,7 +7,6 @@
enable = true;
configFile = pkgs.writeText "Caddyfile"
(
builtins.readFile ./Caddyfile +
''
${config.networking.hostName}.infra.noratrieb.dev {
root * ${./debugging-page}
@ -16,15 +15,7 @@
${
if name == "vps1" then
''
nilstrieb.dev {
redir https://noratrieb.dev{uri} permanent
}
blog.nilstrieb.dev {
redir https://blog.noratrieb.dev{uri} permanent
}
builtins.readFile ./Caddyfile + ''
noratrieb.dev {
root * ${website {inherit pkgs slides blog;}}
file_server

View file

@ -1,6 +0,0 @@
{ pkgs, ... }: {
services.postgresql = {
enable = true;
package = pkgs.postgresql_16;
};
}