OPC # 0002: Improvements to Client provisioning workflows
This commit is contained in:
@@ -44,6 +44,18 @@ export function streamComposeForceUp(onLine: (line: string) => void, onDone: ()
|
||||
return src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Nuke & Recreate — force-removes every known platform container by name first
|
||||
* (kills orphans that --remove-orphans won't touch), then runs compose up fresh.
|
||||
* Use this when Force Recreate still fails with "container name already in use".
|
||||
*/
|
||||
export function streamComposeNuke(onLine: (line: string) => void, onDone: () => void): EventSource {
|
||||
const src = new EventSource(`${BASE_URL}/api/infra/compose/nuke/stream`);
|
||||
src.onmessage = (e) => onLine(e.data);
|
||||
src.onerror = () => { onDone(); src.close(); };
|
||||
return src;
|
||||
}
|
||||
|
||||
export function streamComposeDown(onLine: (line: string) => void, onDone: () => void): EventSource {
|
||||
const src = new EventSource(`${BASE_URL}/api/infra/compose/down/stream`);
|
||||
src.onmessage = (e) => onLine(e.data);
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
} from '@blueprintjs/core';
|
||||
import { getImageStatus, getBuildHistory, type ImageBuildStatus, type BuildRecord } from '../api/provisioningApi';
|
||||
import {
|
||||
getInfraStatus, streamComposeUp, streamComposeForceUp, streamComposeDown,
|
||||
getInfraStatus, streamComposeUp, streamComposeForceUp, streamComposeNuke, streamComposeDown,
|
||||
type InfraService,
|
||||
} from '../api/infraApi';
|
||||
|
||||
@@ -103,7 +103,7 @@ function BuildHistoryTable({ records }: { records: BuildRecord[] }) {
|
||||
function PlatformTab() {
|
||||
const [services, setServices] = useState<InfraService[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [composeBusy, setBusy] = useState<'up' | 'force' | 'down' | null>(null);
|
||||
const [composeBusy, setBusy] = useState<'up' | 'force' | 'nuke' | 'down' | null>(null);
|
||||
const [lines, setLines] = useState<string[]>([]);
|
||||
const sseRef = useRef<EventSource | null>(null);
|
||||
|
||||
@@ -119,7 +119,7 @@ function PlatformTab() {
|
||||
|
||||
function startStream(
|
||||
streamer: (onLine: (l: string) => void, onDone: () => void) => EventSource,
|
||||
label: 'up' | 'force' | 'down',
|
||||
label: 'up' | 'force' | 'nuke' | 'down',
|
||||
) {
|
||||
sseRef.current?.close();
|
||||
setLines([`▶ compose ${label}…`]);
|
||||
@@ -161,6 +161,12 @@ function PlatformTab() {
|
||||
onClick={() => startStream(streamComposeForceUp, 'force')}
|
||||
title="Force-recreate all containers and remove orphans. Fixes 'container name already in use' errors."
|
||||
>Force Recreate</Button>
|
||||
<Button
|
||||
small icon="flame" intent={Intent.DANGER}
|
||||
loading={composeBusy === 'nuke'} disabled={composeBusy !== null}
|
||||
onClick={() => startStream(streamComposeNuke, 'nuke')}
|
||||
title="Force-removes every platform container by name then runs compose up. Use when Force Recreate still fails with name conflicts."
|
||||
>Nuke & Recreate</Button>
|
||||
<Button
|
||||
small icon="stop" intent={Intent.DANGER}
|
||||
loading={composeBusy === 'down'} disabled={composeBusy !== null}
|
||||
|
||||
Reference in New Issue
Block a user