Skip to content

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.

feat(deployments): dev-only Test deployment trigger + simulated console tag

Juan Denis429eb7911ad4
diff --git a/frontend/src/pages/DeployConsole.jsx b/frontend/src/pages/DeployConsole.jsx
index fcbb89a3..df376d02 100644
--- a/frontend/src/pages/DeployConsole.jsx
+++ b/frontend/src/pages/DeployConsole.jsx
@@ -27,6 +27,10 @@ const fmtElapsed = (ms) => {
function humanizeTitle(job) {
if (!job) return 'Deployment';
+ if (job.kind === 'demo_deploy') {
+ const scenario = job.plan?.scenario || job.result?.scenario;
+ return `Test deployment${scenario ? ` — ${scenario}` : ''}`;
+ }
if (job.kind === 'template_install') {
const name = job.plan?.template_name || job.plan?.app_name || job.app_name || 'app';
return `Installing ${name}`;
@@ -167,6 +171,11 @@ export default function DeployConsole() {
</Link>
<h1 className="deploy-console__title">{humanizeTitle(job)}</h1>
<div className="deploy-console__meta">
+ {job?.kind === 'demo_deploy' && (
+ <span className="deploy-console__pill deploy-console__pill--demo" title="Scripted test deployment — no real resources were touched">
+ Simulated
+ </span>
+ )}
<span className={`deploy-console__pill deploy-console__pill--${meta.cls}`}>
<StatusIcon size={14} className={status === 'running' ? 'deploy-console__spin' : ''} />
{meta.label}
diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsx
index 35e077d2..d6ad7b57 100644
--- a/frontend/src/pages/Deployments.jsx
+++ b/frontend/src/pages/Deployments.jsx
@@ -9,9 +9,11 @@ import {
Loader2,
GitBranch,
PlayCircle,
+ FlaskConical,
} from 'lucide-react';
import api from '../services/api';
import { StatStrip, Stat } from '../components/StatCard';
+import Modal from '../components/Modal';
import { Button } from '@/components/ui/button';
import { useTopbarActions } from '@/hooks/useTopbarActions';
@@ -53,6 +55,13 @@ const Deployments = () => {
const [autoRefresh, setAutoRefresh] = useState(true);
const refreshRef = useRef(null);
+ // Simulated deployments (dev-only): null until the backend confirms the
+ // gate is on — a 404 (production) simply keeps the trigger hidden.
+ const [simInfo, setSimInfo] = useState(null);
+ const [simOpen, setSimOpen] = useState(false);
+ const [simSpeed, setSimSpeed] = useState('fast');
+ const [simBusy, setSimBusy] = useState(null);
+
const loadJobs = async () => {
try {
const params = {};
@@ -78,8 +87,22 @@ const Deployments = () => {
useEffect(() => {
loadServers();
+ api.getDeploySimulateInfo()
+ .then((data) => setSimInfo(data?.enabled ? data : null))
+ .catch(() => setSimInfo(null));
}, []);
+ const runScenario = async (scenarioId) => {
+ setSimBusy(scenarioId);
+ try {
+ const res = await api.simulateDeployment(scenarioId, simSpeed);
+ if (res?.job_id) navigate(`/deployments/${res.job_id}`);
+ } catch (err) {
+ console.error('Failed to start test deployment', err);
+ setSimBusy(null);
+ }
+ };
+
useEffect(() => {
loadJobs();
}, [statusFilter, serverFilter]);
@@ -101,6 +124,12 @@ const Deployments = () => {
useTopbarActions(() =>
<>
+ {simInfo?.enabled && (
+ <Button variant="outline" size="sm" onClick={() => setSimOpen(true)}>
+ <FlaskConical size={16} />
+ Test deployment
+ </Button>
+ )}
<Button variant="outline" size="sm" asChild>
<Link to="/services/new">
<GitBranch size={16} />
@@ -120,7 +149,7 @@ const Deployments = () => {
<RefreshCw size={16} /> Refresh
</Button>
</>,
- [autoRefresh]
+ [autoRefresh, simInfo?.enabled]
);
return (
@@ -224,6 +253,44 @@ const Deployments = () => {
)}
</div>
</div>
+
+ <Modal
+ open={simOpen}
+ onClose={() => setSimOpen(false)}
+ title="Run a test deployment"
+ size="md"
+ >
+ <p className="deployments-page__sim-intro">
+ Streams scripted output through the real deploy pipeline — no
+ containers, files, or servers are touched. Development only.
+ </p>
+ <label className="deployments-page__sim-speed">
+ Speed
+ <select value={simSpeed} onChange={(e) => setSimSpeed(e.target.value)}>
+ <option value="fast">Fast</option>
+ <option value="realtime">Realtime</option>
+ </select>
+ </label>
+ <div className="deployments-page__sim-list">
+ {(simInfo?.scenarios || []).map((s) => (
+ <button
+ key={s.id}
+ type="button"
+ className="deployments-page__sim-scenario"
+ onClick={() => runScenario(s.id)}
+ disabled={simBusy !== null}
+ >
+ <span className="deployments-page__sim-scenario-text">
+ <strong>{s.name}</strong>
+ <span>{s.description}</span>
+ </span>
+ {simBusy === s.id && (
+ <Loader2 size={15} className="deployments-page__spin" />
+ )}
+ </button>
+ ))}
+ </div>
+ </Modal>
</div>
);
};
diff --git a/frontend/src/services/api/deploymentJobs.js b/frontend/src/services/api/deploymentJobs.js
index d7b0110c..5988f34b 100644
--- a/frontend/src/services/api/deploymentJobs.js
+++ b/frontend/src/services/api/deploymentJobs.js
@@ -26,3 +26,16 @@ export async function getDeploymentJobLogs(jobId, afterId = null) {
export async function retryDeploymentJob(jobId) {
return this.request(`/deployment-jobs/${jobId}/retry`, { method: 'POST' });
}
+
+// Simulated deployments (plan 51.5 dev tool). The GET 404s when the backend
+// gate (DEMO_DEPLOYS_ENABLED) is off — callers treat that as "hidden".
+export async function getDeploySimulateInfo() {
+ return this.request('/deployment-jobs/simulate');
+}
+
+export async function simulateDeployment(scenario, speed = 'fast') {
+ return this.request('/deployment-jobs/simulate', {
+ method: 'POST',
+ body: { scenario, speed },
+ });
+}
diff --git a/frontend/src/styles/pages/_deploy-console.scss b/frontend/src/styles/pages/_deploy-console.scss
index 1e7dbc8f..5cf21c9a 100644
--- a/frontend/src/styles/pages/_deploy-console.scss
+++ b/frontend/src/styles/pages/_deploy-console.scss
@@ -76,6 +76,13 @@ $dc-surface-line: rgba(255, 255, 255, 0.04);
&--running { background: var(--accent-bg); color: var(--accent-bright); }
&--succeeded { background: var(--green-bg); color: var(--green); }
&--failed { background: var(--red-bg); color: var(--red); }
+
+ // Demo/simulated jobs (plan 51.5): visually distinct from status pills.
+ &--demo {
+ background: transparent;
+ color: $text-tertiary;
+ border: 1px dashed $border-subtle;
+ }
}
&__step-count,
diff --git a/frontend/src/styles/pages/_deployments.scss b/frontend/src/styles/pages/_deployments.scss
index 364249d2..96d8f1e1 100644
--- a/frontend/src/styles/pages/_deployments.scss
+++ b/frontend/src/styles/pages/_deployments.scss
@@ -350,6 +350,82 @@
&__spin {
animation: deployments-spin 1s linear infinite;
}
+
+ // ---- test-deployment (simulated) scenario picker ----
+ &__sim-intro {
+ margin: 0 0 $space-3;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ line-height: 1.5;
+ }
+
+ &__sim-speed {
+ display: flex;
+ align-items: center;
+ gap: $space-2;
+ margin-bottom: $space-3;
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ font-weight: $font-weight-semibold;
+
+ select {
+ min-height: 30px;
+ padding: $space-1 $space-2;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ color: $text-primary;
+ font-size: $font-size-sm;
+ cursor: pointer;
+ }
+ }
+
+ &__sim-list {
+ display: grid;
+ gap: $space-2;
+ }
+
+ &__sim-scenario {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-3;
+ width: 100%;
+ padding: $space-3;
+ background: $bg-elevated;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ cursor: pointer;
+ text-align: left;
+
+ &:hover:not(:disabled) {
+ background: $bg-hover;
+ border-color: $accent-primary;
+ }
+
+ &:disabled {
+ opacity: 0.6;
+ cursor: default;
+ }
+ }
+
+ &__sim-scenario-text {
+ display: grid;
+ gap: 2px;
+ min-width: 0;
+
+ strong {
+ color: $text-primary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ }
+
+ span {
+ color: $text-tertiary;
+ font-size: $font-size-xs;
+ line-height: 1.4;
+ }
+ }
}
@keyframes deployments-spin {