feat: install plugins from approved source commits
This commit is contained in:
@@ -68,7 +68,7 @@ include dirname(__DIR__) . '/partials/head.php';
|
||||
<?php foreach (($sources ?? []) as $source): ?>
|
||||
<tr>
|
||||
<td><strong><?= $e($source['name']) ?></strong><small><?= $e($source['baseUrl']) ?></small></td>
|
||||
<td><?= $e($source['provider']) ?> · <?= $e($source['owner']) ?><small>Öffentliche Wheel-Releases</small></td>
|
||||
<td><?= $e($source['provider']) ?> · <?= $e($source['owner']) ?><small>Wheels oder commitgebundener Source-Fallback</small></td>
|
||||
<td><span class="status-pill <?= $e($statusClass($source['status'])) ?>"><?= $e($statusLabel($source['status'])) ?></span></td>
|
||||
<td><?= $e($formatDate($source['lastSyncedAt'] ?? null)) ?></td>
|
||||
<td><div class="action-row">
|
||||
@@ -126,7 +126,7 @@ include dirname(__DIR__) . '/partials/head.php';
|
||||
<table class="admin-table release-admin-table">
|
||||
<thead><tr><th>Plugin / Version</th><th>Artefakt</th><th>Integrität</th><th>Status</th><th>Aktionen</th></tr></thead>
|
||||
<tbody>
|
||||
<?php if (($releases ?? []) === []): ?><tr><td colspan="5" class="empty-row">Keine Release-Artefakte gefunden. Veröffentliche ein Wheel als Forgejo-Release-Asset.</td></tr><?php endif; ?>
|
||||
<?php if (($releases ?? []) === []): ?><tr><td colspan="5" class="empty-row">Keine installierbaren Artefakte gefunden. Prüfe Version und Build-Metadaten des Repositorys.</td></tr><?php endif; ?>
|
||||
<?php foreach (($releases ?? []) as $release): ?>
|
||||
<?php $releasePlugin = $release['plugin'] ?? []; $releaseErrors = Approval::releaseErrors($releasePlugin, $release); ?>
|
||||
<tr>
|
||||
|
||||
@@ -59,12 +59,12 @@
|
||||
<?php else: ?>
|
||||
<div class="plugin-grid">
|
||||
<?php foreach ($plugins as $plugin): ?>
|
||||
<?php $release = $plugin['latestRelease'] ?? null; $isWheel = is_array($release) && ($release['artifactKind'] ?? '') === 'wheel'; ?>
|
||||
<?php $release = $plugin['latestRelease'] ?? null; $isWheel = is_array($release) && in_array(($release['artifactKind'] ?? ''), ['wheel', 'source_archive'], true); ?>
|
||||
<article class="plugin-card">
|
||||
<div class="card-topline">
|
||||
<span class="provider-pill"><?= $e(strtoupper((string) ($plugin['source']['provider'] ?? 'git'))) ?></span>
|
||||
<?php if ($isWheel): ?>
|
||||
<span class="status-pill success">Wheel geprüft</span>
|
||||
<span class="status-pill success"><?= ($release['artifactKind'] ?? '') === 'source_archive' ? 'Source freigegeben' : 'Wheel geprüft' ?></span>
|
||||
<?php elseif ($release): ?>
|
||||
<span class="status-pill warning">Kein installierbares Release</span>
|
||||
<?php else: ?>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php declare(strict_types=1); include __DIR__ . '/partials/head.php'; ?>
|
||||
<section class="install-hero">
|
||||
<div class="shell prose-shell">
|
||||
<p class="eyebrow">NetBox 4.6.5–4.6.8</p>
|
||||
<h1>NetBox Store Plugin installieren</h1>
|
||||
<p>Das Plugin verbindet deine NetBox mit <code>https://netbox.mrblake.cc</code>. Docker ist nicht erforderlich.</p>
|
||||
</div>
|
||||
</section>
|
||||
<section class="shell prose-shell install-guide">
|
||||
<aside class="notice"><strong>Vorher sichern:</strong> Erstelle ein Backup von NetBox und der Datenbank. Führe die Befehle auf dem NetBox-Host aus.</aside>
|
||||
<h2>1. Plugin aus git.mrblake.cc installieren</h2>
|
||||
<p>Trage das Plugin dauerhaft in <code>/opt/netbox/local_requirements.txt</code> ein. Für reproduzierbare Installationen solltest du <code>main</code> durch einen geprüften Commit-SHA ersetzen.</p>
|
||||
<pre><code>sudo sh -c 'printf "%s\n" "netbox-plugin-store @ git+https://git.mrblake.cc/MrBlake/Netbox-Store.git@main#subdirectory=netbox_plugin" >> /opt/netbox/local_requirements.txt'
|
||||
sudo /opt/netbox/upgrade.sh</code></pre>
|
||||
<h2>2. Plugin in NetBox aktivieren</h2>
|
||||
<p>Ergänze die NetBox-Konfiguration:</p>
|
||||
<pre><code>PLUGINS = [
|
||||
"netbox_plugin_store",
|
||||
]
|
||||
|
||||
PLUGINS_CONFIG = {
|
||||
"netbox_plugin_store": {
|
||||
"store_url": "https://netbox.mrblake.cc",
|
||||
"allowed_store_urls": ["https://netbox.mrblake.cc"],
|
||||
"allowed_artifact_urls": [
|
||||
"https://git.mrblake.cc",
|
||||
"https://github.com",
|
||||
"https://codeload.github.com",
|
||||
],
|
||||
"execution_mode": "dry_run",
|
||||
}
|
||||
}</code></pre>
|
||||
<p>Führe danach Migrationen und statische Dateien aus und starte NetBox neu:</p>
|
||||
<pre><code>sudo /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate
|
||||
sudo /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
|
||||
sudo systemctl restart netbox netbox-rq</code></pre>
|
||||
<h2>3. Sicheren Host-Agent einrichten</h2>
|
||||
<p><code>dry_run</code> verändert das System nicht. Für Installieren, Aktualisieren, Aktivieren und Entfernen wird der mitgelieferte Linux Host-Agent benötigt. Installiere ihn aus <code>host_agent/</code>, prüfe <code>/etc/netbox-store-agent/agent.toml</code> und stelle anschließend <code>execution_mode</code> auf <code>agent</code>.</p>
|
||||
<p>Source-Kandidaten werden nur nach Admin-Freigabe verarbeitet. Der Agent prüft Commitbindung, Größe und SHA-256, baut daraus lokal ein Wheel und installiert nicht direkt aus einem beweglichen Branch.</p>
|
||||
<aside class="notice warning"><strong>Wichtig:</strong> Source-Builds führen den Build-Code des freigegebenen Repository-Commits aus. Gib nur vertrauenswürdige Kandidaten frei.</aside>
|
||||
</section>
|
||||
<?php include __DIR__ . '/partials/footer.php'; ?>
|
||||
@@ -7,6 +7,7 @@
|
||||
<p>Freigegebene Metadaten, reproduzierbar geprüfte Artefakte.</p>
|
||||
</div>
|
||||
<div class="footer-links">
|
||||
<a href="/installation">Installation</a>
|
||||
<a href="/api/v1/plugins/">Catalog API v1</a>
|
||||
<a href="/healthz">Systemstatus</a>
|
||||
</div>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
</a>
|
||||
<nav class="main-nav" aria-label="Hauptnavigation">
|
||||
<a class="<?= ($currentPath ?? '') === '/' ? 'active' : '' ?>" href="/">Store</a>
|
||||
<a class="<?= ($currentPath ?? '') === '/installation' ? 'active' : '' ?>" href="/installation">Installation</a>
|
||||
<a href="/api/v1/plugins/">API</a>
|
||||
<?php if (!empty($adminEnabled)): ?>
|
||||
<a class="<?= str_starts_with((string) ($currentPath ?? ''), '/admin') ? 'active' : '' ?>" href="/admin">Admin</a>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php declare(strict_types=1); include __DIR__ . '/partials/head.php'; ?>
|
||||
<?php $wheelReleases = array_values(array_filter($releases ?? [], static fn (array $release): bool => ($release['artifactKind'] ?? '') === 'wheel')); ?>
|
||||
<?php $installableReleases = array_values(array_filter($releases ?? [], static fn (array $release): bool => in_array(($release['artifactKind'] ?? ''), ['wheel', 'source_archive'], true))); ?>
|
||||
<section class="detail-hero">
|
||||
<div class="shell">
|
||||
<a class="back-link" href="/">← Alle Plugins</a>
|
||||
@@ -42,10 +42,10 @@
|
||||
|
||||
<section class="side-card releases-card">
|
||||
<div class="side-heading"><h2>Releases</h2><span><?= $e(count($releases ?? [])) ?></span></div>
|
||||
<?php if ($wheelReleases === []): ?>
|
||||
<?php if ($installableReleases === []): ?>
|
||||
<div class="release-warning">
|
||||
<strong>Kein installierbares Release</strong>
|
||||
<p>Für die automatische Installation durch den Host-Agenten fehlt ein freigegebenes <code>.whl</code>-Artefakt.</p>
|
||||
<p>Für die automatische Installation fehlt ein freigegebenes Wheel oder commitgebundenes Source-Artefakt.</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (($releases ?? []) === []): ?>
|
||||
@@ -56,7 +56,7 @@
|
||||
<li>
|
||||
<div><strong><?= $e($release['version']) ?></strong><span><?= $e($formatDate($release['publishedAt'] ?? null)) ?></span></div>
|
||||
<div class="release-tags">
|
||||
<span class="status-pill success">Wheel</span>
|
||||
<span class="status-pill success"><?= ($release['artifactKind'] ?? '') === 'source_archive' ? 'Source-Build' : 'Wheel' ?></span>
|
||||
<span><?= $e($formatBytes($release['artifactSize'])) ?></span>
|
||||
</div>
|
||||
<code class="hash" title="SHA-256"><?= $e(substr($release['sha256'], 0, 16)) ?>…</code>
|
||||
|
||||
Reference in New Issue
Block a user