From d4772acd3880d5bb4b5f7b958b4dd2186a85dd94 Mon Sep 17 00:00:00 2001 From: Gabriel Simmer Date: Mon, 8 Jan 2024 17:08:31 +0000 Subject: [PATCH] Restart homepage deployment on config change --- homelab/custom.nix | 5 + homelab/homepage.nix | 546 ++++++++++++++++++++++--------------------- 2 files changed, 287 insertions(+), 264 deletions(-) diff --git a/homelab/custom.nix b/homelab/custom.nix index 123641d..a3eaf10 100644 --- a/homelab/custom.nix +++ b/homelab/custom.nix @@ -1,4 +1,9 @@ { lib, ... }: { + kubernetes.resourceOrder = + [ "CustomResourceDefinition" + "Namespace" + "ConfigMap" + ]; kubernetes.customTypes = [ { name = "servicemonitors"; diff --git a/homelab/homepage.nix b/homelab/homepage.nix index 354f80b..874981b 100644 --- a/homelab/homepage.nix +++ b/homelab/homepage.nix @@ -1,4 +1,279 @@ -{ lib, config, kubenix, ... }: { +{ lib, config, kubenix, ... }: +let homepage-config = { + bookmarks = []; + services = [ + { + Media = [ + { Plex = { + icon = "plex.png"; + href = "https://app.plex.tv"; + description = "Plex"; + widget = { + type = "plex"; + url = "http://vancouver:32400"; + key = "{{HOMEPAGE_VAR_PLEX_KEY}}"; + }; + }; + } + { Overseerr = { + icon = "overseerr.png"; + href = "https://request-media.gmem.ca"; + description = "Request movies and TV shows"; + widget = { + type = "overseerr"; + url = "https://request-media.gmem.ca"; + key = "{{HOMEPAGE_VAR_OVERSEERR_KEY}}"; + }; + }; + } + { Transmission = { + icon = "transmission.png"; + description = "Download progress for torrents"; + widget = { + type = "transmission"; + url = "http://192.168.50.187:9091"; + }; + }; + } + ]; + } + { + "Personal Infrastructure" = [ + { authentik = { + icon = "authentik.png"; + href = "https://authentik.gmem.ca"; + description = "OIDC SSO"; + }; + } + { Tailscale = { + icon = "tailscale.png"; + href = "https://login.tailscale.com"; + description = "VPN provider"; + }; + } + { Git = { + icon = "forgejo.png"; + href = "https://git.gmem.ca"; + description = "Git forge"; + }; + } + { Grafana = { + icon = "grafana.png"; + href = "https://grafana.gmem.ca"; + description = "Monitoring & metrics"; + widget = { + type = "grafana"; + url = "https://grafana.gmem.ca"; + username = "api@localhost"; + password = "{{HOMEPAGE_VAR_GRAFANA_PASSWORD}}"; + }; + }; + } + { NextDNS = { + icon = "nextdns.png"; + href = "https://my.nextdns.io/bcee89/setup"; + description = "DNS provider"; + widget = { + type = "nextdns"; + profile = "bcee89"; + key = "{{HOMEPAGE_VAR_NEXTDNS_KEY}}"; + }; + }; + } + { "Proxmox" = { + icon = "proxmox.png"; + href = "https://proxmox.gmem.ca"; + description = "Homelab proxmox"; + widget = { + type = "proxmox"; + url = "https://proxmox.gmem.ca"; + username = "api@pam!homepage"; + password = "{{HOMEPAGE_VAR_PROXMOX_PASSWORD}}"; + }; + }; + } + { "Immich" = { + icon = "immich.png"; + href = "https://photos.gmem.ca"; + description = "Image hosting"; + widget = { + type = "immich"; + url = "https://photos.gmem.ca"; + key = "{{HOMEPAGE_VAR_IMMICH_KEY}}"; + }; + }; + } + { "NextDNS Tailscale" = { + icon = "nextdns.png"; + href = "https://my.nextdns.io/74c6db/setup"; + description = "Tailnet DNS provider"; + widget = { + type = "nextdns"; + profile = "74c6db"; + key = "{{HOMEPAGE_VAR_NEXTDNS_KEY}}"; + }; + }; + } + ]; + } + { + Reading = [ + { FreshRSS = { + icon = "freshrss.png"; + href = "https://freshrss.gmem.ca"; + description = "FreshRSS RSS Reader"; + widget = { + type = "freshrss"; + url = "https://freshrss.gmem.ca"; + username = "arch"; + password = "{{HOMEPAGE_VAR_FRESHRSS_PASSWORD}}"; + }; + }; + } + { "Lobste.rs" = { + href = "https://lobste.rs"; + description = "News aggregator"; + }; + } + { "Hacker News" = { + href = "https://news.ycombinator.com"; + description = "VC news aggregator"; + }; + } + ]; + } + { + "Floofy.tech Infrastructure" = [ + { Mastodon = { + icon = "mastodon.png"; + href = "https://floofy.tech"; + description = "Primary Mastodon instance"; + widget = { + type = "mastodon"; + url = "https://floofy.tech"; + }; + }; + } + { Grafana = { + icon = "grafana.png"; + href = "https://grafana.services.floofy.tech"; + description = "Metrics and Monitoring"; + }; + } + { vSphere = { + icon = "vmware-esxi.png"; + href = "https://vcenter.services.floofy.tech"; + description = "Hypervisor Manager"; + }; + } + { "vrclub.social" = { + icon = "calckey.png"; + href = "https://vrclub.social"; + description = "Firefish instance for VR clubs"; + }; + } + ]; + } + { + "Tools" = [ + { "IT Tools" = { + icon = "it-tools.png"; + href = "https://tools.gmem.ca"; + description = "Various useful tools"; + }; + } + { Cyberchef = { + icon = "cyberchef.png"; + href = "https://gchq.github.io/CyberChef/"; + description = "More useful tools, mostly text manipulation"; + }; + } + ]; + } + { + "Backup Status" = [ + { "gsimmer backups" = { + icon = "healthchecks.png"; + href = "https://healthchecks.gmem.ca"; + description = "Uptime monitor for recurring tasks"; + widget = { + type = "healthchecks"; + url = "https://healthchecks.gmem.ca"; + key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; + uuid = "617d460f-69f6-444f-852a-421861543327"; + }; + }; + } + { "becki backups" = { + icon = "healthchecks.png"; + href = "https://healthchecks.gmem.ca"; + description = "Uptime monitor for recurring tasks"; + widget = { + type = "healthchecks"; + url = "https://healthchecks.gmem.ca"; + key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; + uuid = "9d01d3dd-2a56-4c70-9b5c-9cb99a1466db"; + }; + }; + } + { "apps backups" = { + icon = "healthchecks.png"; + href = "https://healthchecks.gmem.ca"; + description = "Uptime monitor for recurring tasks"; + widget = { + type = "healthchecks"; + url = "https://healthchecks.gmem.ca"; + key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; + uuid = "37a854b0-9191-4452-aa30-df3969d59b09"; + }; + }; + } + ]; + } + ]; + settings = { + title = "Arch's Homepage"; + providers.openweathermap = "{{HOMEPAGE_VAR_WEATHER_KEY}}"; + background = { + image = "https://images.unsplash.com/photo-1502790671504-542ad42d5189?auto=format&fit=crop&w=2560&q=80"; + blur = "sm"; + opacity = 50; + }; + base = "https://home.gmem.ca"; + layout.Media.style = "row"; + layout.Media.columns = "3"; + layout."Personal Infrastructure".style = "row"; + layout."Personal Infrastructure".columns = "3"; + layout."Backup Status".style = "row"; + layout."Backup Status".columns = "3"; + }; + kubernetes.mode = "cluster"; + widgets = [ + { + logo.icon = "https://gmem.ca/avatar.png"; + } + { + kubernetes = { + cluster.show = true; + nodes.show = true; + }; + } + { + search = { + provider = "duckduckgo"; + }; + } + { + openweathermap = { + provider = "openweathermap"; + cache = 5; + units = "metric"; + }; + } + ]; + }; +in +{ kubernetes.helm.releases.homepage = { chart = kubenix.lib.helm.fetch { repo = "https://jameswynn.github.io/helm-charts"; @@ -15,6 +290,7 @@ }; serviceAccount.create = true; enableRbac = true; + config = homepage-config; ingress.main = { enabled = true; ingressClassName = "nginx"; @@ -36,273 +312,15 @@ } ]; }; - config = { - bookmarks = []; - services = [ - { - Media = [ - { Plex = { - icon = "plex.png"; - href = "https://app.plex.tv"; - description = "Plex"; - widget = { - type = "plex"; - url = "http://vancouver:32400"; - key = "{{HOMEPAGE_VAR_PLEX_KEY}}"; - }; - }; - } - { Overseerr = { - icon = "overseerr.png"; - href = "https://request-media.gmem.ca"; - description = "Request movies and TV shows"; - widget = { - type = "overseerr"; - url = "https://request-media.gmem.ca"; - key = "{{HOMEPAGE_VAR_OVERSEERR_KEY}}"; - }; - }; - } - { Transmission = { - icon = "transmission.png"; - description = "Download progress for torrents"; - widget = { - type = "transmission"; - url = "http://192.168.50.187:9091"; - }; - }; - } - ]; - } - { - "Personal Infrastructure" = [ - { authentik = { - icon = "authentik.png"; - href = "https://authentik.gmem.ca"; - description = "OIDC SSO"; - }; - } - { Tailscale = { - icon = "tailscale.png"; - href = "https://login.tailscale.com"; - description = "VPN provider"; - }; - } - { Git = { - icon = "forgejo.png"; - href = "https://git.gmem.ca"; - description = "Git forge"; - }; - } - { Grafana = { - icon = "grafana.png"; - href = "https://grafana.gmem.ca"; - description = "Monitoring & metrics"; - widget = { - type = "grafana"; - url = "https://grafana.gmem.ca"; - username = "api@localhost"; - password = "{{HOMEPAGE_VAR_GRAFANA_PASSWORD}}"; - }; - }; - } - { NextDNS = { - icon = "nextdns.png"; - href = "https://my.nextdns.io"; - description = "DNS provider"; - widget = { - type = "nextdns"; - profile = "bcee89"; - key = "{{HOMEPAGE_VAR_NEXTDNS_KEY}}"; - }; - }; - } - { "Proxmox Homelab" = { - icon = "proxmox.png"; - href = "https://proxmox.gmem.ca"; - description = "Homelabe proxmox"; - widget = { - type = "proxmox"; - url = "https://proxmox.gmem.ca"; - username = "api@pam!homepage"; - password = "{{HOMEPAGE_VAR_PROXMOX_PASSWORD}}"; - }; - }; - } - { "Immich" = { - icon = "immich.png"; - href = "https://photos.gmem.ca"; - description = "Image hosting"; - widget = { - type = "immich"; - url = "https://photos.gmem.ca"; - key = "{{HOMEPAGE_VAR_IMMICH_KEY}}"; - }; - }; - } - ]; - } - { - Reading = [ - { FreshRSS = { - icon = "freshrss.png"; - href = "https://freshrss.gmem.ca"; - description = "FreshRSS RSS Reader"; - widget = { - type = "freshrss"; - url = "https://freshrss.gmem.ca"; - username = "arch"; - password = "{{HOMEPAGE_VAR_FRESHRSS_PASSWORD}}"; - }; - }; - } - { "Lobste.rs" = { - href = "https://lobste.rs"; - description = "News aggregator"; - }; - } - { "Hacker News" = { - href = "https://news.ycombinator.com"; - description = "VC news aggregator"; - }; - } - ]; - } - { - "Floofy.tech Infrastructure" = [ - { Mastodon = { - icon = "mastodon.png"; - href = "https://floofy.tech"; - description = "Primary Mastodon instance"; - widget = { - type = "mastodon"; - url = "https://floofy.tech"; - }; - }; - } - { Grafana = { - icon = "grafana.png"; - href = "https://grafana.services.floofy.tech"; - description = "Metrics and Monitoring"; - }; - } - { vSphere = { - icon = "vmware-esxi.png"; - href = "https://vcenter.services.floofy.tech"; - description = "Hypervisor Manager"; - }; - } - { "vrclub.social" = { - icon = "calckey.png"; - href = "https://vrclub.social"; - description = "Firefish instance for VR clubs"; - }; - } - ]; - } - { - "Tools" = [ - { "IT Tools" = { - icon = "it-tools.png"; - href = "https://tools.gmem.ca"; - description = "Various useful tools"; - }; - } - { Cyberchef = { - icon = "cyberchef.png"; - href = "https://gchq.github.io/CyberChef/"; - description = "More useful tools, mostly text manipulation"; - }; - } - ]; - } - { - "Backup Status" = [ - { "gsimmer backups" = { - icon = "healthchecks.png"; - href = "https://healthchecks.gmem.ca"; - description = "Uptime monitor for recurring tasks"; - widget = { - type = "healthchecks"; - url = "https://healthchecks.gmem.ca"; - key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; - uuid = "617d460f-69f6-444f-852a-421861543327"; - }; - }; - } - { "becki backups" = { - icon = "healthchecks.png"; - href = "https://healthchecks.gmem.ca"; - description = "Uptime monitor for recurring tasks"; - widget = { - type = "healthchecks"; - url = "https://healthchecks.gmem.ca"; - key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; - uuid = "9d01d3dd-2a56-4c70-9b5c-9cb99a1466db"; - }; - }; - } - { "apps backups" = { - icon = "healthchecks.png"; - href = "https://healthchecks.gmem.ca"; - description = "Uptime monitor for recurring tasks"; - widget = { - type = "healthchecks"; - url = "https://healthchecks.gmem.ca"; - key = "{{HOMEPAGE_VAR_HEALTHCHECKS_KEY}}"; - uuid = "37a854b0-9191-4452-aa30-df3969d59b09"; - }; - }; - } - ]; - } - ]; - settings = { - title = "Arch's Homepage"; - providers.openweathermap = "{{HOMEPAGE_VAR_WEATHER_KEY}}"; - background = { - image = "https://images.unsplash.com/photo-1502790671504-542ad42d5189?auto=format&fit=crop&w=2560&q=80"; - blur = "sm"; - opacity = 50; - }; - base = "https://home.gmem.ca"; - layout.Media.style = "row"; - layout.Media.columns = "3"; - layout."Personal Infrastructure".style = "row"; - layout."Personal Infrastructure".columns = "3"; - layout."Backup Status".style = "row"; - layout."Backup Status".columns = "3"; - }; - kubernetes.mode = "cluster"; - widgets = [ - { - logo.icon = "https://gmem.ca/avatar.png"; - } - { - kubernetes = { - cluster.show = true; - nodes.show = true; - }; - } - { - search = { - provider = "duckduckgo"; - }; - } - { - openweathermap = { - provider = "openweathermap"; - cache = 5; - units = "metric"; - }; - } - ]; - }; }; }; kubernetes.resources.deployments.homepage = { metadata.namespace = "default"; - spec.template.spec.containers.homepage.envFrom = [ { secretRef.name = "homepage-config"; } ]; + + spec.template = { + metadata.annotations."gmem.ca/homepage-config-hash" = (builtins.hashString "md5" (builtins.toJSON homepage-config)); + spec.containers.homepage.envFrom = [ { secretRef.name = "homepage-config"; } ]; + }; }; }