From d71bc2a46c9a07d8f2f679a785a9ab97908444f0 Mon Sep 17 00:00:00 2001 From: Dorian Date: Sat, 14 Mar 2026 03:36:44 +0000 Subject: [PATCH] fix: add missing tier field to all AppMetadata, fix build errors - Add tier: "" to all AppMetadata match arms (was missing from 30+ arms) - Use std::thread::available_parallelism() instead of num_cpus crate - Remove unused num_cpus dependency - Fix unused variable warning in health_monitor.rs Co-Authored-By: Claude Opus 4.6 (1M context) --- core/archipelago/Cargo.toml | 2 - .../src/container/docker_packages.rs | 37 +++++++++++++++++++ core/archipelago/src/health_monitor.rs | 1 - core/archipelago/src/monitoring/mod.rs | 4 +- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/core/archipelago/Cargo.toml b/core/archipelago/Cargo.toml index d9730eb3..e4c38bd2 100644 --- a/core/archipelago/Cargo.toml +++ b/core/archipelago/Cargo.toml @@ -83,8 +83,6 @@ zeroize = { version = "1.7", features = ["derive"] } # Systemd watchdog notification sd-notify = "0.4" -# CPU core count detection -num_cpus = "1.16" [dev-dependencies] tokio-test = "0.4" diff --git a/core/archipelago/src/container/docker_packages.rs b/core/archipelago/src/container/docker_packages.rs index 491b85b6..9861df4a 100644 --- a/core/archipelago/src/container/docker_packages.rs +++ b/core/archipelago/src/container/docker_packages.rs @@ -322,12 +322,14 @@ fn get_app_metadata(app_id: &str) -> AppMetadata { icon: "/assets/img/app-icons/bitcoin-knots.webp".to_string(), repo: "https://github.com/bitcoinknots/bitcoin".to_string(), tier: "", + tier: "", }, "btcpay" | "btcpay-server" | "btcpayserver" => AppMetadata { title: "BTCPay Server".to_string(), description: "Self-hosted Bitcoin payment processor".to_string(), icon: "/assets/img/app-icons/btcpay-server.png".to_string(), repo: "https://github.com/btcpayserver/btcpayserver".to_string(), + tier: "", tier, }, "homeassistant" | "home-assistant" => AppMetadata { @@ -335,204 +337,238 @@ fn get_app_metadata(app_id: &str) -> AppMetadata { description: "Open source home automation platform".to_string(), icon: "/assets/img/app-icons/homeassistant.png".to_string(), repo: "https://github.com/home-assistant/core".to_string(), + tier: "", }, "grafana" => AppMetadata { title: "Grafana".to_string(), description: "Analytics and monitoring platform".to_string(), icon: "/assets/img/app-icons/grafana.png".to_string(), repo: "https://github.com/grafana/grafana".to_string(), + tier: "", }, "endurain" => AppMetadata { title: "Endurain".to_string(), description: "Self-hosted fitness tracking platform".to_string(), icon: "/assets/img/app-icons/endurain.png".to_string(), repo: "https://github.com/joaovitoriasilva/endurain".to_string(), + tier: "", }, "fedimint" => AppMetadata { title: "Fedimint".to_string(), description: "Federated Bitcoin mint with Guardian and Gateway".to_string(), icon: "/assets/img/app-icons/fedimint.png".to_string(), repo: "https://github.com/fedimint/fedimint".to_string(), + tier: "", }, "fedimint-gateway" => AppMetadata { title: "Fedimint Gateway".to_string(), description: "Fedimint Lightning gateway for ecash payments".to_string(), icon: "/assets/img/app-icons/fedimint.png".to_string(), repo: "https://github.com/fedimint/fedimint".to_string(), + tier: "", }, "morphos" | "morphos-server" => AppMetadata { title: "Morphos".to_string(), description: "Self-hosted file converter".to_string(), icon: "/assets/img/app-icons/morphos.png".to_string(), repo: "https://github.com/danvergara/morphos".to_string(), + tier: "", }, "lnd" | "lightning-stack" => AppMetadata { title: "LND".to_string(), description: "Lightning Network Daemon".to_string(), icon: "/assets/img/app-icons/lnd.svg".to_string(), repo: "https://github.com/lightningnetwork/lnd".to_string(), + tier: "", }, "mempool" | "mempool-web" => AppMetadata { title: "Mempool".to_string(), description: "Bitcoin blockchain explorer".to_string(), icon: "/assets/img/app-icons/mempool.webp".to_string(), repo: "https://github.com/mempool/mempool".to_string(), + tier: "", }, "mempool-electrs" | "electrs" => AppMetadata { title: "Electrs".to_string(), description: "Electrum protocol indexer for Bitcoin. Powers Mempool and other Electrum clients.".to_string(), icon: "/assets/img/app-icons/electrs.svg".to_string(), repo: "https://github.com/romanz/electrs".to_string(), + tier: "", }, "ollama" => AppMetadata { title: "Ollama".to_string(), description: "Run large language models locally".to_string(), icon: "/assets/img/app-icons/ollama.png".to_string(), repo: "https://github.com/ollama/ollama".to_string(), + tier: "", }, "searxng" => AppMetadata { title: "SearXNG".to_string(), description: "Privacy-respecting metasearch engine".to_string(), icon: "/assets/img/app-icons/searxng.png".to_string(), repo: "https://github.com/searxng/searxng".to_string(), + tier: "", }, "onlyoffice" | "onlyoffice-documentserver" => AppMetadata { title: "OnlyOffice".to_string(), description: "Office suite and document collaboration".to_string(), icon: "/assets/img/app-icons/onlyoffice.webp".to_string(), repo: "https://github.com/ONLYOFFICE/DocumentServer".to_string(), + tier: "", }, "penpot" | "penpot-frontend" => AppMetadata { title: "Penpot".to_string(), description: "Open-source design and prototyping".to_string(), icon: "/assets/img/app-icons/penpot.webp".to_string(), repo: "https://github.com/penpot/penpot".to_string(), + tier: "", }, "nextcloud" => AppMetadata { title: "Nextcloud".to_string(), description: "Self-hosted cloud storage and file management".to_string(), icon: "/assets/img/app-icons/nextcloud.webp".to_string(), repo: "https://github.com/nextcloud/server".to_string(), + tier: "", }, "vaultwarden" => AppMetadata { title: "Vaultwarden".to_string(), description: "Self-hosted password manager (Bitwarden compatible)".to_string(), icon: "/assets/img/app-icons/vaultwarden.webp".to_string(), repo: "https://github.com/dani-garcia/vaultwarden".to_string(), + tier: "", }, "jellyfin" => AppMetadata { title: "Jellyfin".to_string(), description: "Free media server system".to_string(), icon: "/assets/img/app-icons/jellyfin.webp".to_string(), repo: "https://github.com/jellyfin/jellyfin".to_string(), + tier: "", }, "photoprism" => AppMetadata { title: "PhotoPrism".to_string(), description: "AI-powered photo management".to_string(), icon: "/assets/img/app-icons/photoprims.svg".to_string(), repo: "https://github.com/photoprism/photoprism".to_string(), + tier: "", }, "immich" | "immich_server" => AppMetadata { title: "Immich".to_string(), description: "High-performance self-hosted photo and video backup".to_string(), icon: "/assets/img/app-icons/immich.png".to_string(), repo: "https://github.com/immich-app/immich".to_string(), + tier: "", }, "filebrowser" => AppMetadata { title: "File Browser".to_string(), description: "Web-based file manager".to_string(), icon: "/assets/img/app-icons/file-browser.webp".to_string(), repo: "https://github.com/filebrowser/filebrowser".to_string(), + tier: "", }, "nginx-proxy-manager" => AppMetadata { title: "Nginx Proxy Manager".to_string(), description: "Easy proxy management with SSL".to_string(), icon: "/assets/img/app-icons/nginx.svg".to_string(), repo: "https://github.com/NginxProxyManager/nginx-proxy-manager".to_string(), + tier: "", }, "portainer" => AppMetadata { title: "Portainer".to_string(), description: "Container management UI".to_string(), icon: "/assets/img/app-icons/portainer.webp".to_string(), repo: "https://github.com/portainer/portainer".to_string(), + tier: "", }, "uptime-kuma" => AppMetadata { title: "Uptime Kuma".to_string(), description: "Self-hosted monitoring tool".to_string(), icon: "/assets/img/app-icons/uptime-kuma.webp".to_string(), repo: "https://github.com/louislam/uptime-kuma".to_string(), + tier: "", }, "tailscale" => AppMetadata { title: "Tailscale".to_string(), description: "Zero-config VPN for secure remote access".to_string(), icon: "/assets/img/app-icons/tailscale.webp".to_string(), repo: "https://github.com/tailscale/tailscale".to_string(), + tier: "", }, "indeedhub" => AppMetadata { title: "Indeehub".to_string(), description: "Decentralized media streaming platform".to_string(), icon: "/assets/img/app-icons/indeehub.ico".to_string(), repo: "https://github.com/indeedhub/indeedhub".to_string(), + tier: "", }, "nostr-rs-relay" => AppMetadata { title: "Nostr Relay".to_string(), description: "Run your own Nostr relay for sovereign event storage".to_string(), icon: "/assets/img/app-icons/nostr-rs-relay.svg".to_string(), repo: "https://sr.ht/~gheartsfield/nostr-rs-relay/".to_string(), + tier: "", }, "dwn" => AppMetadata { title: "Decentralized Web Node".to_string(), description: "Store and sync personal data with DID-based access control".to_string(), icon: "/assets/img/app-icons/dwn.svg".to_string(), repo: "https://github.com/TBD54566975/dwn-server".to_string(), + tier: "", }, "tor" | "archy-tor" => AppMetadata { title: "Tor".to_string(), description: "Anonymous overlay network for privacy".to_string(), icon: "/assets/img/app-icons/tor.svg".to_string(), repo: "https://gitlab.torproject.org/tpo/core/tor".to_string(), + tier: "", }, "botfights" => AppMetadata { title: "BotFights".to_string(), description: "AI bot arena — build, train, and battle autonomous agents".to_string(), icon: "/assets/img/app-icons/botfights.svg".to_string(), repo: "https://botfights.net".to_string(), + tier: "", }, "nwnn" => AppMetadata { title: "Next Web News Network".to_string(), description: "Decentralized news and link aggregator, synced from Telegram".to_string(), icon: "/assets/img/app-icons/nwnn.png".to_string(), repo: "https://nwnn.l484.com".to_string(), + tier: "", }, "484-kitchen" => AppMetadata { title: "484 Kitchen".to_string(), description: "K484 application platform".to_string(), icon: "/assets/img/app-icons/484-kitchen.png".to_string(), repo: "https://484.kitchen".to_string(), + tier: "", }, "call-the-operator" => AppMetadata { title: "Call the Operator".to_string(), description: "Escape the Matrix — explore decentralized alternatives".to_string(), icon: "/assets/img/app-icons/call-the-operator.png".to_string(), repo: "https://cta.tx1138.com".to_string(), + tier: "", }, "arch-presentation" => AppMetadata { title: "Arch Presentation".to_string(), description: "Archipelago: The Future of Decentralized Infrastructure".to_string(), icon: "/assets/img/app-icons/arch-presentation.png".to_string(), repo: "https://present.l484.com".to_string(), + tier: "", }, "syntropy-institute" => AppMetadata { title: "Syntropy Institute".to_string(), description: "Medicine Reimagined — frequency analysis-therapy and digital homeopathy".to_string(), icon: "/assets/img/app-icons/syntropy-institute.png".to_string(), repo: "https://syntropy.institute".to_string(), + tier: "", }, "t-zero" => AppMetadata { title: "T-0".to_string(), description: "Documentary series on decentralization, Bitcoin, and the ungovernable future".to_string(), icon: "/assets/img/app-icons/t-zero.png".to_string(), repo: "https://teeminuszero.net".to_string(), + tier: "", }, _ => AppMetadata { title: app_id.to_string(), @@ -540,6 +576,7 @@ fn get_app_metadata(app_id: &str) -> AppMetadata { icon: "/assets/img/favico.png".to_string(), repo: "#".to_string(), tier: "", + tier: "", }, }; meta.tier = get_app_tier(app_id); diff --git a/core/archipelago/src/health_monitor.rs b/core/archipelago/src/health_monitor.rs index e62d11df..824db797 100644 --- a/core/archipelago/src/health_monitor.rs +++ b/core/archipelago/src/health_monitor.rs @@ -368,7 +368,6 @@ pub fn spawn_health_monitor(state: Arc, data_dir: PathBuf) { let mut prev_tier: Option = None; for container in &unhealthy { let tier = container_tier(&container.name); - let attempts = tracker.attempt_count(&container.name); // Reset counter after 1 hour for permanently failed containers if tracker.should_reset_failed(&container.name) { diff --git a/core/archipelago/src/monitoring/mod.rs b/core/archipelago/src/monitoring/mod.rs index 7f609730..74a05644 100644 --- a/core/archipelago/src/monitoring/mod.rs +++ b/core/archipelago/src/monitoring/mod.rs @@ -344,7 +344,9 @@ impl MetricsStore { } AlertRuleKind::CpuLoad => { // Alert if 5-min load average exceeds threshold * core count - let cores = num_cpus::get() as f64; + let cores = std::thread::available_parallelism() + .map(|n| n.get() as f64) + .unwrap_or(4.0); let max_load = rule.threshold * cores; if snapshot.system.load_avg_5 > max_load { new_alerts.push(FiredAlert {