about summary refs log tree commit diff
path: root/ops
diff options
context:
space:
mode:
authorLuke Granger-Brown <hg@lukegb.com>2020-07-06T22·18+0000
committerlukegb <lukegb@tvl.fyi>2020-07-06T22·48+0000
commitaae3d25234cea89b69824a6ed8b7994350a32247 (patch)
treefd4628d8cd84f1341f5c7aa7bca4eaddc428321c /ops
parent310302637bf1e6f53117b8a400ffa02567d41cb1 (diff)
feat(ops/nixos/www): create login.tvl.fyi host r/1230
Change-Id: Ifad80915a61a1a5ac14e598a9d788aec3482693c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/936
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'ops')
-rw-r--r--ops/nixos/whitby/default.nix6
-rw-r--r--ops/nixos/www/base.nix14
-rw-r--r--ops/nixos/www/login.tvl.fyi.nix23
3 files changed, 43 insertions, 0 deletions
diff --git a/ops/nixos/whitby/default.nix b/ops/nixos/whitby/default.nix
index b1055ddd2ee1..e80d5885e1a0 100644
--- a/ops/nixos/whitby/default.nix
+++ b/ops/nixos/whitby/default.nix
@@ -17,6 +17,7 @@ in {
   imports = [
     "${depot.depotPath}/ops/nixos/depot.nix"
     "${depot.depotPath}/ops/nixos/tvl-slapd/default.nix"
+    "${depot.depotPath}/ops/nixos/www/login.tvl.fyi.nix"
   ];
 
   hardware = {
@@ -202,5 +203,10 @@ in {
     };
   };
 
+  security.acme = {
+    acceptTerms = true;
+    email = "mail@tazj.in";
+  };
+
   system.stateVersion = "20.03";
 }
diff --git a/ops/nixos/www/base.nix b/ops/nixos/www/base.nix
new file mode 100644
index 000000000000..a15db6bb8a32
--- /dev/null
+++ b/ops/nixos/www/base.nix
@@ -0,0 +1,14 @@
+{ config, ... }:
+
+{
+  config = {
+    services.nginx = {
+      enable = true;
+      enableReload = true;
+
+      recommendedTlsSettings = true;
+      recommendedGzipSettings = true;
+      recommendedProxySettings = true;
+    };
+  };
+}
diff --git a/ops/nixos/www/login.tvl.fyi.nix b/ops/nixos/www/login.tvl.fyi.nix
new file mode 100644
index 000000000000..8513c6e660c5
--- /dev/null
+++ b/ops/nixos/www/login.tvl.fyi.nix
@@ -0,0 +1,23 @@
+{ ... }:
+
+{
+  imports = [
+    ./base.nix
+  ];
+
+  config = {
+    services.nginx.virtualHosts."login.tvl.fyi" = {
+      serverName = "login.tvl.fyi";
+      enableACME = true;
+      forceSSL = true;
+
+      extraConfig = ''
+        location / {
+          proxy_pass http://localhost:8443;
+          proxy_set_header X-Forwarded-For $remote_addr;
+          proxy_set_header Host $host;
+        }
+      '';
+    };
+  };
+}