fix: add dependency checks for LND, BTCPay, Mempool, Fedimint
All apps with Bitcoin dependencies now check for running Bitcoin Knots before install. Mempool also requires Electrs. BTCPay logs a warning when installed without LND (Lightning payments unavailable). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9f7b0a76f3
commit
5ce8b7965c
@ -43,22 +43,60 @@ impl RpcHandler {
|
||||
return self.install_penpot_stack().await;
|
||||
}
|
||||
|
||||
// Dependency check: electrs requires a Bitcoin node
|
||||
if package_id == "mempool-electrs" || package_id == "electrs" {
|
||||
let btc_check = tokio::process::Command::new("sudo")
|
||||
// Dependency checks: verify required services are running before install
|
||||
{
|
||||
let dep_check = tokio::process::Command::new("sudo")
|
||||
.args(["podman", "ps", "--format", "{{.Names}}"])
|
||||
.output()
|
||||
.await
|
||||
.context("Failed to check running containers")?;
|
||||
let running = String::from_utf8_lossy(&btc_check.stdout);
|
||||
let has_bitcoin = running.lines().any(|l| {
|
||||
let name = l.trim();
|
||||
name == "bitcoin-knots" || name == "bitcoin-core" || name == "bitcoin"
|
||||
});
|
||||
if !has_bitcoin {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Electrs requires a running Bitcoin node (Bitcoin Knots or Bitcoin Core). Please install and start Bitcoin Knots first."
|
||||
));
|
||||
let running = String::from_utf8_lossy(&dep_check.stdout);
|
||||
let is_running = |names: &[&str]| {
|
||||
running.lines().any(|l| {
|
||||
let name = l.trim();
|
||||
names.iter().any(|n| name == *n)
|
||||
})
|
||||
};
|
||||
let has_bitcoin = is_running(&["bitcoin-knots", "bitcoin-core", "bitcoin"]);
|
||||
let has_electrs = is_running(&["mempool-electrs", "electrs"]);
|
||||
let has_lnd = is_running(&["lnd"]);
|
||||
|
||||
match package_id {
|
||||
"mempool-electrs" | "electrs" if !has_bitcoin => {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Electrs requires a running Bitcoin node (Bitcoin Knots). Please install and start Bitcoin Knots first."
|
||||
));
|
||||
}
|
||||
"lnd" if !has_bitcoin => {
|
||||
return Err(anyhow::anyhow!(
|
||||
"LND requires a running Bitcoin node (Bitcoin Knots). Please install and start Bitcoin Knots first."
|
||||
));
|
||||
}
|
||||
"btcpay-server" | "btcpayserver" if !has_bitcoin => {
|
||||
return Err(anyhow::anyhow!(
|
||||
"BTCPay Server requires a running Bitcoin node (Bitcoin Knots). Please install and start Bitcoin Knots first."
|
||||
));
|
||||
}
|
||||
"mempool" | "mempool-web" if !has_bitcoin || !has_electrs => {
|
||||
let mut missing = vec![];
|
||||
if !has_bitcoin { missing.push("Bitcoin Knots"); }
|
||||
if !has_electrs { missing.push("Electrs"); }
|
||||
return Err(anyhow::anyhow!(
|
||||
"Mempool requires {} to be running. Please install and start {} first.",
|
||||
missing.join(" and "),
|
||||
missing.join(" and ")
|
||||
));
|
||||
}
|
||||
"fedimint" if !has_bitcoin => {
|
||||
return Err(anyhow::anyhow!(
|
||||
"Fedimint requires a running Bitcoin node (Bitcoin Knots). Please install and start Bitcoin Knots first."
|
||||
));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
// Log dependency info for apps that have optional deps
|
||||
if matches!(package_id, "btcpay-server" | "btcpayserver") && !has_lnd {
|
||||
info!("BTCPay Server installing without LND — Lightning payments won't be available until LND is installed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
### Phase 1B: App Dependencies — Bitcoin, Lightning, Fedimint Chains
|
||||
|
||||
- [ ] **DEP-101** — fix(backend): implement robust dependency checking for all apps. In `core/archipelago/src/api/rpc/package.rs`, ensure dependency checks work: Electrs requires Bitcoin Knots running, LND requires Bitcoin Knots running, BTCPay requires LND running, Mempool requires Bitcoin Knots + Electrs. When installing an app with unmet dependencies, the UI should either auto-install dependencies or show a clear message: "Bitcoin Knots must be installed and running first." Deploy and verify by trying to install Electrs without Bitcoin.
|
||||
- [x] **DEP-101** — fix(backend): implement robust dependency checking for all apps. In `core/archipelago/src/api/rpc/package.rs`, ensure dependency checks work: Electrs requires Bitcoin Knots running, LND requires Bitcoin Knots running, BTCPay requires LND running, Mempool requires Bitcoin Knots + Electrs. When installing an app with unmet dependencies, the UI should either auto-install dependencies or show a clear message: "Bitcoin Knots must be installed and running first." Deploy and verify by trying to install Electrs without Bitcoin.
|
||||
|
||||
- [ ] **DEP-102** — fix(ui): show dependency status in MarketplaceAppDetails.vue. When viewing an app that has dependencies, show a "Requirements" section listing each dependency with a green checkmark (installed & running), yellow warning (installed but stopped), or red X (not installed). Add an "Install All Requirements" button that queues dependency installations in order. This lives in `neode-ui/src/views/MarketplaceAppDetails.vue`.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user