diff --git a/hosts/koi/configuration.nix b/hosts/koi/configuration.nix index e20b9fe..bd668bc 100755 --- a/hosts/koi/configuration.nix +++ b/hosts/koi/configuration.nix @@ -28,6 +28,7 @@ ./containers/pds ./containers/navidrome ./containers/zond + ./containers/teisu.nix ./containers/bots/pcre-sub-bot.nix ./vms/hass.nix ./vms/bnuuy.nix diff --git a/hosts/koi/containers/teisu.nix b/hosts/koi/containers/teisu.nix new file mode 100644 index 0000000..e7575a3 --- /dev/null +++ b/hosts/koi/containers/teisu.nix @@ -0,0 +1,50 @@ +{ abs, config, ... } @ inputs: + +let + secrets = import (abs "lib/secrets.nix"); + + UID = 1103; +in { + imports = [ + (secrets.declare [{ + name = "teisu-env"; + owner = "teisu"; + }]) + ]; + + users.users.teisu = { + isNormalUser = true; + uid = UID; + }; + + virtualisation.oci-containers.containers.teisu = { + image = "ghcr.io/teidesu/tei.su:sha-e6a632c@sha256:1f6da149f278d05136155ff9faa858565dcb5ab66c429cba6839f731879fcf71"; + volumes = [ + "/srv/teisu:/app/.runtime" + ]; + environmentFiles = [ + (secrets.file config "teisu-env") + ]; + user = builtins.toString UID; + }; + + systemd.tmpfiles.rules = [ + "d /srv/teisu 0755 teisu teisu -" + ]; + + services.nginx.virtualHosts."tei.su" = { + forceSSL = true; + useACMEHost = "tei.su"; + + locations."/" = { + proxyPass = "http://teisu.docker:4321/"; + }; + + locations."/.well-known/" = { + proxyPass = "http://teisu.docker:4321/.well-known/"; + extraConfig = '' + add_header 'Access-Control-Allow-Origin' '*'; + ''; + }; + }; +} \ No newline at end of file diff --git a/hosts/koi/containers/zond/default.nix b/hosts/koi/containers/zond/default.nix index 85473d0..60ab5f9 100644 --- a/hosts/koi/containers/zond/default.nix +++ b/hosts/koi/containers/zond/default.nix @@ -2,6 +2,7 @@ { # todo - move this from an ad-hoc docker compose to a proper service + # todo 2: update UMAMI_HOST in teisu-env services.nginx.virtualHosts."zond.tei.su" = { forceSSL = true; useACMEHost = "tei.su"; diff --git a/hosts/koi/services/phpfront.nix b/hosts/koi/services/phpfront.nix index fb6f0d3..0490fbc 100644 --- a/hosts/koi/services/phpfront.nix +++ b/hosts/koi/services/phpfront.nix @@ -21,7 +21,7 @@ phpEnv."PATH" = lib.makeBinPath [ pkgs.php ]; }; - services.nginx.virtualHosts."tei.su" = { + services.nginx.virtualHosts."legacy.tei.su" = { forceSSL = true; useACMEHost = "tei.su"; diff --git a/secrets/teisu-env.age b/secrets/teisu-env.age new file mode 100644 index 0000000..08cb279 Binary files /dev/null and b/secrets/teisu-env.age differ