ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(build-release): make release builder work on Windows/Git Bash
Juan Denisedf6260deece
diff --git a/frontend/src/components/service-detail/SettingsTab.jsx b/frontend/src/components/service-detail/SettingsTab.jsxindex c71f60e6..f5124c5b 100644--- a/frontend/src/components/service-detail/SettingsTab.jsx+++ b/frontend/src/components/service-detail/SettingsTab.jsx@@ -9,6 +9,7 @@ import {Shield,CircleCheck,CircleX,+ Sparkles,} from 'lucide-react';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';@@ -298,6 +299,12 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {const [contextLoading, setContextLoading] = useState(true);const [email, setEmail] = useState(() => localStorage.getItem('serverkit_ssl_email') || '');+ // "Give it a subdomain" — publish the app at a managed <label>.<base> host.+ const [subdomainModal, setSubdomainModal] = useState(null); // { base_domain, dns_mode }+ const [subdomainLabel, setSubdomainLabel] = useState('');+ const [suggesting, setSuggesting] = useState(false);+ const [publishing, setPublishing] = useState(false);+const isPublicDomain = !!primaryDomain&& !/^(localhost|127\.|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(primaryDomain)&& primaryDomain.includes('.');@@ -357,6 +364,45 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {}}+ async function handleSuggestSubdomain() {+ setSuggesting(true);+ try {+ const res = await api.suggestSubdomain(app.id);+ if (!res.base_domain) {+ toast.info('Set a managed-sites base domain in Settings → Sites to publish on a subdomain.', 6000);+ return;+ }+ // Prefill the editable label from the suggestion (<label>.<base>).+ const suggestedLabel = (res.suggestion || '').replace(`.${res.base_domain}`, '');+ setSubdomainLabel(suggestedLabel);+ setSubdomainModal({ base_domain: res.base_domain, dns_mode: res.dns_mode });+ } catch (err) {+ toast.error(err.message || 'Failed to suggest a subdomain');+ } finally {+ setSuggesting(false);+ }+ }++ async function handleGiveSubdomain() {+ setPublishing(true);+ try {+ const res = await api.giveSubdomain(app.id, subdomainLabel.trim());+ if (res.success) {+ if (res.warning) toast.warning(res.warning);+ toast.success(res.url ? `Published at ${res.url}` : 'Subdomain published');+ setSubdomainModal(null);+ setSubdomainLabel('');+ onUpdate();+ } else {+ toast.error(res.error || 'Failed to publish subdomain');+ }+ } catch (err) {+ toast.error(err.message || 'Failed to publish subdomain');+ } finally {+ setPublishing(false);+ }+ }+async function handleEnableSSL() {if (!primaryDomain) { toast.error('No primary domain configured'); return; }if (!email.trim() || !email.includes('@')) { toast.error('Enter a valid email for certificate expiry notices'); return; }@@ -429,6 +475,16 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {)}</div>+ {/* One-click publish at a managed subdomain (<slug>.<base>). Works+ whether or not a domain is already attached. */}+ <div className="svc-give-subdomain">+ <Button variant="outline" onClick={handleSuggestSubdomain} disabled={suggesting}>+ <Sparkles size={14} />+ {suggesting ? 'Checking…' : 'Give it a subdomain'}+ </Button>+ <span className="form-hint">Publish this service at a ServerKit-managed subdomain.</span>+ </div>+{!primaryDomain ? (<div className="ssl-guide"><p className="hint">No domain is attached to this service yet. Add one to expose it on a public URL and enable HTTPS.</p>@@ -509,6 +565,47 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {</div></div>)}++ {subdomainModal && (+ <div className="modal-overlay" onClick={() => setSubdomainModal(null)}>+ <div className="modal" onClick={e => e.stopPropagation()}>+ <div className="modal-header">+ <h2>Give it a subdomain</h2>+ <button className="modal-close" onClick={() => setSubdomainModal(null)}>×</button>+ </div>+ <div className="modal-body">+ <p className="hint">+ Publish <strong>{app.name}</strong> at a managed subdomain of{' '}+ <code>{subdomainModal.base_domain}</code>.+ </p>+ <div className="form-group">+ <Label>Subdomain</Label>+ <div className="svc-subdomain-input">+ <Input+ type="text"+ value={subdomainLabel}+ onChange={(e) => setSubdomainLabel(e.target.value)}+ placeholder="my-app"+ disabled={publishing}+ />+ <span className="svc-subdomain-input__suffix">.{subdomainModal.base_domain}</span>+ </div>+ <span className="form-hint">+ {subdomainModal.dns_mode === 'wildcard'+ ? 'Wildcard DNS is configured — this resolves instantly, no record needed.'+ : 'Per-site mode — a DNS record will be created for this host.'}+ </span>+ </div>+ </div>+ <div className="modal-footer">+ <Button variant="outline" onClick={() => setSubdomainModal(null)} disabled={publishing}>Cancel</Button>+ <Button onClick={handleGiveSubdomain} disabled={publishing || !subdomainLabel.trim()}>+ {publishing ? 'Publishing…' : 'Publish'}+ </Button>+ </div>+ </div>+ </div>+ )}</div>);};diff --git a/frontend/src/pages/DNSZones.jsx b/frontend/src/pages/DNSZones.jsxindex aedecbc1..58bfc194 100644--- a/frontend/src/pages/DNSZones.jsx+++ b/frontend/src/pages/DNSZones.jsx@@ -1,11 +1,12 @@import React, { useState, useEffect, useCallback } from 'react';-import { Globe } from 'lucide-react';+import { Globe, Layers } from 'lucide-react';import { useTopbarActions } from '@/hooks/useTopbarActions';import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useAuth } from '../contexts/AuthContext';import PageLoader from '../components/PageLoader';import EmptyState from '../components/EmptyState';+import { formatRelativeTime } from '../utils/serviceTypes';import ConfirmDialog from '../components/ConfirmDialog';import { FormField, FormRow } from '../components/FormField';import { Button } from '@/components/ui/button';@@ -33,6 +34,15 @@ const DNSZones = () => {const [propagationResults, setPropagationResults] = useState([]);const [deleteConfirm, setDeleteConfirm] = useState(null);+ // "All managed records" — every provider record ServerKit owns, across all+ // zones. Shown in the right column when no specific zone is selected.+ const [showManaged, setShowManaged] = useState(false);+ const [managedRecords, setManagedRecords] = useState(null); // null = not loaded+ const [managedLoading, setManagedLoading] = useState(false);+ // Inline propagation results keyed by record name (#13, reuses checkDNSPropagation).+ const [managedPropagation, setManagedPropagation] = useState({});+ const [managedChecking, setManagedChecking] = useState(null);+// Records panel view: 'managed' (ServerKit records) | 'provider' (live mirror)const [recordsView, setRecordsView] = useState('managed');const [mirror, setMirror] = useState(null); // { records, counts } | { error }@@ -74,6 +84,8 @@ const DNSZones = () => {const data = await api.getDNSRecords(zoneId);setRecords(data.records || []);setSelectedZone(zones.find(z => z.id === zoneId));+ // Selecting a zone leaves the cross-zone managed view.+ setShowManaged(false);// Reset the provider mirror when switching zones.setRecordsView('managed');setMirror(null);@@ -82,6 +94,51 @@ const DNSZones = () => {}};+ // Every provider record ServerKit owns, across all zones (#14). Lazily+ // loaded the first time the panel is opened; refreshable thereafter.+ const loadManagedRecords = useCallback(async () => {+ setManagedLoading(true);+ try {+ const data = await api.getManagedDnsRecords();+ setManagedRecords(data.records || []);+ } catch (err) {+ toast.error(err.message || 'Failed to load managed records');+ setManagedRecords([]);+ } finally {+ setManagedLoading(false);+ }+ }, [toast]);++ const handleShowManaged = () => {+ setShowManaged(true);+ setSelectedZone(null);+ setRecords([]);+ if (managedRecords === null) loadManagedRecords();+ };++ // Inline propagation check for a single managed record (#13). Reuses the+ // existing checkDNSPropagation endpoint; result expands under the row.+ const handleCheckManaged = async (name) => {+ if (managedPropagation[name]) {+ // Toggle the expansion closed if already shown.+ setManagedPropagation(prev => {+ const next = { ...prev };+ delete next[name];+ return next;+ });+ return;+ }+ setManagedChecking(name);+ try {+ const data = await api.checkDNSPropagation(name);+ setManagedPropagation(prev => ({ ...prev, [name]: data.results || [] }));+ } catch (err) {+ toast.error(err.message || 'Propagation check failed');+ } finally {+ setManagedChecking(null);+ }+ };+// Live records as they exist in the provider (Cloudflare only). Lazily// loaded the first time the "In your provider" view is opened per zone.const loadMirror = async (zoneId) => {@@ -201,6 +258,14 @@ const DNSZones = () => {<div className="sk-tabgroup__inner dns-zones-page"><div className="dns-layout"><div className="dns-zones-list">+ <button+ type="button"+ className={`dns-managed-link ${showManaged ? 'active' : ''}`}+ onClick={handleShowManaged}+ >+ <Layers size={15} />+ <span>All managed records</span>+ </button>{zones.map(zone => (<div key={zone.id}className={`dns-zone-item ${selectedZone?.id === zone.id ? 'active' : ''}`}@@ -220,6 +285,88 @@ const DNSZones = () => {{zones.length === 0 && <EmptyState icon={Globe} title="No DNS zones configured" />}</div>+ {showManaged && (+ <div className="dns-records-panel">+ <div className="dns-records-panel__header">+ <h2>All managed records</h2>+ <div className="dns-records-panel__actions">+ {managedRecords !== null && (+ <span className="dns-managed__count">{managedRecords.length} total</span>+ )}+ <Button variant="outline" size="sm" onClick={loadManagedRecords} disabled={managedLoading}>+ {managedLoading ? 'Refreshing…' : 'Refresh'}+ </Button>+ </div>+ </div>+ <p className="dns-managed__hint">+ Every DNS record ServerKit owns across all your provider zones.+ </p>+ <DataTable+ tableClassName="sk-dtable dns-records-table"+ sortable={false}+ loading={managedLoading}+ data={managedRecords || []}+ keyField="id"+ emptyTitle="No managed records"+ emptyMessage="ServerKit hasn't created any provider DNS records yet."+ renderRow={(rec, { key, className }) => {+ const results = managedPropagation[rec.name];+ return (+ <React.Fragment key={key}>+ <tr className={className}>+ <td>+ <span className={`dns-rtype dns-rtype--${(rec.record_type || '').toLowerCase()}`}>{rec.record_type}</span>+ <span className="dns-managed__name">{rec.name}</span>+ </td>+ <td><span className="sk-cell-mono">{rec.provider_zone_id || '-'}</span></td>+ <td>{rec.source ? <span className="dns-source-chip">{rec.source}</span> : '-'}</td>+ <td>{rec.app_name || '-'}</td>+ <td>{formatRelativeTime(rec.created_at) || '-'}</td>+ <td className="dns-managed__action-cell">+ <Button+ variant="outline"+ size="sm"+ onClick={() => handleCheckManaged(rec.name)}+ disabled={managedChecking === rec.name}+ >+ {managedChecking === rec.name ? 'Checking…' : results ? 'Hide' : 'Check'}+ </Button>+ </td>+ </tr>+ {results && (+ <tr className="dns-managed__prop-row">+ <td colSpan={6}>+ <div className="dns-managed__prop">+ {results.length === 0 && (+ <span className="text-muted">No propagation data.</span>+ )}+ {results.map((r, i) => (+ <div key={i} className="propagation-row">+ <span className={`status-dot status-dot--${r.propagated ? 'success' : 'danger'}`} />+ <strong>{r.nameserver}</strong>+ <span className="text-muted">({r.ip})</span>+ <span className="text-mono">{r.result?.join(', ') || 'No result'}</span>+ </div>+ ))}+ </div>+ </td>+ </tr>+ )}+ </React.Fragment>+ );+ }}+ columns={[+ { key: 'record', header: 'Record' },+ { key: 'zone', header: 'Zone' },+ { key: 'source', header: 'Source' },+ { key: 'app', header: 'App' },+ { key: 'created_at', header: 'Created' },+ { key: 'actions', header: '' },+ ]}+ />+ </div>+ )}+{selectedZone && (<div className="dns-records-panel"><div className="dns-records-panel__header">diff --git a/frontend/src/services/api/dns.js b/frontend/src/services/api/dns.jsindex b9cc1c84..2a580b7a 100644--- a/frontend/src/services/api/dns.js+++ b/frontend/src/services/api/dns.js@@ -66,6 +66,11 @@ export async function getZoneMirror(zoneId) {return this.request(`/dns/${zoneId}/mirror`);}+// Every DNS record ServerKit owns across all provider zones, in one place.+export async function getManagedDnsRecords() {+ return this.request('/dns/managed');+}+export async function importDNSZone(zoneId, zoneFile) {return this.request(`/dns/${zoneId}/import`, {method: 'POST',diff --git a/frontend/src/services/api/files.js b/frontend/src/services/api/files.jsindex aa63b18a..87ea33c4 100644--- a/frontend/src/services/api/files.js+++ b/frontend/src/services/api/files.js@@ -481,6 +481,20 @@ export async function verifyDomain(domainId) {return this.request(`/domains/${domainId}/verify`);}+// Suggest a managed-sites subdomain (<slug>.<base>) for an app so the UI can+// prefill the "give this a subdomain" action.+export async function suggestSubdomain(applicationId) {+ return this.request(`/domains/suggest-subdomain?application_id=${applicationId}`);+}++// Publish an app at <label>.<base_domain> in one click. Label is optional —+// omit it when falsy so the backend derives one from the app name.+export async function giveSubdomain(applicationId, label) {+ const body = { application_id: applicationId };+ if (label) body.label = label;+ return this.request('/domains/give-subdomain', { method: 'POST', body });+}+export async function getDomainsNginxSites() {return this.request('/domains/nginx/sites');}diff --git a/frontend/src/styles/pages/_dns-zones.scss b/frontend/src/styles/pages/_dns-zones.scssindex 758f3890..f408f82b 100644--- a/frontend/src/styles/pages/_dns-zones.scss+++ b/frontend/src/styles/pages/_dns-zones.scss@@ -128,6 +128,70 @@grid-template-columns: 1fr 1fr;gap: $spacing-md;}++ // "All managed records" — cross-zone view of every record ServerKit owns.+ .dns-managed-link {+ display: flex;+ align-items: center;+ gap: $spacing-sm;+ width: 100%;+ padding: $spacing-md;+ margin-bottom: $spacing-xs;+ background: $card-bg;+ border: 1px solid $border-color;+ border-radius: $radius-md;+ color: var(--text);+ font-size: 0.9rem;+ font-weight: 600;+ text-align: left;+ cursor: pointer;+ transition: border-color 0.15s;++ &:hover, &.active { border-color: $primary-color; }++ svg { color: var(--text-dim); flex-shrink: 0; }+ }++ .dns-managed {+ &__hint {+ margin: -#{$spacing-sm} 0 $spacing-md;+ font-size: 0.85rem;+ color: var(--text-dim);+ }++ &__count {+ font-size: 0.85rem;+ color: var(--text-dim);+ align-self: center;+ }++ // record_type chip already sits inline; space the name after it.+ &__name { margin-left: $spacing-sm; }++ &__action-cell { text-align: right; white-space: nowrap; }++ &__prop-row td { padding: 0 16px $spacing-sm; }++ &__prop {+ padding: $spacing-sm $spacing-md;+ background: var(--surface-2);+ border-radius: $radius-md;+ }+ }++ // Provenance chip for a managed record (source: zone/ddns/wordpress/...).+ .dns-source-chip {+ display: inline-flex;+ align-items: center;+ padding: 2px 8px;+ border-radius: 5px;+ font-family: var(--mono);+ font-size: 10.5px;+ font-weight: 600;+ letter-spacing: 0.03em;+ background: var(--surface-3);+ color: var(--text-dim);+ }}// Colored DNS record-type chip (redesign)diff --git a/frontend/src/styles/pages/_service-detail.scss b/frontend/src/styles/pages/_service-detail.scssindex 7adb2cdc..5a466a79 100644--- a/frontend/src/styles/pages/_service-detail.scss+++ b/frontend/src/styles/pages/_service-detail.scss@@ -830,6 +830,35 @@ h3.svc-eyebrow {margin-top: $space-3;}+ // "Give it a subdomain" action — sits under the domain/SSL summary grid.+ .svc-give-subdomain {+ display: flex;+ align-items: center;+ gap: $space-3;+ flex-wrap: wrap;+ margin-top: $space-3;+ padding-top: $space-3;+ border-top: 1px solid var(--border-soft);++ .form-hint { margin: 0; }+ }++ // Editable label + fixed base-domain suffix inside the publish modal.+ .svc-subdomain-input {+ display: flex;+ align-items: center;+ gap: $space-2;++ input { flex: 1; min-width: 0; }++ &__suffix {+ font-family: var(--mono);+ font-size: $font-size-sm;+ color: var(--text-dim);+ white-space: nowrap;+ }+ }+.ssl-checklist {display: flex;flex-direction: column;diff --git a/scripts/build-release.sh b/scripts/build-release.shindex 2911a85f..2f590fd1 100644--- a/scripts/build-release.sh+++ b/scripts/build-release.sh@@ -13,29 +13,6 @@set -euo pipefailBUILD_DIR="/tmp/serverkit-release-build"-# Patterns excluded from the release tarball even when they are not gitignored-# on the build machine (e.g. local test output, scratch images).-RELEASE_EXCLUDES=(- .git- node_modules- venv- .venv- .venv-wsl- __pycache__- .pytest_cache- instance- dist- /backups- /backend/instance/backups- /backend/dev-data/backups- /scripts/test/output- '*.png'- '*.jpeg'- '*.jpg'- '*.log'- '*.tmp'- '*.pyc'-)# ---------------------------------------------------------------------------# Terminal styling (violet ServerKit identity, degrades to plain text)@@ -91,52 +68,11 @@ mkdir -p "$BUILD_DIR"step "Copying the source tree..."REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"-# Prefer rsync when available; fall back to cp + manual cleanup for Windows/Git Bash.-if command -v rsync &>/dev/null; then- rsync -a \- --exclude=.git \- --exclude=node_modules \- --exclude=venv \- --exclude=.venv \- --exclude=.venv-wsl \- --exclude=__pycache__ \- --exclude=.pytest_cache \- --exclude=instance \- --exclude=dist \- --exclude=/backups \- --exclude=/backend/instance/backups \- --exclude=/backend/dev-data/backups \- --exclude=/scripts/test/output \- --exclude='*.png' \- --exclude='*.jpeg' \- --exclude='*.jpg' \- --exclude='*.log' \- --exclude='*.tmp' \- --exclude='*.pyc' \- "$REPO_ROOT/" "$BUILD_DIR/"-else- cp -r "$REPO_ROOT/"* "$REPO_ROOT/".[^.]* "$BUILD_DIR/" 2>/dev/null || true- rm -rf "$BUILD_DIR/.git" \- "$BUILD_DIR/node_modules" \- "$BUILD_DIR/venv" \- "$BUILD_DIR/.venv" \- "$BUILD_DIR/.venv-wsl" \- "$BUILD_DIR/backend/venv" \- "$BUILD_DIR/backend/.venv" \- "$BUILD_DIR/backend/.venv-wsl" \- "$BUILD_DIR/backend/__pycache__" \- "$BUILD_DIR/.pytest_cache" \- "$BUILD_DIR/backend/.pytest_cache" \- "$BUILD_DIR/instance" \- "$BUILD_DIR/backend/instance" \- "$BUILD_DIR/dist" \- "$BUILD_DIR/frontend/dist" \- "$BUILD_DIR/backups" \- "$BUILD_DIR/backend/instance/backups" \- "$BUILD_DIR/backend/dev-data/backups" \- "$BUILD_DIR/scripts/test/output" \- "$BUILD_DIR/frontend/node_modules"-fi+# Copy the source tree with tar, which handles broken symlinks and avoids+# the long rm -rf timeouts that cp + rm can hit on Windows/Git Bash.+mkdir -p "$BUILD_DIR"+cd "$REPO_ROOT"+tar -cf - --exclude='./.git' --exclude='./node_modules' --exclude='./venv' --exclude='./.venv' --exclude='./.venv-wsl' --exclude='./backend/venv' --exclude='./backend/.venv' --exclude='./backend/.venv-wsl' --exclude='./__pycache__' --exclude='./.pytest_cache' --exclude='./instance' --exclude='./dist' --exclude='./backups' --exclude='./backend/dev-data/backups' --exclude='./backend/instance/backups' --exclude='./scripts/test/output' --exclude='*.png' --exclude='*.jpeg' --exclude='*.jpg' --exclude='*.log' --exclude='*.tmp' --exclude='*.pyc' . | tar -C "$BUILD_DIR" -xf -# ---------------------------------------------------------------------------# Build the frontend bundle@@ -166,16 +102,30 @@ step "Creating the tarball..."# Land the tarball at the repo root (matches .gitignore's /serverkit-*.tar.gz).DEST_DIR="$REPO_ROOT"-# Build the tar exclude arguments.-TAR_EXCLUDES=()-for pat in "${RELEASE_EXCLUDES[@]}"; do- TAR_EXCLUDES+=(--exclude="$pat")-done-# Pack from the parent of BUILD_DIR with a transform so the archive contains# /opt/serverkit without moving directories across filesystems.cd "$(dirname "$BUILD_DIR")"-tar czf "${DEST_DIR}/${OUTPUT}" ${TAR_EXCLUDES[@]} --transform 's|^serverkit-release-build|opt/serverkit|' serverkit-release-build+tar czf "${DEST_DIR}/${OUTPUT}" \+ --exclude='node_modules' \+ --exclude='venv' \+ --exclude='.venv' \+ --exclude='.venv-wsl' \+ --exclude='__pycache__' \+ --exclude='.pytest_cache' \+ --exclude='instance' \+ --exclude='dist' \+ --exclude='/backups' \+ --exclude='/backend/instance/backups' \+ --exclude='/backend/dev-data/backups' \+ --exclude='/scripts/test/output' \+ --exclude='*.png' \+ --exclude='*.jpeg' \+ --exclude='*.jpg' \+ --exclude='*.log' \+ --exclude='*.tmp' \+ --exclude='*.pyc' \+ --transform 's|^serverkit-release-build|opt/serverkit|' \+ serverkit-release-buildcd "$DEST_DIR"rm -rf "$BUILD_DIR"