From 656b93b2488f4e6806b926de740eeb90e556b4ef Mon Sep 17 00:00:00 2001 From: Patrick Stevens <3138005+Smaug123@users.noreply.github.com> Date: Wed, 29 Jan 2025 18:34:49 +0000 Subject: [PATCH] Add apps subdomain (#36) * Add apps subdomain * Fix formatting --- PulumiWebServer/Domain.fs | 21 ++-- PulumiWebServer/Nix/apps/apps.nix | 32 +++++++ PulumiWebServer/Nix/apps/static/index.html | 12 +++ .../Nix/apps/static/middle_word.html | 25 +++++ .../Nix/apps/static/sha256sum.html | 95 +++++++++++++++++++ PulumiWebServer/Nix/configuration.nix | 3 + 6 files changed, 179 insertions(+), 9 deletions(-) create mode 100644 PulumiWebServer/Nix/apps/apps.nix create mode 100644 PulumiWebServer/Nix/apps/static/index.html create mode 100644 PulumiWebServer/Nix/apps/static/middle_word.html create mode 100644 PulumiWebServer/Nix/apps/static/sha256sum.html diff --git a/PulumiWebServer/Domain.fs b/PulumiWebServer/Domain.fs index 86a0ed7..54c5de7 100644 --- a/PulumiWebServer/Domain.fs +++ b/PulumiWebServer/Domain.fs @@ -95,6 +95,7 @@ type Address = type WellKnownSubdomain = | Nextcloud + | Apps | Gitea | Radicale | Rss @@ -106,18 +107,20 @@ type WellKnownSubdomain = override this.ToString () = match this with - | Nextcloud -> "nextcloud" - | Gitea -> "gitea" - | Radicale -> "calendar" - | Rss -> "rss" - | Grafana -> "grafana" - | Woodpecker -> "woodpecker" - | WoodpeckerAgent -> "woodpecker-agent" - | PureGym -> "puregym" - | Whisper -> "whisper" + | WellKnownSubdomain.Nextcloud -> "nextcloud" + | WellKnownSubdomain.Apps -> "apps" + | WellKnownSubdomain.Gitea -> "gitea" + | WellKnownSubdomain.Radicale -> "calendar" + | WellKnownSubdomain.Rss -> "rss" + | WellKnownSubdomain.Grafana -> "grafana" + | WellKnownSubdomain.Woodpecker -> "woodpecker" + | WellKnownSubdomain.WoodpeckerAgent -> "woodpecker-agent" + | WellKnownSubdomain.PureGym -> "puregym" + | WellKnownSubdomain.Whisper -> "whisper" static member Parse (s : string) = match s with + | "apps" -> WellKnownSubdomain.Apps | "nextcloud" -> WellKnownSubdomain.Nextcloud | "gitea" -> WellKnownSubdomain.Gitea | "calendar" -> WellKnownSubdomain.Radicale diff --git a/PulumiWebServer/Nix/apps/apps.nix b/PulumiWebServer/Nix/apps/apps.nix new file mode 100644 index 0000000..54cbf16 --- /dev/null +++ b/PulumiWebServer/Nix/apps/apps.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + ... +}: { + options = { + services.apps-config = { + domain = lib.mkOption { + type = lib.types.str; + example = "example.com"; + description = lib.mdDoc "Top-level domain to configure"; + }; + subdomain = lib.mkOption { + type = lib.types.str; + example = "apps"; + description = lib.mdDoc "Subdomain in which to put apps"; + }; + port = lib.mkOption { + type = lib.types.port; + description = lib.mdDoc "App server localhost port"; + default = 9521; + }; + }; + }; + config = { + services.nginx.virtualHosts."${config.services.apps-config.subdomain}.${config.services.apps-config.domain}" = { + forceSSL = true; + enableACME = true; + root = ./static; + }; + }; +} diff --git a/PulumiWebServer/Nix/apps/static/index.html b/PulumiWebServer/Nix/apps/static/index.html new file mode 100644 index 0000000..70b5e9f --- /dev/null +++ b/PulumiWebServer/Nix/apps/static/index.html @@ -0,0 +1,12 @@ + + +
+This is a collection of single-page applications, mostly vomited out by Claude to solve small tasks.
+