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
Show slot deploys in the console and app detail
Juan Denisc697e7247bf7
diff --git a/backend/app/services/deployment_job_service.py b/backend/app/services/deployment_job_service.pyindex 7ab6cca8..36c2a170 100644--- a/backend/app/services/deployment_job_service.py+++ b/backend/app/services/deployment_job_service.py@@ -142,16 +142,17 @@ class DeploymentJobService:# Execution is delegated to DeploymentService.deploy; these steps only# drive the progress bar and mirror the milestones _run_app_deploy logs.# Deploy options ride in the plan so the async runner can honor them.+ # A slot deploy (plan 87) reports its own stages as it reaches them.+ from app.services.slot_deploy_service import SlotDeployService+ slot_steps = SlotDeployService.plan_steps(app)job.set_plan({'app_id': app.id,'app_name': app.name,'no_cache': bool(no_cache),'version_tag': version_tag,- 'steps': [- {'name': 'Prepare deployment'},- {'name': 'Build application'},- {'name': 'Start containers'},- ],+ 'slot_stages': bool(slot_steps),+ 'steps': [{'name': name} for name in (slot_steps or [+ 'Prepare deployment', 'Build application', 'Start containers'])],})db.session.add(job)db.session.commit()@@ -333,28 +334,35 @@ class DeploymentJobService:raise RuntimeError(f'Application not found for deployment job {job.id}')job.mark_running()+ plan = job.get_plan()+ steps = [s.get('name') for s in plan.get('steps') or []]+ slot_stages = bool(plan.get('slot_stages'))# set_step handles the current_step/name row update + commit, flushes# buffered lines, records per-step timings, and emits a live status.- runner.stream.set_step(1, 'Prepare deployment')+ runner.stream.set_step(1, steps[0] if slot_stages else 'Prepare deployment')runner.log('info', f"Deploying application '{app.name}' (trigger: {job.trigger})")- runner.stream.set_step(2, 'Build application')+ if not slot_stages:+ runner.stream.set_step(2, 'Build application')- plan = job.get_plan()+ from app.services import deploy_stagesfrom app.services.deployment_service import DeploymentService- result = DeploymentService.deploy(- app.id,- user_id=job.requested_by,- trigger=job.trigger or 'manual',- no_cache=bool(plan.get('no_cache')),- version_tag=plan.get('version_tag'),- log_callback=lambda line: runner.log('info', line),- )+ with deploy_stages.reporting(_stage_advancer(runner, steps) if slot_stages+ else (lambda name: None)):+ result = DeploymentService.deploy(+ app.id,+ user_id=job.requested_by,+ trigger=job.trigger or 'manual',+ no_cache=bool(plan.get('no_cache')),+ version_tag=plan.get('version_tag'),+ log_callback=lambda line: runner.log('info', line),+ )if not result.get('success'):raise RuntimeError(result.get('error') or 'Deployment failed')- runner.stream.set_step(3, 'Start containers')- runner.log('info', 'Containers started')+ if not slot_stages:+ runner.stream.set_step(3, 'Start containers')+ runner.log('info', 'Containers started')deployment = result.get('deployment') or {}job.mark_succeeded()@@ -749,3 +757,23 @@ class DeploymentJobService:if not server_id or server_id == 'local':return Nonereturn server_id+++def _stage_advancer(runner, steps):+ """Map a stage the deploy reports onto the job's step list (plan 87 §F).++ Matched by name, or by its first two words ("Boot slot") because which+ slot is idle can change between enqueue and run when deploys queue up.+ Only ever moves forward.+ """+ state = {'index': 1}++ def advance(name):+ prefix = ' '.join(name.split()[:2])+ for index, step in enumerate(steps, start=1):+ if step == name or (step or '').startswith(prefix):+ if index > state['index']:+ state['index'] = index+ runner.stream.set_step(index, name)+ return+ return advancediff --git a/backend/app/services/deployment_service.py b/backend/app/services/deployment_service.pyindex c2bba0c6..d5000c9b 100644--- a/backend/app/services/deployment_service.py+++ b/backend/app/services/deployment_service.py@@ -24,6 +24,7 @@ from app.models.application import Applicationfrom app.services.build_service import BuildServicefrom app.services.docker_service import DockerServicefrom app.services.git_service import GitService+from app.services import deploy_stagesfrom app import paths@@ -163,6 +164,7 @@ class DeploymentService:if log_callback:log_callback(f"Starting build for {app.name}...")+ deploy_stages.mark('Build')# An immutable tag per deployment: a rollback then redeploys# the image that actually ran, not whatever :latest became (§A1).from app.services.app_image_retention import deploy_image_tagdiff --git a/backend/app/services/slot_deploy_service.py b/backend/app/services/slot_deploy_service.pyindex 58030aff..86413e56 100644--- a/backend/app/services/slot_deploy_service.py+++ b/backend/app/services/slot_deploy_service.py@@ -228,6 +228,16 @@ class SlotDeployService:return DeploymentService.rollback(app.id, target_version=standby.deployment.version,user_id=user_id, log_callback=log)+ @classmethod+ def plan_steps(cls, app):+ """The Deploy Console stages of a slot deploy, or None for an app+ that deploys in place. PipelineStrip renders ``job.plan.steps`` as is."""+ if not app.slot_deploys_enabled:+ return None+ idle = other(app.active_slot) if app.active_slot in SLOTS else 'b'+ return ['Preflight', 'Build', f'Boot slot {idle.upper()}', 'Health gate',+ 'Switch', 'Watch']+@classmethoddef protected_images(cls, app) -> set:return {row.image_ref for row in AppSlot.query.filter_by(application_id=app.id).all()diff --git a/backend/tests/test_plan87_slot_deploys.py b/backend/tests/test_plan87_slot_deploys.pyindex 876a4296..7170a071 100644--- a/backend/tests/test_plan87_slot_deploys.py+++ b/backend/tests/test_plan87_slot_deploys.py@@ -529,3 +529,44 @@ def test_a_vhost_restore_point_brings_back_the_slot_it_pointed_at(app, world, moassert row.active_slot == 'a' and row.port == 8100assert world.containers[f'serverkit-app-{row.id}']['running'] is True++# ── §F: the Deploy Console walks the slot stages ─────────────────────────────++def test_a_slot_deploy_job_reports_each_stage_to_the_console(app, world, monkeypatch):+ from app.models.deployment_job import DeploymentJob+ from app.services.deployment_job_service import DeploymentJobService+ monkeypatch.setattr(DeploymentJobService, '_enqueue_app_deploy', classmethod(lambda cls, job: None))+ row = _live_app(world)+ _enable(row)++ queued = DeploymentJobService.enqueue_app_deploy(row)+ job = db.session.get(DeploymentJob, queued['job_id'])+ steps = [s['name'] for s in job.get_plan()['steps']]+ assert steps == ['Preflight', 'Build', 'Boot slot B', 'Health gate', 'Switch', 'Watch']++ from app.services.run_log_service import RunLogStream+ reached = []+ real = RunLogStream.set_step++ def spy(self, index, name):+ reached.append((index, name))+ return real(self, index, name)++ monkeypatch.setattr(RunLogStream, 'set_step', spy)++ result = DeploymentJobService.run_job(job.id)++ assert result['success'], result+ assert reached == [(1, 'Preflight'), (2, 'Build'), (3, 'Boot slot B'), (4, 'Health gate'),+ (5, 'Switch'), (6, 'Watch')]+++def test_an_in_place_deploy_job_keeps_its_three_steps(app, world, monkeypatch):+ from app.models.deployment_job import DeploymentJob+ from app.services.deployment_job_service import DeploymentJobService+ monkeypatch.setattr(DeploymentJobService, '_enqueue_app_deploy', classmethod(lambda cls, job: None))+ row = _live_app(world)+ queued = DeploymentJobService.enqueue_app_deploy(row)+ job = db.session.get(DeploymentJob, queued['job_id'])+ assert [s['name'] for s in job.get_plan()['steps']] == [+ 'Prepare deployment', 'Build application', 'Start containers']diff --git a/docs/screenshots/service-slot-settings.png b/docs/screenshots/service-slot-settings.pngnew file mode 100644index 00000000..571cb992Binary files /dev/null and b/docs/screenshots/service-slot-settings.png differdiff --git a/docs/screenshots/service-slots.png b/docs/screenshots/service-slots.pngnew file mode 100644index 00000000..f225b147Binary files /dev/null and b/docs/screenshots/service-slots.png differdiff --git a/frontend/src/components/apps/SlotDeploysPanel.jsx b/frontend/src/components/apps/SlotDeploysPanel.jsxnew file mode 100644index 00000000..3700be30--- /dev/null+++ b/frontend/src/components/apps/SlotDeploysPanel.jsx@@ -0,0 +1,181 @@+import { useEffect, useState } from 'react';+import { Layers } from 'lucide-react';+import api from '../../services/api';+import { useToast } from '../../contexts/useToast.js';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Switch } from '@/components/ui/switch';+import { useTranslation } from 'react-i18next';++// Must match app/services/deploy_settings.py DEFAULTS / _RULES.+const WATCH_DEFAULT = 60;+const WATCH_MAX = 900;+const STANDBY_DEFAULT = 10;+const STANDBY_MAX = 1440;++function intIn(value, min, max) {+ const n = Number(value);+ return Number.isInteger(n) && n >= min && n <= max ? n : null;+}++// A/B slot deploys (plan 87 §F): the opt-in and its knobs. Eligibility comes+// from the server with its reasons, so the toggle never promises what a+// deploy would then refuse.+const SlotDeploysPanel = ({ app, onChanged }) => {+ const { t } = useTranslation();+ const toast = useToast();+ const settings = app.deploy_settings || {};+ const [status, setStatus] = useState(null);+ const [toggling, setToggling] = useState(false);+ const [saving, setSaving] = useState(false);+ const [watch, setWatch] = useState(String(settings.watch_seconds ?? WATCH_DEFAULT));+ const [standby, setStandby] = useState(String(settings.standby_warm_minutes ?? STANDBY_DEFAULT));+ const [volumesOk, setVolumesOk] = useState(!!settings.slot_volumes_confirmed);++ useEffect(() => {+ let cancelled = false;+ api.getAppSlots(app.id)+ .then((data) => { if (!cancelled) setStatus(data); })+ .catch(() => {});+ return () => { cancelled = true; };+ }, [app.id, app.deploy_settings]);++ const watchValue = intIn(watch, 0, WATCH_MAX);+ const standbyValue = intIn(standby, 0, STANDBY_MAX);+ const dirty = (watchValue !== null && watchValue !== (settings.watch_seconds ?? WATCH_DEFAULT))+ || (standbyValue !== null && standbyValue !== (settings.standby_warm_minutes ?? STANDBY_DEFAULT))+ || volumesOk !== !!settings.slot_volumes_confirmed;++ async function handleToggle(next) {+ setToggling(true);+ try {+ const data = await api.setAppSlots(app.id, next);+ setStatus(data.slots);+ toast.success(next+ ? t('app.slotDeploysPanel.enabled', 'Slot deploys on. The running container is now slot A; the next deploy boots slot B.')+ : (data.note || t('app.slotDeploysPanel.disabled', 'Slot deploys off.')));+ onChanged?.();+ } catch (err) {+ toast.error(err.message || t('app.slotDeploysPanel.toggleFailed', 'Could not change slot deploys'));+ } finally {+ setToggling(false);+ }+ }++ async function handleSave() {+ setSaving(true);+ try {+ await api.updateApp(app.id, {+ deploy_settings: {+ watch_seconds: watchValue,+ standby_warm_minutes: standbyValue,+ slot_volumes_confirmed: volumesOk,+ },+ });+ toast.success(t('app.slotDeploysPanel.saved', 'Rollout settings saved.'));+ onChanged?.();+ } catch (err) {+ toast.error(err.message || t('app.slotDeploysPanel.saveFailed', 'Failed to save rollout settings'));+ } finally {+ setSaving(false);+ }+ }++ if (!status) return null;+ const { eligibility } = status;+ const hasVolumes = (status.volumes || []).length > 0;++ return (+ <div className="app-panel">+ <div className="app-panel-header">+ <Layers />+ <span>{t('app.slotDeploysPanel.title', 'Slot deploys')}</span>+ </div>+ <div className="app-panel-body">+ <p className="app-panel-hint">+ {t('app.slotDeploysPanel.intro', 'Each deploy boots the new release in a second slot on its own port while the live one keeps serving. It switches traffic only after the new release passes its health check, watches it for a while, and switches back on its own if it falls over. The previous release stays warm for an instant manual switch back.')}+ </p>++ <div className="settings-row">+ <div className="settings-label">+ <span>{t('app.slotDeploysPanel.enable', 'Use slot deploys')}</span>+ <span className="settings-hint">+ {eligibility.eligible+ ? t('app.slotDeploysPanel.enableHint', 'Turning it on restarts nothing: the running container becomes slot A.')+ : eligibility.reasons.join(' ')}+ </span>+ </div>+ <div className="settings-control">+ <Switch+ checked={!!status.enabled}+ onCheckedChange={handleToggle}+ disabled={toggling || (!status.enabled && !eligibility.eligible)}+ aria-label={t('app.slotDeploysPanel.enable', 'Use slot deploys')}+ />+ </div>+ </div>++ <div className="settings-row">+ <div className="settings-label">+ <label htmlFor={`slot-watch-${app.id}`}>+ {t('app.slotDeploysPanel.watch', 'Watch window (seconds)')}+ </label>+ <span className="settings-hint">+ {t('app.slotDeploysPanel.watchHint', 'How long a release is watched after it goes live. If it stops answering in that time, traffic goes back to the previous release. 0 turns the watch off.')}+ </span>+ </div>+ <div className="settings-control">+ <Input id={`slot-watch-${app.id}`} type="number" min={0} max={WATCH_MAX}+ value={watch} onChange={(e) => setWatch(e.target.value)} disabled={saving} />+ </div>+ </div>++ <div className="settings-row">+ <div className="settings-label">+ <label htmlFor={`slot-standby-${app.id}`}>+ {t('app.slotDeploysPanel.standby', 'Keep the previous release warm (minutes)')}+ </label>+ <span className="settings-hint">+ {t('app.slotDeploysPanel.standbyHint', 'While warm, switching back takes seconds. After that it is stopped: it no longer uses memory, and switching back starts it first.')}+ </span>+ </div>+ <div className="settings-control">+ <Input id={`slot-standby-${app.id}`} type="number" min={0} max={STANDBY_MAX}+ value={standby} onChange={(e) => setStandby(e.target.value)} disabled={saving} />+ </div>+ </div>++ {hasVolumes && (+ <div className="settings-row">+ <div className="settings-label">+ <span>{t('app.slotDeploysPanel.volumes', 'Two copies may share the volumes')}</span>+ <span className="settings-hint">+ {t('app.slotDeploysPanel.volumesHint', 'For a few seconds around each switch both releases mount the same volumes. Leave this off if the app keeps something like SQLite there, which breaks when two processes write to it.')}+ </span>+ </div>+ <div className="settings-control">+ <Switch checked={volumesOk} onCheckedChange={setVolumesOk} disabled={saving}+ aria-label={t('app.slotDeploysPanel.volumes', 'Two copies may share the volumes')} />+ </div>+ </div>+ )}++ <div className="settings-row">+ <div className="settings-label" />+ <div className="settings-control">+ <Button size="sm" onClick={handleSave}+ disabled={saving || !dirty || watchValue === null || standbyValue === null}>+ {saving ? t('common.editing.saving', 'Saving…') : t('common.actions.save', 'Save')}+ </Button>+ </div>+ </div>++ <p className="app-panel-hint">+ {t('app.slotDeploysPanel.schemaRule', 'Both releases use the same database during the switch. Keep schema changes backward-compatible for one deploy: add first, deploy, remove later.')}+ </p>+ </div>+ </div>+ );+};++export default SlotDeploysPanel;diff --git a/frontend/src/components/service-detail/OverviewTab.jsx b/frontend/src/components/service-detail/OverviewTab.jsxindex 7516f3ec..ff948276 100644--- a/frontend/src/components/service-detail/OverviewTab.jsx+++ b/frontend/src/components/service-detail/OverviewTab.jsx@@ -11,6 +11,7 @@ import ScheduledTasksCard from '../ScheduledTasksCard';import RequestMetricsCard from './RequestMetricsCard';import AttachmentsCard from './AttachmentsCard';import PoolerCard from './PoolerCard';+import SlotsCard from './SlotsCard';import HintsCard from './HintsCard';import { KpiBand, MetricCard, Pill, Gauge, EnvTag, statusKind } from '@/components/ds';import { usePolling } from '@/hooks/usePolling';@@ -342,6 +343,9 @@ const OverviewTab = ({ app, deployConfig }) => {{/* PgBouncer beside an installed PostgreSQL (plan 86 §D1) */}<PoolerCard app={app} />+ {/* A/B slot deploys: live release, warm standby, switch back (plan 87) */}+ <SlotsCard app={app} />+{/* Recent Deployments */}<div className="overview-tab__card overview-tab__card--full"><div className="overview-tab__card-header-row">diff --git a/frontend/src/components/service-detail/SettingsTab.jsx b/frontend/src/components/service-detail/SettingsTab.jsxindex 8df5431b..15d56df2 100644--- a/frontend/src/components/service-detail/SettingsTab.jsx+++ b/frontend/src/components/service-detail/SettingsTab.jsx@@ -30,6 +30,7 @@ import VolumesPanel from '../apps/VolumesPanel';import ResourceLimitsPanel from '../apps/ResourceLimitsPanel';import MicroCachePanel from '../apps/MicroCachePanel';import DeploySafetyPanel from '../apps/DeploySafetyPanel';+import SlotDeploysPanel from '../apps/SlotDeploysPanel';import AppWafPanel from '../apps/AppWafPanel';import BuildTab from '../appdetail/BuildTab';import DeployTab from '../appdetail/DeployTab';@@ -356,6 +357,7 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =><div className="svc-settings__section"><h3 className="svc-settings__section-title">{t('app.settingsTab.healthRollout', 'Health & Rollout')}</h3><DeploySafetyPanel app={app} onChanged={onUpdate} />+ <SlotDeploysPanel app={app} onChanged={onUpdate} /></div>)}diff --git a/frontend/src/components/service-detail/SlotsCard.jsx b/frontend/src/components/service-detail/SlotsCard.jsxnew file mode 100644index 00000000..e1a768d8--- /dev/null+++ b/frontend/src/components/service-detail/SlotsCard.jsx@@ -0,0 +1,145 @@+import { useCallback, useEffect, useState } from 'react';+import { Link } from 'react-router-dom';+import { useTranslation } from 'react-i18next';+import api from '../../services/api';+import { Button } from '@/components/ui/button';+import { Pill } from '@/components/ds';+import { useToast } from '../../contexts/useToast.js';+import { useConfirm } from '@/hooks/useConfirm';+import { formatRelativeShort } from '@/utils/intl';++// A/B slot deploys (plan 87 §F). Shows which slot serves, which one is the+// standby and for how long it stays warm, with the instant switch back. When+// the feature is off it says why the app does or does not qualify.+function minutesLeft(until) {+ if (!until) return null;+ const ms = new Date(until).getTime() - Date.now();+ return ms > 0 ? Math.ceil(ms / 60000) : 0;+}++function shortSha(sha) {+ return sha ? sha.slice(0, 7) : null;+}++export default function SlotsCard({ app }) {+ const { t } = useTranslation();+ const toast = useToast();+ const { confirm } = useConfirm();+ const [state, setState] = useState(null);+ const [switching, setSwitching] = useState(false);++ const load = useCallback(() => {+ let cancelled = false;+ api.getAppSlots(app.id)+ .then((data) => { if (!cancelled) setState(data); })+ .catch(() => {});+ return () => { cancelled = true; };+ }, [app.id]);++ useEffect(() => load(), [load]);++ if (!state || app.app_type !== 'docker') return null;++ const live = state.slots.find((s) => s.slot === state.active_slot);+ const standby = state.slots.find((s) => s.slot !== state.active_slot+ && ['standby', 'stopped'].includes(s.state));++ async function handleSwitchBack() {+ if (!await confirm({+ title: t('app.slots.switchBack', 'Switch back'),+ message: t('app.slots.switchBackConfirm', 'Send traffic back to slot {{slot}} (v{{version}})? The database is not rolled back.', {+ slot: standby.slot.toUpperCase(), version: standby.version,+ }),+ confirmText: t('app.slots.switchBack', 'Switch back'),+ })) return;+ setSwitching(true);+ try {+ await api.switchBackAppSlot(app.id);+ toast.success(t('app.slots.switchedBack', 'Traffic is back on the previous release.'));+ load();+ } catch (err) {+ toast.error(err.message || t('app.slots.switchBackFailed', 'Switching back failed'));+ } finally {+ setSwitching(false);+ }+ }++ function slotLine(slot) {+ const parts = [slot.slot.toUpperCase()];+ if (slot.version) parts.push(`v${slot.version}`);+ const sha = shortSha(slot.commit_sha);+ if (sha) parts.push(sha);+ return parts.join(' · ');+ }++ return (+ <div className="overview-tab__card overview-tab__card--full slots-card">+ <div className="overview-tab__card-header-row">+ <h3 className="overview-tab__card-title">{t('app.slots.title', 'Slot deploys')}</h3>+ <Pill kind={state.enabled ? 'green' : 'gray'}>+ {state.enabled ? t('app.slots.on', 'On') : t('app.slots.off', 'Off')}+ </Pill>+ </div>++ {state.enabled && live ? (+ <dl className="slots-card__slots">+ <div className="slots-card__row">+ <dt>{t('app.slots.live', 'Live')}</dt>+ <dd>+ <span className="slots-card__release">{slotLine(live)}</span>+ {live.started_at && (+ <span className="slots-card__meta">{formatRelativeShort(live.started_at)}</span>+ )}+ </dd>+ </div>+ <div className="slots-card__row">+ <dt>{t('app.slots.standby', 'Standby')}</dt>+ <dd>+ {standby ? (+ <>+ <span className="slots-card__release">{slotLine(standby)}</span>+ <span className="slots-card__meta">+ {standby.state === 'standby'+ ? t('app.slots.warmLeft', 'warm, {{count}} min left', { count: minutesLeft(standby.standby_until) ?? 0 })+ : t('app.slots.stopped', 'stopped, starts on switch back')}+ </span>+ <Button variant="outline" size="sm" onClick={handleSwitchBack} disabled={switching}>+ {switching ? t('app.slots.switching', 'Switching…') : t('app.slots.switchBack', 'Switch back')}+ </Button>+ </>+ ) : (+ <span className="slots-card__meta">+ {t('app.slots.noStandby', 'None yet. The next deploy boots beside the live release, and this one becomes the standby.')}+ </span>+ )}+ </dd>+ </div>+ </dl>+ ) : (+ <div className="slots-card__off">+ <p className="slots-card__hint">+ {t('app.slots.explain', 'A deploy boots the new release beside the live one, checks that it answers, then switches traffic over. A release that fails never replaces the working one, and the previous release stays ready for an instant switch back.')}+ </p>+ {state.eligibility.eligible ? (+ <p className="slots-card__hint">+ {t('app.slots.eligible', 'This app qualifies.')}{' '}+ <Link to={`/services/${app.id}/settings/health`}>+ {t('app.slots.turnOn', 'Turn it on in Settings')}+ </Link>+ </p>+ ) : (+ <ul className="slots-card__reasons">+ {state.eligibility.reasons.map((reason) => <li key={reason}>{reason}</li>)}+ </ul>+ )}+ </div>+ )}++ {state.enabled && state.eligibility.warnings.length > 0 && (+ <ul className="slots-card__reasons slots-card__reasons--warn">+ {state.eligibility.warnings.map((warning) => <li key={warning}>{warning}</li>)}+ </ul>+ )}+ </div>+ );+}diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.jsonindex 558d7f26..421360e6 100644--- a/frontend/src/i18n/locales/en.json+++ b/frontend/src/i18n/locales/en.json@@ -5627,6 +5627,42 @@"whenDisabledOnlyAdministratorsCanCreate": "When disabled, only administrators can create new user accounts.","wildcardDns": "Wildcard DNS"},+ "slotDeploysPanel": {+ "disabled": "Slot deploys off.",+ "enable": "Use slot deploys",+ "enableHint": "Turning it on restarts nothing: the running container becomes slot A.",+ "enabled": "Slot deploys on. The running container is now slot A; the next deploy boots slot B.",+ "intro": "Each deploy boots the new release in a second slot on its own port while the live one keeps serving. It switches traffic only after the new release passes its health check, watches it for a while, and switches back on its own if it falls over. The previous release stays warm for an instant manual switch back.",+ "saveFailed": "Failed to save rollout settings",+ "saved": "Rollout settings saved.",+ "schemaRule": "Both releases use the same database during the switch. Keep schema changes backward-compatible for one deploy: add first, deploy, remove later.",+ "standby": "Keep the previous release warm (minutes)",+ "standbyHint": "While warm, switching back takes seconds. After that it is stopped: it no longer uses memory, and switching back starts it first.",+ "title": "Slot deploys",+ "toggleFailed": "Could not change slot deploys",+ "volumes": "Two copies may share the volumes",+ "volumesHint": "For a few seconds around each switch both releases mount the same volumes. Leave this off if the app keeps something like SQLite there, which breaks when two processes write to it.",+ "watch": "Watch window (seconds)",+ "watchHint": "How long a release is watched after it goes live. If it stops answering in that time, traffic goes back to the previous release. 0 turns the watch off."+ },+ "slots": {+ "eligible": "This app qualifies.",+ "explain": "A deploy boots the new release beside the live one, checks that it answers, then switches traffic over. A release that fails never replaces the working one, and the previous release stays ready for an instant switch back.",+ "live": "Live",+ "noStandby": "None yet. The next deploy boots beside the live release, and this one becomes the standby.",+ "off": "Off",+ "on": "On",+ "standby": "Standby",+ "stopped": "stopped, starts on switch back",+ "switchBack": "Switch back",+ "switchBackConfirm": "Send traffic back to slot {{slot}} (v{{version}})? The database is not rolled back.",+ "switchBackFailed": "Switching back failed",+ "switchedBack": "Traffic is back on the previous release.",+ "switching": "Switching…",+ "title": "Slot deploys",+ "turnOn": "Turn it on in Settings",+ "warmLeft": "warm, {{count}} min left"+ },"sortChipBar": {"activeSorting": "Active sorting","clickToFlipDirection": "Click to flip direction",diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.jsonindex a4318415..4fece2f5 100644--- a/frontend/src/i18n/locales/es.json+++ b/frontend/src/i18n/locales/es.json@@ -6795,6 +6795,42 @@"saved": "Comprobación de salud guardada.","timeout": "Tiempo límite (segundos)","timeoutHint": "Cuánto puede tardar una versión nueva en empezar a responder ({{min}}–{{max}})."+ },+ "slots": {+ "title": "Despliegues por ranuras",+ "on": "Activo",+ "off": "Inactivo",+ "live": "En vivo",+ "standby": "En espera",+ "switchBack": "Volver atrás",+ "switchBackConfirm": "¿Enviar el tráfico de vuelta a la ranura {{slot}} (v{{version}})? La base de datos no se revierte.",+ "switchedBack": "El tráfico volvió a la versión anterior.",+ "switchBackFailed": "No se pudo volver atrás",+ "switching": "Cambiando…",+ "warmLeft": "lista, quedan {{count}} min",+ "stopped": "detenida, arranca al volver atrás",+ "noStandby": "Todavía ninguna. El próximo despliegue arranca junto a la versión en vivo, y esta pasa a estar en espera.",+ "explain": "Un despliegue arranca la versión nueva junto a la que está en vivo, comprueba que responde y luego cambia el tráfico. Una versión que falla nunca reemplaza a la que funciona, y la anterior queda lista para volver atrás al instante.",+ "eligible": "Esta app cumple los requisitos.",+ "turnOn": "Actívalo en Ajustes"+ },+ "slotDeploysPanel": {+ "title": "Despliegues por ranuras",+ "enabled": "Despliegues por ranuras activos. El contenedor en marcha es ahora la ranura A; el próximo despliegue arranca la ranura B.",+ "disabled": "Despliegues por ranuras desactivados.",+ "toggleFailed": "No se pudo cambiar el despliegue por ranuras",+ "saved": "Ajustes de despliegue guardados.",+ "saveFailed": "No se pudieron guardar los ajustes de despliegue",+ "intro": "Cada despliegue arranca la versión nueva en una segunda ranura, en su propio puerto, mientras la que está en vivo sigue sirviendo. Solo cambia el tráfico cuando la versión nueva pasa su comprobación de salud, la vigila un rato y vuelve atrás sola si falla. La versión anterior queda lista para volver atrás a mano al instante.",+ "enable": "Usar despliegues por ranuras",+ "enableHint": "Activarlo no reinicia nada: el contenedor en marcha pasa a ser la ranura A.",+ "watch": "Ventana de vigilancia (segundos)",+ "watchHint": "Cuánto se vigila una versión después de ponerse en vivo. Si deja de responder en ese tiempo, el tráfico vuelve a la versión anterior. 0 desactiva la vigilancia.",+ "standby": "Mantener lista la versión anterior (minutos)",+ "standbyHint": "Mientras está lista, volver atrás tarda segundos. Después se detiene: deja de usar memoria, y volver atrás la arranca primero.",+ "volumes": "Dos copias pueden compartir los volúmenes",+ "volumesHint": "Durante unos segundos en cada cambio, las dos versiones montan los mismos volúmenes. Déjalo desactivado si la app guarda ahí algo como SQLite, que se rompe cuando dos procesos escriben a la vez.",+ "schemaRule": "Las dos versiones usan la misma base de datos durante el cambio. Mantén los cambios de esquema compatibles durante un despliegue: primero añade, despliega y elimina después."}},"auth": {diff --git a/frontend/src/services/api/apps.js b/frontend/src/services/api/apps.jsindex 5e11b06e..734c9607 100644--- a/frontend/src/services/api/apps.js+++ b/frontend/src/services/api/apps.js@@ -574,3 +574,17 @@ export async function getAppHints(appId) {export async function setImmutableAssets(appId, enabled) {return this.request(`/apps/${appId}/immutable-assets`, { method: 'PUT', body: { enabled } });}++// A/B slot deploys (plan 87): slot state + eligibility, the opt-in, and the+// instant switch back to the standby.+export async function getAppSlots(appId) {+ return this.request(`/apps/${appId}/slots`);+}++export async function setAppSlots(appId, enabled) {+ return this.request(`/apps/${appId}/slots`, { method: 'PUT', body: { enabled } });+}++export async function switchBackAppSlot(appId) {+ return this.request(`/apps/${appId}/slots/switch-back`, { method: 'POST' });+}diff --git a/frontend/src/styles/pages/_bandwidth.scss b/frontend/src/styles/pages/_bandwidth.scssindex dd6321d9..e57d2db4 100644--- a/frontend/src/styles/pages/_bandwidth.scss+++ b/frontend/src/styles/pages/_bandwidth.scss@@ -311,3 +311,66 @@&--here { color: var(--text-dim); }}}++// Service detail Overview: A/B slot deploys (plan 87 §F).+// Component: service-detail/SlotsCard.+.slots-card {+ &__slots {+ display: flex;+ flex-direction: column;+ gap: 10px;+ margin: 0;+ }++ &__row {+ display: grid;+ grid-template-columns: 72px 1fr;+ align-items: center;+ gap: 12px;++ dt {+ font-size: 12px;+ text-transform: uppercase;+ letter-spacing: 0.04em;+ color: var(--text-dim);+ }++ dd {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 10px;+ margin: 0;+ }+ }++ &__release {+ font-family: var(--mono);+ font-size: 13px;+ color: var(--text);+ }++ &__meta,+ &__hint {+ margin: 0;+ font-size: 12.5px;+ color: var(--text-dim);+ }++ &__off {+ display: flex;+ flex-direction: column;+ gap: 6px;+ }++ &__reasons {+ margin: 6px 0 0;+ padding-inline-start: 18px;+ font-size: 12.5px;+ color: var(--text-dim);++ li + li { margin-top: 4px; }++ &--warn { color: var(--amber); }+ }+}