updated tandoor and ihatemoney config

This commit is contained in:
mc-fucker 2023-01-31 16:48:31 +01:00
parent fab9133f1d
commit 8cb15e97a7
3 changed files with 30 additions and 20 deletions

View file

@ -1,11 +1,14 @@
{ ... }: { ... }:
let let
port = "8000"; cfg = import ./vars.nix;
db = "ihatemoney"; port = cfg.ihatemoney.port;
domain = "geld.mc-fucker.cool"; db = cfg.ihatemoney.db;
domain = cfg.ihatemoney.domain;
in in
{ {
services.nginx.enable = true;
imports = [ ./nginx.nix ];
services.nginx.virtualHosts."${domain}" = { services.nginx.virtualHosts."${domain}" = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
@ -18,11 +21,6 @@ in
''; '';
}; };
security.acme = {
acceptTerms = true;
defaults.email = "dev@mc-fucker.cool";
};
virtualisation.oci-containers.containers.ihatemoney = { virtualisation.oci-containers.containers.ihatemoney = {
image = "cfa3c41cf3ac"; image = "cfa3c41cf3ac";
environment = { environment = {
@ -34,7 +32,7 @@ in
MAIL_USE_TLS = "True"; MAIL_USE_TLS = "True";
DEBUG = "False"; DEBUG = "False";
}; };
ports = [ "${port}:8000" ]; ports = [ "${port}:${port}" ];
environmentFiles = [ /etc/nixos/keys/ihatemoney-env ]; environmentFiles = [ /etc/nixos/keys/ihatemoney-env ];
}; };
@ -51,8 +49,6 @@ in
authentication = "host ${db} ${db} 10.88.0.0/16 md5"; authentication = "host ${db} ${db} 10.88.0.0/16 md5";
}; };
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.postgresqlBackup.databases = [ "ihatemoney" ]; services.postgresqlBackup.databases = [ "ihatemoney" ];
} }

View file

@ -1,18 +1,19 @@
{ config, lib, ... }: { config, lib, ... }:
let let
pg_user = "tandoor"; cfg = import ./vars.nix;
tandoor_port = "8080"; pg_user = cfg.tandoor.db;
domain = "kochen.mc-fucker.cool"; port = cfg.tandoor.port;
domain = cfg.tandoor.domain;
in in
{ {
virtualisation.oci-containers.containers.tandoor = { virtualisation.oci-containers.containers.tandoor = {
image = "vabene1111/recipes"; image = "docker.io/vabene1111/recipes";
environment = { environment = {
DEBUG = "0"; DEBUG = "0";
DB_ENGINE = "django.db.backends.postgresql"; DB_ENGINE = "django.db.backends.postgresql";
POSTGRES_HOST = "10.88.0.1"; POSTGRES_HOST = cfg.podman.hostIP;
POSTGRES_PORT = "5432"; POSTGRES_PORT = "5432";
POSTGRES_USER = pg_user; POSTGRES_USER = pg_user;
POSTGRES_DB = pg_user; POSTGRES_DB = pg_user;
@ -20,8 +21,9 @@ in
SECRET_KEY = builtins.readFile /etc/nixos/keys/tandoor-secret; SECRET_KEY = builtins.readFile /etc/nixos/keys/tandoor-secret;
}; };
ports = [ ports = [
"${tandoor_port}:${tandoor_port}" "${port}:${port}"
]; ];
extraOptions = cfg.podman.extraOptions;
volumes = [ volumes = [
"/var/lib/tandoor/mediafiles:/opt/recipes/mediafiles" "/var/lib/tandoor/mediafiles:/opt/recipes/mediafiles"
"/var/lib/tandoor/staticfiles:/opt/recipes/staticfiles" "/var/lib/tandoor/staticfiles:/opt/recipes/staticfiles"
@ -50,11 +52,11 @@ in
enableACME = true; enableACME = true;
locations = { locations = {
"/" = { "/" = {
proxyPass = "http://127.0.0.1:${tandoor_port}"; proxyPass = "http://127.0.0.1:${port}";
extraConfig = '' extraConfig = ''
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect http://127.0.0.1:${tandoor_port} https://${domain}; proxy_redirect http://127.0.0.1:${port} https://${domain};
access_log /var/log/nginx/${domain}_access.log; access_log /var/log/nginx/${domain}_access.log;
error_log /var/log/nginx/${domain}_error.log; error_log /var/log/nginx/${domain}_error.log;
''; '';

View file

@ -1,5 +1,11 @@
{ {
ihatemoney = {
db = "ihatemoney";
domain = "geld.mc-fucker.cool";
port = "8000";
};
invidious = { invidious = {
domain = "yt.mc-fucker.cool"; domain = "yt.mc-fucker.cool";
db_user = "kemal"; db_user = "kemal";
@ -21,6 +27,12 @@
hostIP = "10.88.0.1"; hostIP = "10.88.0.1";
}; };
tandoor = {
db = "tandoor";
domain = "kochen.mc-fucker.cool";
port = "8080";
};
zabbix = { zabbix = {
domain = "zbx.mc-fucker.cool"; domain = "zbx.mc-fucker.cool";
db = "zabbix"; db = "zabbix";