setup things
change
commit 811fa8f96b221205f064d9fe43b4386a297df30c
author Alpha Chen <alpha@kejadlen.dev>
date
parent ed14b4ff
diff --git a/lotus-land-story/caddy.yml b/lotus-land-story/caddy.yml
index 3d0c08c..6d7e7e4 100644
--- a/lotus-land-story/caddy.yml
+++ b/lotus-land-story/caddy.yml
@@ -1,6 +1,3 @@
-# The root certificate for local HTTPS is located here:
-#   /mnt/lotus-land-story/caddy/data/caddy/pki/authorities/local/root.crt
-
 - name: Set up Caddy
   hosts: lotus-land-story
   vars_files:
@@ -33,10 +30,6 @@
       vars:
         trusted_proxies: "{{ docker_network.network.IPAM.Config[0].Subnet }}"
 
-    - name: Create Caddy volume
-      community.docker.docker_volume:
-        name: caddy
-
     - name: Run Caddy
       community.docker.docker_container:
         name: caddy
diff --git a/lotus-land-story/setup.yml b/lotus-land-story/setup.yml
new file mode 100644
index 0000000..2a4cd5e
--- /dev/null
+++ b/lotus-land-story/setup.yml
@@ -0,0 +1,22 @@
+- name: Set up setup
+  hosts: lotus-land-story
+  # vars_files:
+  #   - vars.yml
+  # vars:
+  #   version: 2.9.1
+  tasks:
+
+    - name: Copy files
+      ansible.builtin.copy:
+        src: templates/setup
+        dest: /mnt/lotus-land-story/caddy/data
+        mode: '0400'
+
+    - name: Copy cert
+      ansible.builtin.copy:
+        src: /mnt/lotus-land-story/caddy/data/caddy/pki/authorities/local/root.crt
+        dest: /mnt/lotus-land-story/caddy/data/setup/root.pem
+        remote_src: true
+        mode: '0400'
+
+# vim: ft=yaml.ansible
diff --git a/lotus-land-story/templates/Caddyfile b/lotus-land-story/templates/Caddyfile
index 0ace02f..0ba6531 100644
--- a/lotus-land-story/templates/Caddyfile
+++ b/lotus-land-story/templates/Caddyfile
@@ -92,22 +92,55 @@ hey.kejadlen.dev
 	}
 }
 
-cadvisor.kejadlen.dev {
-	forward_auth authelia:9091 {
-		uri /api/verify?rd=https://auth.{{ domain }}
-		copy_headers Remote-User
+cadvisor {
+	tls internal
+	bind tailscale/cadvisor
+	reverse_proxy cadvisor:8080
+}
 
-		# This import needs to be included if you're relying on a trusted proxies configuration.
-		import trusted_proxy_list
+# cert {
+# 	tls internal
+# 	bind tailscale/cert
+# 	tailscale_auth
+# 	file_server {
+# 		root /data/caddy/pki/authorities/local
+# 	}
+# 	uri path_regexp pem$ crt
+# }
+
+http://config {
+	bind tailscale/config
+	tailscale_auth
+	file_server {
+		root /data/config
+		browse
+	}
+}
+
+http://setup {
+	bind tailscale/setup
+	tailscale_auth
+	file_server {
+		root /data/setup
 	}
+}
 
-	reverse_proxy cadvisor:8080 {
-		import trusted_proxy_list
+caddytest {
+	log
+	tls internal
+	bind tailscale/caddytest
+	tailscale_auth
+	reverse_proxy localhost:3333 {
+		header_up Remote-User {http.auth.user.tailscale_login}
+		header_up X-Webauth-User {http.auth.user.tailscale_login}
+		header_up X-Tailscale-Tailnet {http.auth.user.tailscale_tailnet}
 	}
 }
 
-links.kejadlen.dev {
-	reverse_proxy linkding:9090
+:3333 {
+	log
+	templates
+	respond `Hello, {{ '{{' }}.Req.Header.Get "Remote-User"}} from {{ '{{' }}.Req.Header.Get "X-Tailscale-Tailnet"}}`
 }
 
 # vim: ts=4
diff --git a/lotus-land-story/templates/setup/index.html b/lotus-land-story/templates/setup/index.html
new file mode 100644
index 0000000..d3e7545
--- /dev/null
+++ b/lotus-land-story/templates/setup/index.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<html lang="en-US">
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width" />
+    <title>Chislan Family Setup</title>
+    <style>
+      /* https://perfectmotherfuckingwebsite.com/ */
+      body {
+          max-width: 650px;
+          margin: 40px auto;
+          padding: 0 10px;
+          font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
+          color: #444
+      }
+
+      h1,h2,h3 {
+          line-height: 1.2
+      }
+
+      @media (prefers-color-scheme: dark) {
+          body {
+              color:#c9d1d9;
+              background: #0d1117
+          }
+
+          a:link {
+              color: #58a6ff
+          }
+
+          a:visited {
+              color: #8e96f0
+          }
+      }
+    </style>
+  </head>
+  <body>
+    <h1>Chislan Family Setup</h1>
+    <ol>
+      <li>Download <a href="root.pem">root.pem</a></li>
+      <li>Open Settings -&gt; Profile Downloaded</li>
+      <li>Install the profile</li>
+      <li>Open Settings -&gt; General -&gt; About -&gt; Certificate Trust Settings</li>
+      <li>Enable full trust for the Caddy Local Authority root certificate</li>
+    </ol>
+  </body>
+</html>
diff --git a/main.tf b/main.tf
index 9823fe1..69b9f5d 100644
--- a/main.tf
+++ b/main.tf
@@ -89,9 +89,7 @@ resource "linode_domain" "chislan_family" {
 }
 
 resource "pihole_dns_record" "rss" {
-  for_each = toset([
-    "rss",
-  ])
+  for_each = toset([])
 
   domain = each.key
   ip     = data.tailscale_device.lotus_land_story.addresses.0