Initial implementation: host lifecycle + PXE + admin dashboard
Go service for Proxmox homelab cluster provisioning. Handles PXE boot, Proxmox autoinstall (answer file generation), cluster join via SSH, and Infrastructure API registration. - Host state machine (registered → pxe_ready → installing → ready) - dnsmasq supervisor with MAC-based allowlist - iPXE script and Proxmox answer file generation - First-boot phone-home → cluster join → infra registration - Operation locking with expiry (409 on conflict) - SSE event hub for real-time dashboard updates - Admin dashboard (host grid, detail, registration form) - Config-driven server types with hot-reload - Docker deployment (multi-stage fat image) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #0f1419;
|
||||
--surface: #1a2027;
|
||||
--border: #2d3748;
|
||||
--text: #e2e8f0;
|
||||
--text-muted: #8892a4;
|
||||
--accent: #60a5fa;
|
||||
--green: #34d399;
|
||||
--amber: #fbbf24;
|
||||
--red: #f87171;
|
||||
--blue: #60a5fa;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.5rem;
|
||||
padding: 0.75rem 1.5rem;
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.brand {
|
||||
font-weight: 700;
|
||||
font-size: 1.1rem;
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-links { display: flex; gap: 1rem; }
|
||||
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
|
||||
.nav-links a:hover { color: var(--text); }
|
||||
|
||||
.sse-indicator { margin-left: auto; color: var(--green); font-size: 0.8rem; }
|
||||
.sse-indicator.disconnected { color: var(--red); }
|
||||
|
||||
main { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
|
||||
|
||||
.actions { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
|
||||
.count { color: var(--text-muted); font-size: 0.85rem; }
|
||||
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 0.5rem 1rem;
|
||||
background: var(--accent);
|
||||
color: #000;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
.btn:hover { opacity: 0.9; }
|
||||
.btn-danger { background: var(--red); }
|
||||
|
||||
.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
|
||||
|
||||
.tile {
|
||||
display: block;
|
||||
padding: 1rem;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
.tile:hover { border-color: var(--accent); }
|
||||
.tile-name { font-weight: 600; margin-bottom: 0.25rem; }
|
||||
.tile-type { font-size: 0.8rem; color: var(--text-muted); }
|
||||
.tile-state { font-size: 0.8rem; margin-top: 0.5rem; padding: 0.15rem 0.5rem; border-radius: 3px; display: inline-block; }
|
||||
.tile-mac { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; font-family: monospace; }
|
||||
|
||||
.state-grey .tile-state { background: #374151; color: #9ca3af; }
|
||||
.state-blue .tile-state { background: #1e3a5f; color: var(--blue); }
|
||||
.state-amber .tile-state { background: #422006; color: var(--amber); }
|
||||
.state-green .tile-state { background: #064e3b; color: var(--green); }
|
||||
.state-red .tile-state { background: #450a0a; color: var(--red); }
|
||||
|
||||
.host-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
|
||||
.badge { padding: 0.2rem 0.6rem; border-radius: 3px; font-size: 0.8rem; }
|
||||
.state-grey .badge, .badge.state-grey { background: #374151; color: #9ca3af; }
|
||||
.state-blue .badge, .badge.state-blue { background: #1e3a5f; color: var(--blue); }
|
||||
.state-amber .badge, .badge.state-amber { background: #422006; color: var(--amber); }
|
||||
.state-green .badge, .badge.state-green { background: #064e3b; color: var(--green); }
|
||||
.state-red .badge, .badge.state-red { background: #450a0a; color: var(--red); }
|
||||
|
||||
.detail-table { margin-bottom: 1.5rem; }
|
||||
.detail-table th { text-align: left; padding: 0.4rem 1rem 0.4rem 0; color: var(--text-muted); font-weight: 500; }
|
||||
.detail-table td { padding: 0.4rem 0; }
|
||||
|
||||
.ops-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
|
||||
.ops-table th { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); color: var(--text-muted); }
|
||||
.ops-table td { padding: 0.5rem; border-bottom: 1px solid var(--border); }
|
||||
|
||||
.form { max-width: 400px; }
|
||||
.form label { display: block; margin-bottom: 1rem; color: var(--text-muted); font-size: 0.85rem; }
|
||||
.form input, .form select, .form textarea {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
margin-top: 0.25rem;
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
color: var(--text);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.form textarea { min-height: 60px; resize: vertical; }
|
||||
.form .btn { margin-top: 0.5rem; }
|
||||
|
||||
.error { background: #450a0a; color: var(--red); padding: 0.75rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.85rem; }
|
||||
.empty { color: var(--text-muted); padding: 2rem; text-align: center; }
|
||||
.empty a { color: var(--accent); }
|
||||
.inline { display: inline; }
|
||||
h2 { margin-bottom: 1rem; }
|
||||
h3 { margin: 1.5rem 0 0.75rem; color: var(--text-muted); font-size: 0.95rem; }
|
||||
@@ -0,0 +1,23 @@
|
||||
(function() {
|
||||
const dot = document.getElementById('sse-dot');
|
||||
let es;
|
||||
|
||||
function connect() {
|
||||
es = new EventSource('/events');
|
||||
es.addEventListener('hello', () => {
|
||||
dot.classList.remove('disconnected');
|
||||
});
|
||||
es.addEventListener('host.state_changed', (e) => {
|
||||
// Reload the page to reflect state changes
|
||||
// Future: HTMX swap individual tiles
|
||||
window.location.reload();
|
||||
});
|
||||
es.onerror = () => {
|
||||
dot.classList.add('disconnected');
|
||||
es.close();
|
||||
setTimeout(connect, 3000);
|
||||
};
|
||||
}
|
||||
|
||||
connect();
|
||||
})();
|
||||
Reference in New Issue
Block a user