From d2c5448565eb72d3dbe8b796dbf19f5ad43fda70 Mon Sep 17 00:00:00 2001 From: Yin Kou Date: Fri, 6 Nov 2026 23:20:47 +0800 Subject: [PATCH] feat(dashboard): deploy open-source Homepage (3002) and Glance (3003) connected to live telemetry --- stacks/glance/config/glance.yml | 122 ++++++++++++++++++++++++ stacks/glance/docker-compose.yml | 14 +++ stacks/homepage/config/bookmarks.yaml | 22 +++++ stacks/homepage/config/docker.yaml | 3 + stacks/homepage/config/services.yaml | 128 ++++++++++++++++++++++++++ stacks/homepage/config/settings.yaml | 20 ++++ stacks/homepage/config/widgets.yaml | 21 +++++ stacks/homepage/docker-compose.yml | 15 +++ stacks/portal/server.py | 2 +- 9 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 stacks/glance/config/glance.yml create mode 100644 stacks/glance/docker-compose.yml create mode 100644 stacks/homepage/config/bookmarks.yaml create mode 100644 stacks/homepage/config/docker.yaml create mode 100644 stacks/homepage/config/services.yaml create mode 100644 stacks/homepage/config/settings.yaml create mode 100644 stacks/homepage/config/widgets.yaml create mode 100644 stacks/homepage/docker-compose.yml diff --git a/stacks/glance/config/glance.yml b/stacks/glance/config/glance.yml new file mode 100644 index 0000000..0fd01fb --- /dev/null +++ b/stacks/glance/config/glance.yml @@ -0,0 +1,122 @@ +theme: + background-color: 240 10 4 + primary-color: 210 90 65 + contrast-multiplier: 1.2 + +pages: + - name: HomeLab 中控台 + columns: + - size: small + widgets: + - type: clock + hour-format: 24h + timezones: + - timezone: Asia/Shanghai + label: 中国标准时间 + - timezone: Asia/Singapore + label: 新加坡节点 + + - type: weather + location: Hangzhou, China + units: metric + hour-format: 24h + + - type: docker-containers + title: OrbStack 运行容器 + + - size: full + widgets: + - type: search + search-engine: google + autofocus: false + + - type: monitor + cache: 10s + title: 全屋核心服务矩阵 (点击直达) + sites: + - title: AGY 云端工作台 (24h Web 终端) + url: https://agy.961504.xyz + check-url: http://host.docker.internal:7681 + icon: si:gnometerminal + - title: 极空间 Z4 私有云 (20TB 存储) + url: https://z4.home.961504.xyz:10443 + check-url: http://host.docker.internal:3004/api/telemetry + icon: si:synology + - title: Vaultwarden 密码保险箱 + url: https://vw.961504.xyz + check-url: http://host.docker.internal:8222 + icon: si:bitwarden + - title: Mihomo 路由分流面板 + url: https://clash.home.961504.xyz:10443/ui/ + check-url: http://host.docker.internal:3004/api/telemetry + icon: si:cloudflare + - title: 小米主路由器后台 + url: https://router.home.961504.xyz:10443 + check-url: http://host.docker.internal:3004/api/telemetry + icon: si:xiaomi + - title: Uptime Kuma 外部哨兵 + url: https://status.961504.xyz + check-url: https://status.961504.xyz + icon: si:uptimekuma + + - type: custom-api + title: 全屋硬件与 AI 专线实时状态 + cache: 3s + url: http://host.docker.internal:3004/api/telemetry + template: | +
+
+
🖥️ M6 Mac mini
+
IP: {{ .JSON.String "mini.ip" }} · UP {{ .JSON.String "mini.uptime" }}
+
+
CPU 负载: {{ .JSON.Float "mini.cpu_pct" }}%
+
统一内存: {{ .JSON.Float "mini.mem_used_gb" }} / 24 GB ({{ .JSON.Float "mini.mem_pct" }}%)
+
NVMe 闪存: {{ .JSON.Float "mini.disk_used_gb" }} / {{ .JSON.Float "mini.disk_total_gb" }} GB
+
+
+
+
💾 极空间 Z4 (20TB)
+
IP: {{ .JSON.String "nas.ip" }} · SMB 已挂载 ~/nas
+
+
剩余可用: {{ .JSON.Float "nas.free_tb" }} TB
+
已用空间: {{ .JSON.Float "nas.used_tb" }} TB ({{ .JSON.Float "nas.pct" }}%)
+
最近灾备: {{ .JSON.String "nas.latest_backup" }}
+
+
+
+
🛡️ AI 狮城专线 & 家宽
+
{{ .JSON.String "network.ai_policy" }}
+
+
AI 锁定出口: {{ .JSON.String "network.sg_egress_ip" }}
+
狮城延迟: {{ .JSON.Int "network.sg_delay_ms" }} ms ({{ .JSON.String "network.sg_node" }})
+
家里联通公网: {{ .JSON.String "network.home_wan_ip" }}
+
+
+
+ + - type: bookmarks + groups: + - title: 443 免端口直达 (全网通用) + links: + - title: AGY 云端工作台 + url: https://agy.961504.xyz + - title: Vaultwarden 密码库 + url: https://vw.961504.xyz + - title: Uptime Kuma 监控 + url: https://status.961504.xyz + - title: 10443 家宽公网直连 + links: + - title: 极空间 Z4 + url: https://z4.home.961504.xyz:10443 + - title: AGY 工作台 (10443) + url: https://agy.home.961504.xyz:10443 + - title: Mihomo 面板 + url: https://clash.home.961504.xyz:10443/ui/ + - title: 局域网原生极速 (192.168.31.x) + links: + - title: AGY 终端 (7681) + url: http://192.168.31.164:7681 + - title: 极空间 (5055) + url: http://192.168.31.185:5055 + - title: 小米路由器 (31.1) + url: http://192.168.31.1 diff --git a/stacks/glance/docker-compose.yml b/stacks/glance/docker-compose.yml new file mode 100644 index 0000000..67d2434 --- /dev/null +++ b/stacks/glance/docker-compose.yml @@ -0,0 +1,14 @@ +services: + glance: + image: glanceapp/glance:latest + container_name: glance + restart: unless-stopped + ports: + - "3003:8080" + extra_hosts: + - "host.docker.internal:host-gateway" + environment: + - TZ=Asia/Shanghai + volumes: + - ./config:/app/config + - /var/run/docker.sock:/var/run/docker.sock:ro diff --git a/stacks/homepage/config/bookmarks.yaml b/stacks/homepage/config/bookmarks.yaml new file mode 100644 index 0000000..ae310b1 --- /dev/null +++ b/stacks/homepage/config/bookmarks.yaml @@ -0,0 +1,22 @@ +--- +- 开发与终端快捷入口: + - AGY 免端口直达 (443): + - abbr: AGY + href: https://agy.961504.xyz + - AGY 家宽直连 (10443): + - abbr: 10443 + href: https://agy.home.961504.xyz:10443 + - AGY 局域网直连: + - abbr: LAN + href: http://192.168.31.164:7681 + +- 存储与密码库备用入口: + - 极空间局域网直连: + - abbr: Z4 + href: http://192.168.31.185:5055 + - Vaultwarden 家宽直连: + - abbr: VW + href: https://vw.home.961504.xyz:10443 + - Vaultwarden 管理后台: + - abbr: ADM + href: https://vw.961504.xyz/admin diff --git a/stacks/homepage/config/docker.yaml b/stacks/homepage/config/docker.yaml new file mode 100644 index 0000000..05c8b2d --- /dev/null +++ b/stacks/homepage/config/docker.yaml @@ -0,0 +1,3 @@ +--- +my-docker: + socket: /var/run/docker.sock diff --git a/stacks/homepage/config/services.yaml b/stacks/homepage/config/services.yaml new file mode 100644 index 0000000..53ee376 --- /dev/null +++ b/stacks/homepage/config/services.yaml @@ -0,0 +1,128 @@ +--- +- 全屋硬件与专线实时遥测: + - Apple M6 Mac mini: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/apple.png + href: https://agy.961504.xyz + description: 192.168.31.164 · 12核 M6 / 24GB / 512GB + siteMonitor: http://host.docker.internal:3004/api/telemetry + widget: + type: customapi + url: http://host.docker.internal:3004/api/telemetry + refreshInterval: 3000 + mappings: + - field: + mini: cpu_pct + label: CPU 负载 + format: percent + - field: + mini: mem_used_gb + label: 已用内存 (24GB) + format: float + suffix: " GB" + - field: + mini: disk_pct + label: SSD 占用 + format: percent + - field: + mini: uptime + label: 运行时长 + format: text + + - 极空间 Z4 存储池 (20TB): + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/synology-drive.png + href: https://z4.home.961504.xyz:10443 + description: 192.168.31.185 · SMB 已挂载至 ~/nas + siteMonitor: http://192.168.31.185:5055 + widget: + type: customapi + url: http://host.docker.internal:3004/api/telemetry + refreshInterval: 5000 + mappings: + - field: + nas: free_tb + label: 剩余可用 + format: float + suffix: " TB" + - field: + nas: used_tb + label: 已用空间 + format: float + suffix: " TB" + - field: + nas: pct + label: 使用率 + format: percent + - field: + nas: latest_backup + label: 最近灾备 + format: text + + - 狮城 AI 专线 & 家宽网关: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/tailscale.png + href: https://clash.home.961504.xyz:10443/ui/ + description: AGY 锁定新加坡 Azure (104.43.105.243) + siteMonitor: http://192.168.31.1:9999 + widget: + type: customapi + url: http://host.docker.internal:3004/api/telemetry + refreshInterval: 5000 + mappings: + - field: + network: ai_policy + label: AI 路由策略 + format: text + - field: + network: sg_egress_ip + label: 锁定出口 IP + format: text + - field: + network: sg_delay_ms + label: 狮城延迟 + format: number + suffix: " ms" + - field: + network: home_wan_ip + label: 家宽公网 IP + format: text + +- 核心工作台与私有云: + - AGY 云端工作台: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/iterm2.png + href: https://agy.961504.xyz + description: 24h 常驻 Web 终端 (ttyd + tmux · 关窗不断连) + siteMonitor: http://host.docker.internal:7681 + + - 极空间 Z4 私有云: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/plex.png + href: https://z4.home.961504.xyz:10443 + description: 20TB 极影视蓝光影院 / 手机相册备份 / 文件管理 + siteMonitor: http://192.168.31.185:5055 + + - Vaultwarden 密码库: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/vaultwarden.png + href: https://vw.961504.xyz + description: Bitwarden 自托管私人密码保险箱 (每日自动备份至极空间) + server: my-docker + container: vaultwarden + +- 网络路由与外部哨兵: + - Mihomo 路由分流面板: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/clash.png + href: https://clash.home.961504.xyz:10443/ui/ + description: 小米路由器 ShellCrash 透明网关控制台 + siteMonitor: http://192.168.31.1:9999 + widget: + type: clash + url: http://192.168.31.1:9999 + + - 小米主路由器后台: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/openwrt.png + href: https://router.home.961504.xyz:10443 + description: 192.168.31.1 · PPPoE 拨号 / DHCP / 端口转发 + siteMonitor: http://192.168.31.1 + + - Uptime Kuma 外部哨兵: + icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/uptime-kuma.png + href: https://status.961504.xyz + description: 新加坡 Azure 24h 外部断网监控哨兵 + siteMonitor: https://status.961504.xyz diff --git a/stacks/homepage/config/settings.yaml b/stacks/homepage/config/settings.yaml new file mode 100644 index 0000000..df0280a --- /dev/null +++ b/stacks/homepage/config/settings.yaml @@ -0,0 +1,20 @@ +--- +title: HomeLab +favicon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/apple.png +theme: dark +color: zinc +headerStyle: clean +statusStyle: dot +hideVersion: true +useEqualHeights: true + +layout: + 全屋硬件与专线实时遥测: + style: row + columns: 3 + 核心工作台与私有云: + style: row + columns: 3 + 网络路由与外部哨兵: + style: row + columns: 3 diff --git a/stacks/homepage/config/widgets.yaml b/stacks/homepage/config/widgets.yaml new file mode 100644 index 0000000..9314182 --- /dev/null +++ b/stacks/homepage/config/widgets.yaml @@ -0,0 +1,21 @@ +--- +- datetime: + text_size: xl + format: + dateStyle: medium + timeStyle: short + hourCycle: h23 + +- openmeteo: + label: 实时天气 + latitude: 30.2741 + longitude: 120.1551 + timezone: Asia/Shanghai + units: metric + cache: 5 + +- search: + provider: google + focus: false + showSearchSuggestions: true + target: _blank diff --git a/stacks/homepage/docker-compose.yml b/stacks/homepage/docker-compose.yml new file mode 100644 index 0000000..c681d5e --- /dev/null +++ b/stacks/homepage/docker-compose.yml @@ -0,0 +1,15 @@ +services: + homepage: + image: ghcr.io/gethomepage/homepage:latest + container_name: homepage + restart: unless-stopped + ports: + - "3002:3000" + extra_hosts: + - "host.docker.internal:host-gateway" + environment: + - HOMEPAGE_ALLOWED_HOSTS=* + - TZ=Asia/Shanghai + volumes: + - ./config:/app/config + - /var/run/docker.sock:/var/run/docker.sock:ro diff --git a/stacks/portal/server.py b/stacks/portal/server.py index b4948e4..08cc0d6 100755 --- a/stacks/portal/server.py +++ b/stacks/portal/server.py @@ -15,7 +15,7 @@ from concurrent.futures import ThreadPoolExecutor from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path -PORT = int(os.environ.get("PORT", "3002")) +PORT = int(os.environ.get("PORT", "3004")) BASE_DIR = Path(__file__).resolve().parent INDEX_FILE = BASE_DIR / "index.html"