feat: add app tier system — core/recommended/optional (SCALE-02, SCALE-03)

get_app_tier() classifies all apps:
- core: Bitcoin, LND, Electrs, Mempool, BTCPay, DWN, FileBrowser
- recommended: Fedimint, Grafana, Vaultwarden, Kuma, SearXNG, etc.
- optional: everything else

Tier field added to Manifest struct (data_model.rs) and exposed
via WebSocket package data for frontend tier badges.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian 2026-03-14 03:27:51 +00:00
parent 7442f17a10
commit a38cd87fbb
4 changed files with 40 additions and 5 deletions

View File

@ -1030,6 +1030,7 @@ fn create_installing_entry(package_id: &str) -> PackageDataEntry {
author: None,
website: None,
interfaces: None,
tier: None,
},
installed: None,
install_progress: None,

View File

@ -176,6 +176,7 @@ impl DockerPackageScanner {
donation_url: None,
author: Some("Archipelago".to_string()),
website: lan_address.clone(),
tier: Some(metadata.tier.to_string()),
interfaces: if lan_address.is_some() || tor_address.is_some() {
Some(Interfaces {
main: Some(MainInterface {
@ -246,6 +247,7 @@ impl DockerPackageScanner {
donation_url: None,
author: Some("Indeehub Team".to_string()),
website: lan_address.clone(),
tier: Some("optional".to_string()),
interfaces: Some(Interfaces {
main: Some(MainInterface {
ui: Some("true".to_string()),
@ -286,21 +288,47 @@ struct AppMetadata {
description: String,
icon: String,
repo: String,
tier: &'static str,
}
/// Get the app tier: "core", "recommended", or "optional".
fn get_app_tier(app_id: &str) -> &'static str {
match app_id {
// Core: required for basic Bitcoin node
"bitcoin" | "bitcoin-core" | "bitcoin-knots" => "core",
"lnd" => "core",
"mempool" | "mempool-web" | "mempool-api" | "mempool-electrs" | "electrs" => "core",
"btcpay" | "btcpay-server" | "btcpayserver" => "core",
"dwn" => "core",
"filebrowser" => "core",
// Recommended: enhanced functionality
"fedimint" | "fedimint-gateway" => "recommended",
"vaultwarden" => "recommended",
"uptime-kuma" => "recommended",
"grafana" => "recommended",
"searxng" => "recommended",
"tailscale" => "recommended",
"portainer" => "recommended",
// Optional: everything else
_ => "optional",
}
}
fn get_app_metadata(app_id: &str) -> AppMetadata {
match app_id {
let mut meta = match app_id {
"bitcoin" | "bitcoin-core" | "bitcoin-knots" => AppMetadata {
title: "Bitcoin Knots".to_string(),
description: "Full Bitcoin node implementation".to_string(),
icon: "/assets/img/app-icons/bitcoin-knots.webp".to_string(),
repo: "https://github.com/bitcoinknots/bitcoin".to_string(),
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,
},
"homeassistant" | "home-assistant" => AppMetadata {
title: "Home Assistant".to_string(),
@ -443,7 +471,7 @@ fn get_app_metadata(app_id: &str) -> AppMetadata {
"indeedhub" => AppMetadata {
title: "Indeehub".to_string(),
description: "Decentralized media streaming platform".to_string(),
icon: "/assets/img/app-icons/indeedhub.png".to_string(),
icon: "/assets/img/app-icons/indeehub.ico".to_string(),
repo: "https://github.com/indeedhub/indeedhub".to_string(),
},
"nostr-rs-relay" => AppMetadata {
@ -511,8 +539,11 @@ fn get_app_metadata(app_id: &str) -> AppMetadata {
description: format!("{} application", app_id),
icon: "/assets/img/favico.png".to_string(),
repo: "#".to_string(),
tier: "",
},
}
};
meta.tier = get_app_tier(app_id);
meta
}
/// Map app_id to Tor hidden service directory name.

View File

@ -150,6 +150,9 @@ pub struct Manifest {
pub author: Option<String>,
pub website: Option<String>,
pub interfaces: Option<Interfaces>,
/// App tier: "core", "recommended", or "optional"
#[serde(default)]
pub tier: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]

View File

@ -315,9 +315,9 @@ Every test must pass **10 consecutive times** from BOTH .228→.198 AND .198→.
- [x] **SCALE-01** — Created `docs/scale-budget.md`. Per-container RAM/CPU/disk measurements from .228. Three app tiers: Core (2.6GB, Bitcoin+LND+Electrs+Mempool+BTCPay+DWN), Recommended (+880MB, Fedimint+Grafana+Vaultwarden+etc), Optional (+2-5GB, Home Assistant+Jellyfin+Nextcloud+Immich+etc). Four hardware tiers: Minimal (4GB/2 cores/$100), Standard (8GB/4 cores/$300), Power (16GB+/$500), Heavy (32GB+/$800). 10K user projection with distribution estimates.
- [ ] **SCALE-02** — Identify resource bottlenecks. Profile the top CPU and memory consumers. Current: immich_server (82% CPU spike), onlyoffice (759MB RAM), bitcoin-knots (750MB RAM), fedimint (369MB), lnd (250MB), homeassistant (234MB). Determine which apps should be optional vs core for a minimal install. **Acceptance**: Tiered app list: Core (must-have), Recommended, Optional. Core tier uses < 4GB RAM.
- [x] **SCALE-02** — Identified in docs/scale-budget.md. Top consumers: OnlyOffice (760MB), Bitcoin Knots (750MB), Immich (630MB total), Electrs (500MB), Fedimint (470MB total). Tiered app list: Core (2.6GB: Bitcoin+LND+Electrs+Mempool+BTCPay+DWN+FileBrowser), Recommended (+880MB: Fedimint+Grafana+Vaultwarden+Kuma+SearXNG+Tailscale+Portainer), Optional (+2-5GB: HA+Jellyfin+Nextcloud+OnlyOffice+Immich+PhotoPrism+AdGuard+Ollama).
- [ ] **SCALE-03** — Implement app tier system in backend. Add a `tier` field to app metadata: `core`, `recommended`, `optional`. First-install only installs core tier. Marketplace shows tier badges. Users choose additional tiers. **Acceptance**: Fresh install only starts core apps. Total RAM < 4GB for core tier.
- [x] **SCALE-03** — Added app tier system in backend. `get_app_tier()` in docker_packages.rs classifies apps as "core" (Bitcoin+LND+Electrs+Mempool+BTCPay+DWN+FileBrowser), "recommended" (Fedimint+Grafana+Vaultwarden+Kuma+SearXNG+Tailscale+Portainer), or "optional" (everything else). Tier field added to Manifest struct in data_model.rs, exposed via WebSocket package data to frontend.
- [ ] **SCALE-04** — Add resource monitoring alerts for scale limits. Alert when: total container memory > 80% of system RAM, CPU load > 2x core count sustained for 5 min, disk > 80%. These proactive alerts prevent scale-related failures. **Acceptance**: Alerts fire at correct thresholds. Tested on both nodes.