From 68950a4507205c2d64801f2d8a9229741fc25ad5 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 2 Nov 2025 15:05:38 +0100 Subject: [PATCH] leonard: Add wiki-wackattack-eu --- hosts/leonard/configuration.nix | 4 +- hosts/leonard/services/postgresql.nix | 20 ++++++++++ hosts/leonard/services/wiki-wackattack-eu.nix | 38 +++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 hosts/leonard/services/postgresql.nix create mode 100644 hosts/leonard/services/wiki-wackattack-eu.nix diff --git a/hosts/leonard/configuration.nix b/hosts/leonard/configuration.nix index 10f5f36..afa8fdd 100644 --- a/hosts/leonard/configuration.nix +++ b/hosts/leonard/configuration.nix @@ -8,9 +8,11 @@ ../../common/auto-upgrade.nix ./hardware-configuration.nix - ./services/nginx.nix ./services/mysql.nix + ./services/nginx.nix + ./services/postgresql.nix + ./services/wiki-wackattack-eu.nix ./services/www-feal-no ./services/www-kinealbrigtsen-no.nix ]; diff --git a/hosts/leonard/services/postgresql.nix b/hosts/leonard/services/postgresql.nix new file mode 100644 index 0000000..7fa3810 --- /dev/null +++ b/hosts/leonard/services/postgresql.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: +{ + services.postgresql = { + enable = true; + enableTCPIP = false; + authentication = pkgs.lib.mkOverride 10 '' + #type database DBuser auth-method + local all all trust + ''; + }; + + services.postgresqlBackup = { + enable = true; + location = "/backup/postgresql/"; + startAt = "*-*-* 03:15:00"; + backupAll = true; + }; + + environment.systemPackages = [ config.services.postgresql.package ]; +} diff --git a/hosts/leonard/services/wiki-wackattack-eu.nix b/hosts/leonard/services/wiki-wackattack-eu.nix new file mode 100644 index 0000000..d7bdc45 --- /dev/null +++ b/hosts/leonard/services/wiki-wackattack-eu.nix @@ -0,0 +1,38 @@ +{ config, ... }: +let + bindIP = "127.0.1.2"; + port = 5051; + cfg = config.services.wiki-js; +in { + # sops.secrets."wikijs/envfile" = { + # restartUnits = [ "wiki-js.service" ]; + # }; + + services.wiki-js = { + enable = true; + # environmentFile = config.sops.secrets."wikijs/envfile".path; + settings = { + inherit bindIP port; + db = { + type = "postgres"; + host = "/run/postgresql"; + db = "wiki-js"; + user = "wiki-js"; + }; + }; + }; + + services.postgresql = { + ensureDatabases = [ "wiki-js" ]; + ensureUsers = [{ + name = "wiki-js"; + ensureDBOwnership = true; + }]; + }; + + services.nginx.virtualHosts."wiki.wackattack.eu" = { + locations."/" = { + proxyPass = "http://${bindIP}:${toString port}"; + }; + }; +}