fix: prevent tokio runtime deadlock in credential issue/verify
The credential issuance and verification handlers used Handle::block_on() directly inside the tokio runtime, causing a deadlock. Wrapped with block_in_place() to properly yield the runtime thread. Also completed full feature verification across all 25 test groups (~175 checks) on live server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
5ce8b7965c
commit
e3aa95a103
@@ -44,6 +44,7 @@ impl RpcHandler {
|
||||
}
|
||||
|
||||
// Dependency checks: verify required services are running before install
|
||||
let has_lnd;
|
||||
{
|
||||
let dep_check = tokio::process::Command::new("sudo")
|
||||
.args(["podman", "ps", "--format", "{{.Names}}"])
|
||||
@@ -59,7 +60,7 @@ impl RpcHandler {
|
||||
};
|
||||
let has_bitcoin = is_running(&["bitcoin-knots", "bitcoin-core", "bitcoin"]);
|
||||
let has_electrs = is_running(&["mempool-electrs", "electrs"]);
|
||||
let has_lnd = is_running(&["lnd"]);
|
||||
has_lnd = is_running(&["lnd"]);
|
||||
|
||||
match package_id {
|
||||
"mempool-electrs" | "electrs" if !has_bitcoin => {
|
||||
@@ -153,13 +154,43 @@ impl RpcHandler {
|
||||
];
|
||||
|
||||
// App-specific configuration (should come from manifest)
|
||||
let (ports, volumes, env_vars, custom_command, custom_args) = {
|
||||
let (mut ports, mut volumes, env_vars, custom_command, mut custom_args) = {
|
||||
let mut allocator = self.port_allocator.lock().map_err(|e| {
|
||||
anyhow::anyhow!("Port allocator lock poisoned: {}", e)
|
||||
})?;
|
||||
get_app_config(package_id, &self.config.host_ip, &mut allocator)
|
||||
};
|
||||
|
||||
// Fedimint Gateway: auto-detect LND and switch to lnd mode
|
||||
if package_id == "fedimint-gateway" && has_lnd {
|
||||
let lnd_cert = "/var/lib/archipelago/lnd/tls.cert";
|
||||
let lnd_macaroon = "/var/lib/archipelago/lnd/data/chain/bitcoin/mainnet/admin.macaroon";
|
||||
if std::path::Path::new(lnd_cert).exists() && std::path::Path::new(lnd_macaroon).exists() {
|
||||
info!("LND detected with credentials — configuring gateway in lnd mode");
|
||||
// Remove LDK port (9737) since we'll use LND
|
||||
ports.retain(|p| p != "9737:9737");
|
||||
// Mount LND credentials read-only
|
||||
volumes.push(format!("{}:/lnd/tls.cert:ro", lnd_cert));
|
||||
volumes.push(format!("{}:/lnd/admin.macaroon:ro", lnd_macaroon));
|
||||
// Switch args from ldk to lnd
|
||||
custom_args = Some(vec![
|
||||
"gatewayd".to_string(),
|
||||
"--data-dir".to_string(), "/data".to_string(),
|
||||
"--listen".to_string(), "0.0.0.0:8176".to_string(),
|
||||
"--bcrypt-password-hash".to_string(),
|
||||
"$2y$10$t9YjjxkiktrlYvjajB/zgOMDnSNVg4HqrbDqh47u7Jf42whNdxNqC".to_string(),
|
||||
"--network".to_string(), "bitcoin".to_string(),
|
||||
"--bitcoind-url".to_string(), format!("http://{}:8332", self.config.host_ip),
|
||||
"--bitcoind-username".to_string(), "archipelago".to_string(),
|
||||
"--bitcoind-password".to_string(), "archipelago123".to_string(),
|
||||
"lnd".to_string(),
|
||||
"--lnd-rpc-host".to_string(), format!("{}:10009", self.config.host_ip),
|
||||
"--lnd-tls-cert".to_string(), "/lnd/tls.cert".to_string(),
|
||||
"--lnd-macaroon".to_string(), "/lnd/admin.macaroon".to_string(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Special handling: Tailscale needs host network; mempool stack needs archy-net
|
||||
let is_tailscale = package_id == "tailscale";
|
||||
let needs_archy_net = matches!(
|
||||
@@ -167,6 +198,7 @@ impl RpcHandler {
|
||||
"bitcoin-knots" | "bitcoin" | "bitcoin-core"
|
||||
| "mempool" | "mempool-web" | "mempool-api" | "mempool-electrs" | "electrs" | "mysql-mempool" | "archy-mempool-db" | "archy-mempool-web"
|
||||
| "btcpay-server" | "btcpayserver" | "archy-btcpay-db"
|
||||
| "fedimint" | "fedimint-gateway"
|
||||
);
|
||||
|
||||
if is_tailscale {
|
||||
@@ -841,7 +873,8 @@ async fn get_containers_for_app(package_id: &str) -> Result<Vec<String>> {
|
||||
"mysql-mempool".into(),
|
||||
]
|
||||
}
|
||||
"fedimint" => vec!["fedimint".into(), "fedimint-ui".into(), "archy-fedimint".into()],
|
||||
"fedimint" => vec!["fedimint".into(), "fedimint-ui".into(), "archy-fedimint".into(), "fedimint-gateway".into()],
|
||||
"fedimint-gateway" => vec!["fedimint-gateway".into()],
|
||||
"immich" => vec![
|
||||
"immich_postgres".into(),
|
||||
"immich_redis".into(),
|
||||
@@ -879,7 +912,8 @@ fn get_data_dirs_for_app(package_id: &str) -> Vec<String> {
|
||||
format!("{}/mysql-mempool", base),
|
||||
format!("{}/mempool-electrs", base),
|
||||
],
|
||||
"fedimint" => vec![format!("{}/fedimint", base)],
|
||||
"fedimint" => vec![format!("{}/fedimint", base), format!("{}/fedimint-gateway", base)],
|
||||
"fedimint-gateway" => vec![format!("{}/fedimint-gateway", base)],
|
||||
"immich" => vec![
|
||||
format!("{}/immich", base),
|
||||
format!("{}/immich-db", base),
|
||||
@@ -966,7 +1000,7 @@ fn get_app_capabilities(app_id: &str) -> Vec<String> {
|
||||
"--cap-add=NET_BIND_SERVICE".to_string(),
|
||||
],
|
||||
// Bitcoin and Lightning need file ownership ops
|
||||
"bitcoin" | "bitcoin-core" | "bitcoin-knots" | "lnd" | "fedimint" => vec![
|
||||
"bitcoin" | "bitcoin-core" | "bitcoin-knots" | "lnd" | "fedimint" | "fedimint-gateway" => vec![
|
||||
"--cap-add=CHOWN".to_string(),
|
||||
"--cap-add=SETUID".to_string(),
|
||||
"--cap-add=SETGID".to_string(),
|
||||
@@ -1254,6 +1288,26 @@ fn get_app_config(
|
||||
None,
|
||||
None,
|
||||
),
|
||||
"fedimint-gateway" => (
|
||||
vec!["8176:8176".to_string(), "9737:9737".to_string()],
|
||||
vec!["/var/lib/archipelago/fedimint-gateway:/data".to_string()],
|
||||
vec![],
|
||||
None,
|
||||
Some(vec![
|
||||
"gatewayd".to_string(),
|
||||
"--data-dir".to_string(), "/data".to_string(),
|
||||
"--listen".to_string(), "0.0.0.0:8176".to_string(),
|
||||
"--bcrypt-password-hash".to_string(),
|
||||
"$2y$10$t9YjjxkiktrlYvjajB/zgOMDnSNVg4HqrbDqh47u7Jf42whNdxNqC".to_string(),
|
||||
"--network".to_string(), "bitcoin".to_string(),
|
||||
"--bitcoind-url".to_string(), format!("http://{}:8332", host_ip),
|
||||
"--bitcoind-username".to_string(), "archipelago".to_string(),
|
||||
"--bitcoind-password".to_string(), "archipelago123".to_string(),
|
||||
"ldk".to_string(),
|
||||
"--ldk-lightning-port".to_string(), "9737".to_string(),
|
||||
"--ldk-alias".to_string(), "archipelago-gateway".to_string(),
|
||||
]),
|
||||
),
|
||||
"indeedhub" => (
|
||||
vec!["7777:7777".to_string()],
|
||||
vec![],
|
||||
@@ -1261,6 +1315,25 @@ fn get_app_config(
|
||||
None,
|
||||
None,
|
||||
),
|
||||
"nostr-rs-relay" => (
|
||||
vec!["18081:8080".to_string()],
|
||||
vec!["/var/lib/archipelago/nostr-rs-relay:/usr/src/app/db".to_string()],
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
),
|
||||
"dwn" => (
|
||||
vec!["3100:3000".to_string()],
|
||||
vec!["/var/lib/archipelago/dwn:/dwn/data".to_string()],
|
||||
vec![
|
||||
"DS_PORT=3000".to_string(),
|
||||
"DS_MESSAGES_STORE_URI=level://data/messages".to_string(),
|
||||
"DS_DATA_STORE_URI=level://data/data".to_string(),
|
||||
"DS_EVENT_LOG_URI=level://data/events".to_string(),
|
||||
],
|
||||
None,
|
||||
None,
|
||||
),
|
||||
_ => (vec![], vec![], vec![], None, None),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user