feat: electrs standalone install with bitcoin dependency + progress UI
- Add electrs to marketplace as standalone installable app - Add dependency check: refuse install if no bitcoin node is running - Use container DNS (bitcoin-knots:8332) on archy-net instead of host IP - Auto-create bitcoin.conf with txindex + RPC on bitcoin-knots install - Auto-build and start electrs-ui container post-install - Show index size and estimated progress during initial sync - Add /electrs-status and /health nginx proxy routes - Remove Tailwind CDN from electrs-ui, use inline styles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
825d082003
commit
a5757d27f1
+100
-43
@@ -5,11 +5,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
|
||||
<title>Electrs - Archipelago</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; min-height: 100vh; color: white; overflow-x: hidden; }
|
||||
.bg-layer { position: fixed; inset: 0; z-index: -10; background: linear-gradient(135deg, rgba(0,0,0,0.9) 0%, rgba(30,30,50,0.95) 100%); background-size: cover; background-position: center; }
|
||||
.bg-layer { position: fixed; inset: 0; z-index: -10; background: linear-gradient(135deg, rgba(0,0,0,0.9) 0%, rgba(30,30,50,0.95) 100%); }
|
||||
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); z-index: -5; }
|
||||
.glass-card { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-radius: 1rem; border: 1px solid rgba(255, 255, 255, 0.18); }
|
||||
.info-card { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(24px); border-radius: 16px; padding: 12px; border: 1px solid rgba(255, 255, 255, 0.1); }
|
||||
@@ -17,28 +16,81 @@
|
||||
.progress-glow { animation: progressGlow 2s ease-in-out infinite; }
|
||||
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
||||
.animate-spin-slow { animation: spin 3s linear infinite; }
|
||||
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
|
||||
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
|
||||
.container { max-width: 56rem; margin: 0 auto; padding: 2rem; }
|
||||
.flex { display: flex; }
|
||||
.flex-col { flex-direction: column; }
|
||||
.items-center { align-items: center; }
|
||||
.items-start { align-items: start; }
|
||||
.gap-3 { gap: 0.75rem; }
|
||||
.gap-4 { gap: 1rem; }
|
||||
.flex-1 { flex: 1; }
|
||||
.flex-shrink-0 { flex-shrink: 0; }
|
||||
.mb-1 { margin-bottom: 0.25rem; }
|
||||
.mb-2 { margin-bottom: 0.5rem; }
|
||||
.mb-4 { margin-bottom: 1rem; }
|
||||
.mb-6 { margin-bottom: 1.5rem; }
|
||||
.p-6 { padding: 1.5rem; }
|
||||
.grid { display: grid; }
|
||||
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
|
||||
.rounded-lg { border-radius: 0.5rem; }
|
||||
.rounded-full { border-radius: 9999px; }
|
||||
.overflow-hidden { overflow: hidden; }
|
||||
.transition-all { transition: all 0.5s ease; }
|
||||
.text-xs { font-size: 0.75rem; }
|
||||
.text-sm { font-size: 0.875rem; }
|
||||
.text-lg { font-size: 1.125rem; }
|
||||
.text-xl { font-size: 1.25rem; }
|
||||
.text-2xl { font-size: 1.5rem; }
|
||||
.font-bold { font-weight: 700; }
|
||||
.font-semibold { font-weight: 600; }
|
||||
.font-medium { font-weight: 500; }
|
||||
.font-mono { font-family: monospace; }
|
||||
.icon-box { width: 4rem; height: 4rem; border-radius: 0.5rem; background: rgba(249, 115, 22, 0.2); display: flex; align-items: center; justify-content: center; }
|
||||
.icon-box-sm { width: 3rem; height: 3rem; border-radius: 0.5rem; background: rgba(249, 115, 22, 0.2); display: flex; align-items: center; justify-content: center; }
|
||||
.status-dot { width: 0.75rem; height: 0.75rem; border-radius: 9999px; }
|
||||
.progress-bar-bg { width: 100%; background: rgba(255,255,255,0.1); border-radius: 9999px; height: 0.75rem; overflow: hidden; }
|
||||
.progress-bar { height: 100%; background: linear-gradient(to right, #f97316, #facc15); border-radius: 9999px; transition: width 0.5s ease; }
|
||||
.text-white { color: white; }
|
||||
.text-white-70 { color: rgba(255,255,255,0.7); }
|
||||
.text-white-60 { color: rgba(255,255,255,0.6); }
|
||||
.text-white-90 { color: rgba(255,255,255,0.9); }
|
||||
.text-amber { color: #fbbf24; }
|
||||
.text-green { color: #4ade80; }
|
||||
.text-red { color: #f87171; }
|
||||
.text-orange { color: #fb923c; }
|
||||
.bg-amber { background: #fbbf24; }
|
||||
.bg-green { background: #4ade80; }
|
||||
.bg-red { background: #f87171; }
|
||||
.bg-yellow { background: #facc15; }
|
||||
.justify-between { justify-content: space-between; }
|
||||
@media (min-width: 768px) {
|
||||
.md-flex-row { flex-direction: row; }
|
||||
.md-grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="bg-layer"></div>
|
||||
<div class="overlay"></div>
|
||||
|
||||
<div class="max-w-4xl mx-auto p-8">
|
||||
<div class="container">
|
||||
<div class="glass-card p-6 mb-6">
|
||||
<div class="flex flex-col md:flex-row items-center gap-4">
|
||||
<div class="flex-shrink-0 w-16 h-16 rounded-lg bg-orange-500/20 flex items-center justify-center">
|
||||
<svg class="w-8 h-8 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<div class="flex flex-col md-flex-row items-center gap-4">
|
||||
<div class="icon-box flex-shrink-0">
|
||||
<svg style="width:2rem;height:2rem;color:#f97316" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h1 class="text-2xl font-bold text-white">Electrs</h1>
|
||||
<p class="text-white/70">Bitcoin Electrum indexer for Mempool & Electrum clients</p>
|
||||
<p class="text-white-70">Bitcoin Electrum indexer for Mempool & Electrum clients</p>
|
||||
</div>
|
||||
<div class="info-card flex items-center gap-3">
|
||||
<div id="statusDot" class="w-3 h-3 rounded-full bg-yellow-400"></div>
|
||||
<div id="statusDot" class="status-dot bg-yellow"></div>
|
||||
<div>
|
||||
<p class="text-xs text-white/60">Status</p>
|
||||
<p class="text-xs text-white-60">Status</p>
|
||||
<p class="text-sm font-medium text-white" id="statusText">Checking...</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,42 +99,42 @@
|
||||
|
||||
<div class="glass-card p-6">
|
||||
<div class="flex items-start gap-4 mb-4">
|
||||
<div class="flex-shrink-0 w-12 h-12 rounded-lg bg-orange-500/20 flex items-center justify-center">
|
||||
<svg id="syncIcon" class="w-6 h-6 text-orange-500 animate-spin-slow" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<div class="icon-box-sm flex-shrink-0">
|
||||
<svg id="syncIcon" style="width:1.5rem;height:1.5rem;color:#f97316" class="animate-spin-slow" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<h2 class="text-xl font-semibold text-white mb-1">Index Sync</h2>
|
||||
<p class="text-white/70 text-sm" id="syncStatusText">Checking sync status...</p>
|
||||
<p class="text-white-70 text-sm" id="syncStatusText">Checking sync status...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="flex justify-between text-sm text-white/60 mb-2">
|
||||
<div class="flex justify-between text-sm text-white-60 mb-2">
|
||||
<span id="currentBlock">Block 0</span>
|
||||
<span id="syncPercentage">0%</span>
|
||||
</div>
|
||||
<div class="w-full bg-white/10 rounded-full h-3 overflow-hidden">
|
||||
<div class="h-full bg-gradient-to-r from-orange-500 to-yellow-400 rounded-full transition-all duration-500 progress-glow" id="syncProgressBar" style="width: 0%"></div>
|
||||
<div class="progress-bar-bg">
|
||||
<div class="progress-bar progress-glow" id="syncProgressBar" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
|
||||
<div class="grid grid-cols-2 md-grid-cols-4 gap-3">
|
||||
<div class="info-card">
|
||||
<p class="text-xs text-white/60 mb-1">Indexed Height</p>
|
||||
<p class="text-xs text-white-60 mb-1">Indexed Height</p>
|
||||
<p class="text-lg font-semibold text-white" id="indexedHeight">-</p>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<p class="text-xs text-white/60 mb-1">Network Height</p>
|
||||
<p class="text-xs text-white-60 mb-1">Network Height</p>
|
||||
<p class="text-lg font-semibold text-white" id="networkHeight">-</p>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<p class="text-xs text-white/60 mb-1">Electrum RPC</p>
|
||||
<p class="text-sm font-mono text-white/90">localhost:50001</p>
|
||||
<p class="text-xs text-white-60 mb-1">Index Size</p>
|
||||
<p class="text-lg font-semibold text-white" id="indexSize">-</p>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<p class="text-xs text-white/60 mb-1">Progress</p>
|
||||
<p class="text-xs text-white-60 mb-1">Progress</p>
|
||||
<p class="text-lg font-semibold text-white" id="progressPct">-</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -92,49 +144,54 @@
|
||||
<script>
|
||||
async function updateStatus() {
|
||||
try {
|
||||
const resp = await fetch('/electrs-status');
|
||||
const resp = await fetch('electrs-status');
|
||||
const data = await resp.json();
|
||||
|
||||
document.getElementById('indexedHeight').textContent = data.indexed_height?.toLocaleString() ?? '-';
|
||||
document.getElementById('networkHeight').textContent = data.network_height?.toLocaleString() ?? '-';
|
||||
document.getElementById('progressPct').textContent = data.progress_pct != null ? data.progress_pct.toFixed(2) + '%' : '-';
|
||||
document.getElementById('currentBlock').textContent = 'Block ' + (data.indexed_height?.toLocaleString() ?? '0');
|
||||
document.getElementById('syncPercentage').textContent = (data.progress_pct ?? 0).toFixed(2) + '%';
|
||||
document.getElementById('syncProgressBar').style.width = (data.progress_pct ?? 0) + '%';
|
||||
const indexedH = data.indexed_height ?? 0;
|
||||
const networkH = data.network_height ?? 0;
|
||||
const pct = data.progress_pct ?? 0;
|
||||
|
||||
document.getElementById('indexedHeight').textContent = indexedH > 0 ? indexedH.toLocaleString() : (data.status === 'indexing' ? 'Building...' : '-');
|
||||
document.getElementById('networkHeight').textContent = networkH > 0 ? networkH.toLocaleString() : '-';
|
||||
document.getElementById('indexSize').textContent = data.index_size || '-';
|
||||
document.getElementById('progressPct').textContent = pct > 0 ? pct.toFixed(1) + '%' : '-';
|
||||
document.getElementById('currentBlock').textContent = indexedH > 0 ? 'Block ' + indexedH.toLocaleString() : (data.index_size ? 'Index: ' + data.index_size : 'Block 0');
|
||||
document.getElementById('syncPercentage').textContent = pct > 0 ? pct.toFixed(1) + '%' : '0%';
|
||||
document.getElementById('syncProgressBar').style.width = Math.max(pct, 0.5) + '%';
|
||||
|
||||
const statusText = document.getElementById('syncStatusText');
|
||||
const statusDot = document.getElementById('statusDot');
|
||||
const syncIcon = document.getElementById('syncIcon');
|
||||
|
||||
if (data.status === 'indexing') {
|
||||
statusText.textContent = data.error || 'Building index... Electrum RPC will be available when indexing completes (may take hours).';
|
||||
statusText.className = 'text-amber-400 text-sm';
|
||||
statusDot.className = 'w-3 h-3 rounded-full bg-amber-400 animate-pulse';
|
||||
statusText.textContent = data.error || 'Building index...';
|
||||
statusText.style.color = '#fbbf24';
|
||||
statusDot.className = 'status-dot bg-amber animate-pulse';
|
||||
document.getElementById('statusText').textContent = 'Indexing';
|
||||
syncIcon.classList.add('animate-spin-slow');
|
||||
} else if (data.error) {
|
||||
statusText.textContent = data.error;
|
||||
statusText.className = 'text-red-400 text-sm';
|
||||
statusDot.className = 'w-3 h-3 rounded-full bg-red-400';
|
||||
} else if (data.status === 'error') {
|
||||
statusText.textContent = data.error || 'Unknown error';
|
||||
statusText.style.color = '#f87171';
|
||||
statusDot.className = 'status-dot bg-red';
|
||||
document.getElementById('statusText').textContent = 'Error';
|
||||
} else if (data.status === 'synced') {
|
||||
statusText.textContent = '✓ Fully synchronized with the network';
|
||||
statusText.className = 'text-green-400 text-sm font-medium';
|
||||
statusDot.className = 'w-3 h-3 rounded-full bg-green-400';
|
||||
statusText.textContent = 'Fully synchronized with the network';
|
||||
statusText.style.color = '#4ade80';
|
||||
statusDot.className = 'status-dot bg-green';
|
||||
document.getElementById('statusText').textContent = 'Synced';
|
||||
syncIcon.classList.remove('animate-spin-slow');
|
||||
syncIcon.classList.add('text-green-500');
|
||||
syncIcon.style.color = '#4ade80';
|
||||
} else {
|
||||
const remaining = (data.network_height || 0) - (data.indexed_height || 0);
|
||||
const remaining = networkH - indexedH;
|
||||
statusText.textContent = 'Syncing... ' + remaining.toLocaleString() + ' blocks remaining';
|
||||
statusText.className = 'text-orange-400 text-sm font-medium';
|
||||
statusDot.className = 'w-3 h-3 rounded-full bg-yellow-400';
|
||||
statusText.style.color = '#fb923c';
|
||||
statusDot.className = 'status-dot bg-yellow';
|
||||
document.getElementById('statusText').textContent = 'Syncing';
|
||||
syncIcon.classList.add('animate-spin-slow');
|
||||
}
|
||||
} catch (e) {
|
||||
document.getElementById('syncStatusText').textContent = 'Unable to fetch status: ' + e.message;
|
||||
document.getElementById('syncStatusText').className = 'text-red-400 text-sm';
|
||||
document.getElementById('syncStatusText').style.color = '#f87171';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user