Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat: add dedicated healthcheck tab for containers (#2384)
Kyle Mendellac3be0ba8809
diff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex f569f32d9..2b301e1b7 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -511,6 +511,27 @@"containers_nav_logs": "Logs","containers_nav_networks": "Networks","containers_nav_storage": "Storage",+ "containers_nav_healthcheck": "Healthcheck",+ "health_status_description": "Current healthcheck state reported by Docker",+ "health_configuration": "Healthcheck Configuration",+ "health_configuration_description": "Probe command and timing configured for this container",+ "health_test_command": "Test Command",+ "health_interval": "Interval",+ "health_timeout": "Timeout",+ "health_retries": "Retries",+ "health_retries_remaining": "Retries Remaining",+ "health_start_period": "Start Period",+ "health_start_interval": "Start Interval",+ "health_failing_streak": "Failing Streak",+ "health_next_check": "Next Check",+ "health_next_check_running_now": "Running now",+ "health_recent_probes": "Recent Probes",+ "health_recent_probes_description": "Most recent healthcheck probe results, newest first",+ "health_no_probes_yet": "No probes have run yet",+ "health_inherit_from_image": "Inherited from image",+ "health_disabled_in_image": "Healthcheck disabled",+ "health_probe_duration": "Duration",+ "health_exit_code": "Exit Code","containers_ip_address": "IP Address","containers_cpu_usage": "CPU Usage","containers_memory_usage": "Memory Usage",diff --git a/frontend/src/lib/types/container.type.ts b/frontend/src/lib/types/container.type.tsindex d0555f50c..abeb0d485 100644--- a/frontend/src/lib/types/container.type.ts+++ b/frontend/src/lib/types/container.type.ts@@ -137,24 +137,40 @@ export interface ContainerStatusCounts {totalContainers: number;}+export interface ContainerHealthLogEntry {+ start?: string;+ // Legacy PascalCase, kept for backwards-compat with older payloads.+ Start?: string;+ end?: string;+ End?: string;+ exitCode?: number;+ ExitCode?: number;+ output?: string;+ Output?: string;+}++export interface ContainerHealthDto {+ status: string;+ failingStreak?: number;+ log?: ContainerHealthLogEntry[];+}+export interface ContainerStateDto {status: string;running: boolean;startedAt: string;finishedAt: string;- health?: {- status: string;- log?: Array<{- start?: string;- Start?: string;- end?: string;- End?: string;- exitCode?: number;- ExitCode?: number;- output?: string;- Output?: string;- }>;- };+ health?: ContainerHealthDto;+}++// Healthcheck configuration. Durations are in nanoseconds (Docker SDK convention).+export interface ContainerHealthcheckDto {+ test?: string[];+ interval?: number;+ timeout?: number;+ startPeriod?: number;+ startInterval?: number;+ retries?: number;}export interface ContainerConfigDto {@@ -163,6 +179,7 @@ export interface ContainerConfigDto {entrypoint?: string[];workingDir?: string;user?: string;+ healthcheck?: ContainerHealthcheckDto;}export interface ComposeInfo {diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelteindex fb3883be9..631911e2c 100644--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte@@ -25,6 +25,7 @@import ContainerComposePanel from '../components/ContainerComposePanel.svelte';import ContainerInspect from '../components/ContainerInspect.svelte';import ContainerDetailStatsSync from '../components/container-detail-stats-sync.svelte';+ import ContainerHealthcheck from '../components/ContainerHealthcheck.svelte';import IconImage from '$lib/components/icon-image.svelte';import { getArcaneIconUrlFromLabels } from '$lib/utils/arcane-labels';import { calculateMemoryUsage } from '$lib/utils/container-stats.utils';@@ -39,7 +40,8 @@ContainersIcon,StatsIcon,CodeIcon,- InspectIcon+ InspectIcon,+ HealthIcon} from '$lib/icons';import { parse as parseYaml } from 'yaml';import type { IncludeFile } from '$lib/types/project.type';@@ -140,6 +142,9 @@const hasMounts = $derived(!!(container?.mounts && container.mounts.length > 0));const showStats = $derived(!!container?.state?.running);const showShell = $derived(!!container?.state?.running);+ const hasHealthcheck = $derived(+ !!(container?.config?.healthcheck?.test && container.config.healthcheck.test.length > 0) || !!container?.state?.health+ );const project = $derived(data?.project ?? null);const composeInfo = $derived(container?.composeInfo ?? null);@@ -210,6 +215,7 @@...(showStats ? [{ value: 'stats', label: m.containers_nav_metrics(), icon: StatsIcon }] : []),{ value: 'logs', label: m.containers_nav_logs(), icon: FileTextIcon },...(showShell ? [{ value: 'shell', label: m.common_shell(), icon: TerminalIcon }] : []),+ ...(hasHealthcheck ? [{ value: 'healthcheck', label: m.containers_nav_healthcheck(), icon: HealthIcon }] : []),...(showConfiguration ? [{ value: 'config', label: m.common_configuration(), icon: SettingsIcon }] : []),...(showNetworkTab ? [{ value: 'network', label: m.containers_nav_networks(), icon: NetworksIcon }] : []),...(hasMounts ? [{ value: 'storage', label: m.containers_nav_storage(), icon: VolumesIcon }] : []),@@ -344,6 +350,12 @@</Tabs.Content>{/if}+ {#if hasHealthcheck}+ <Tabs.Content value="healthcheck" class="h-full">+ <ContainerHealthcheck {container} />+ </Tabs.Content>+ {/if}+{#if showConfiguration}<Tabs.Content value="config" class="h-full"><ContainerConfiguration {container} {hasEnvVars} {hasLabels} />diff --git a/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte b/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.sveltenew file mode 100644index 000000000..52d4bd225--- /dev/null+++ b/frontend/src/routes/(app)/containers/components/ContainerHealthcheck.svelte@@ -0,0 +1,330 @@+<script lang="ts">+ import * as Card from '$lib/components/ui/card';+ import StatusBadge from '$lib/components/badges/status-badge.svelte';+ import { m } from '$lib/paraglide/messages';+ import type { ContainerDetailsDto, ContainerHealthLogEntry, ContainerHealthcheckDto } from '$lib/types/container.type';+ import { HealthIcon, SettingsIcon, FileTextIcon } from '$lib/icons';+ import { format, formatDistanceToNow } from 'date-fns';++ interface Props {+ container: ContainerDetailsDto;+ }++ let { container }: Props = $props();++ const healthcheck = $derived<ContainerHealthcheckDto | undefined>(container?.config?.healthcheck);+ const health = $derived(container?.state?.health);++ // Docker sends duration values in nanoseconds. Convert to a compact human string.+ function formatDurationNs(ns: number | undefined | null): string {+ if (!ns || ns <= 0) return m.common_unknown();+ const ms = ns / 1_000_000;+ if (ms < 1000) return `${Math.round(ms)}ms`;+ const totalSeconds = Math.round(ms / 1000);+ if (totalSeconds < 60) return `${totalSeconds}s`;+ const minutes = Math.floor(totalSeconds / 60);+ const seconds = totalSeconds % 60;+ if (minutes < 60) return seconds ? `${minutes}m ${seconds}s` : `${minutes}m`;+ const hours = Math.floor(minutes / 60);+ const mins = minutes % 60;+ return mins ? `${hours}h ${mins}m` : `${hours}h`;+ }++ function parseDockerDate(input: string | undefined | null): Date | null {+ if (!input) return null;+ const s = String(input).trim();+ if (!s || s.startsWith('0001-01-01')) return null;+ const d = new Date(s);+ return isNaN(d.getTime()) ? null : d;+ }++ // Normalize log entry casing (backend now emits lowercase; tolerate older PascalCase).+ function normalizeLog(entries: ContainerHealthLogEntry[] | undefined) {+ if (!entries) return [];+ return entries+ .map((e) => ({+ start: parseDockerDate(e.start ?? e.Start),+ end: parseDockerDate(e.end ?? e.End),+ exitCode: (e.exitCode ?? e.ExitCode ?? 0) as number,+ output: (e.output ?? e.Output ?? '') as string+ }))+ .filter((e) => e.start || e.end);+ }++ const logs = $derived(normalizeLog(health?.log));++ // Reverse — most recent first for display.+ const recentProbes = $derived([...logs].reverse());++ const lastProbe = $derived(logs.length > 0 ? logs[logs.length - 1] : null);++ const statusVariant = $derived.by<'green' | 'red' | 'amber' | 'gray'>(() => {+ const s = health?.status?.toLowerCase();+ if (s === 'healthy') return 'green';+ if (s === 'unhealthy') return 'red';+ if (s === 'starting') return 'amber';+ return 'gray';+ });++ const testCommand = $derived.by<{ type: 'none' | 'inherit' | 'cmd'; text: string }>(() => {+ const test = healthcheck?.test;+ if (!test || test.length === 0) return { type: 'inherit', text: '' };+ if (test.length === 1 && test[0] === 'NONE') return { type: 'none', text: '' };+ // First element is typically "CMD" or "CMD-SHELL".+ const [head, ...rest] = test;+ if (head === 'CMD-SHELL') return { type: 'cmd', text: rest.join(' ') };+ if (head === 'CMD') return { type: 'cmd', text: rest.join(' ') };+ return { type: 'cmd', text: test.join(' ') };+ });++ // Estimate the next probe time: lastProbe.end + interval (clamped to "now" if overdue).+ const nextCheck = $derived.by<{ at: Date; overdue: boolean } | null>(() => {+ if (!container?.state?.running) return null;+ const intervalNs = healthcheck?.interval;+ if (!intervalNs || !lastProbe?.end) return null;+ const next = new Date(lastProbe.end.getTime() + intervalNs / 1_000_000);+ const now = new Date();+ return { at: next, overdue: next.getTime() <= now.getTime() };+ });++ function probeDuration(start: Date | null, end: Date | null): string {+ if (!start || !end) return '—';+ const ms = end.getTime() - start.getTime();+ if (ms < 0) return '—';+ if (ms < 1000) return `${ms}ms`;+ return `${(ms / 1000).toFixed(2)}s`;+ }++ function formatProbeDate(d: Date | null): string {+ if (!d) return '—';+ try {+ return format(d, 'PPpp');+ } catch {+ return d.toISOString();+ }+ }++ const retriesBudget = $derived.by(() => {+ const retries = healthcheck?.retries;+ const failing = health?.failingStreak ?? 0;+ if (retries === undefined || retries === null) return null;+ return { retries, failing, remaining: Math.max(0, retries - failing) };+ });++ function probeKey(probe: { start: Date | null; end: Date | null; exitCode: number }): string {+ return `${probe.start?.getTime() ?? ''}-${probe.end?.getTime() ?? ''}-${probe.exitCode}`;+ }++ let expanded = $state<Record<string, boolean>>({});+ function toggleExpanded(key: string) {+ expanded[key] = !expanded[key];+ }+</script>++<div class="space-y-6">+ <Card.Root>+ <Card.Header icon={HealthIcon}>+ <div class="flex flex-col space-y-1.5">+ <Card.Title>+ <h2>{m.common_health_status()}</h2>+ </Card.Title>+ <Card.Description>{m.health_status_description()}</Card.Description>+ </div>+ </Card.Header>+ <Card.Content class="p-4">+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.common_health_status()}+ </div>+ <div>+ <StatusBadge variant={statusVariant} text={health?.status ?? m.common_unknown()} size="md" />+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_failing_streak()}+ </div>+ <div class="text-foreground text-sm font-medium">+ {health?.failingStreak ?? 0}+ </div>+ </Card.Content>+ </Card.Root>++ {#if retriesBudget}+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_retries_remaining()}+ </div>+ <div class="text-foreground text-sm font-medium">+ {retriesBudget.remaining} / {retriesBudget.retries}+ </div>+ </Card.Content>+ </Card.Root>+ {/if}++ {#if nextCheck}+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_next_check()}+ </div>+ <div class="text-foreground text-sm font-medium" title={formatProbeDate(nextCheck.at)}>+ {#if nextCheck.overdue}+ {m.health_next_check_running_now()}+ {:else}+ {formatDistanceToNow(nextCheck.at, { addSuffix: true })}+ {/if}+ </div>+ </Card.Content>+ </Card.Root>+ {/if}+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Header icon={SettingsIcon}>+ <div class="flex flex-col space-y-1.5">+ <Card.Title>+ <h2>{m.health_configuration()}</h2>+ </Card.Title>+ <Card.Description>{m.health_configuration_description()}</Card.Description>+ </div>+ </Card.Header>+ <Card.Content class="p-4">+ <div class="space-y-3">+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_test_command()}+ </div>+ {#if testCommand.type === 'inherit'}+ <div class="text-muted-foreground text-sm italic">+ {m.health_inherit_from_image()}+ </div>+ {:else if testCommand.type === 'none'}+ <div class="text-muted-foreground text-sm italic">+ {m.health_disabled_in_image()}+ </div>+ {:else}+ <pre+ class="text-foreground cursor-pointer rounded-md bg-black/5 p-2 font-mono text-sm break-all whitespace-pre-wrap select-all dark:bg-white/5"+ title="Click to select">{testCommand.text}</pre>+ {/if}+ </Card.Content>+ </Card.Root>++ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5">+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_interval()}+ </div>+ <div class="text-foreground font-mono text-sm font-medium">+ {formatDurationNs(healthcheck?.interval)}+ </div>+ </Card.Content>+ </Card.Root>+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_timeout()}+ </div>+ <div class="text-foreground font-mono text-sm font-medium">+ {formatDurationNs(healthcheck?.timeout)}+ </div>+ </Card.Content>+ </Card.Root>+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_start_period()}+ </div>+ <div class="text-foreground font-mono text-sm font-medium">+ {formatDurationNs(healthcheck?.startPeriod)}+ </div>+ </Card.Content>+ </Card.Root>+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_start_interval()}+ </div>+ <div class="text-foreground font-mono text-sm font-medium">+ {formatDurationNs(healthcheck?.startInterval)}+ </div>+ </Card.Content>+ </Card.Root>+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="text-muted-foreground text-xs font-semibold tracking-wide uppercase">+ {m.health_retries()}+ </div>+ <div class="text-foreground font-mono text-sm font-medium">+ {healthcheck?.retries ?? 0}+ </div>+ </Card.Content>+ </Card.Root>+ </div>+ </div>+ </Card.Content>+ </Card.Root>++ <Card.Root>+ <Card.Header icon={FileTextIcon}>+ <div class="flex flex-col space-y-1.5">+ <Card.Title>+ <h2>{m.health_recent_probes()}</h2>+ </Card.Title>+ <Card.Description>{m.health_recent_probes_description()}</Card.Description>+ </div>+ </Card.Header>+ <Card.Content class="p-4">+ {#if recentProbes.length === 0}+ <div class="text-muted-foreground rounded-lg border border-dashed py-8 text-center">+ <div class="text-sm">{m.health_no_probes_yet()}</div>+ </div>+ {:else}+ <div class="space-y-2">+ {#each recentProbes as probe (probeKey(probe))}+ {@const key = probeKey(probe)}+ <Card.Root variant="subtle">+ <Card.Content class="flex flex-col gap-2 p-4">+ <div class="flex flex-wrap items-center justify-between gap-2">+ <div class="flex items-center gap-3">+ <StatusBadge+ variant={probe.exitCode === 0 ? 'green' : 'red'}+ text={`${m.health_exit_code()}: ${probe.exitCode}`}+ size="sm"+ />+ <span class="text-muted-foreground text-xs" title={formatProbeDate(probe.start)}>+ {probe.start ? formatDistanceToNow(probe.start, { addSuffix: true }) : '—'}+ </span>+ <span class="text-muted-foreground text-xs">+ {m.health_probe_duration()}: {probeDuration(probe.start, probe.end)}+ </span>+ </div>+ {#if probe.output}+ <button type="button" class="text-primary text-xs hover:underline" onclick={() => toggleExpanded(key)}>+ {expanded[key] ? m.common_hide() : m.common_show()}+ </button>+ {/if}+ </div>+ {#if probe.output && expanded[key]}+ <pre+ class="text-foreground max-h-64 overflow-auto rounded-md bg-black/5 p-2 font-mono text-xs whitespace-pre-wrap dark:bg-white/5">{probe.output}</pre>+ {/if}+ </Card.Content>+ </Card.Root>+ {/each}+ </div>+ {/if}+ </Card.Content>+ </Card.Root>+</div>diff --git a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelteindex 9b40f90be..7e3e33e3a 100644--- a/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte+++ b/frontend/src/routes/(app)/dashboard/dashboard-all-environments-view.svelte@@ -71,6 +71,21 @@let pruningEnvironmentId = $state<string | null>(null);let reloadVersion = $state(0);let liveStatsByEnvironmentId = $state<Record<string, EnvironmentLiveStatsState>>({});+ let upgradeDialogOpenById = $state<Record<string, boolean>>({});+ let upgradeDialogUpgradingById = $state<Record<string, boolean>>({});++ function getUpgradeOpen(id: string): boolean {+ return upgradeDialogOpenById[id] ?? false;+ }+ function setUpgradeOpen(id: string, value: boolean): void {+ upgradeDialogOpenById[id] = value;+ }+ function getUpgradeUpgrading(id: string): boolean {+ return upgradeDialogUpgradingById[id] ?? false;+ }+ function setUpgradeUpgrading(id: string, value: boolean): void {+ upgradeDialogUpgradingById[id] = value;+ }const storeUser = fromStore(userStore);const availableEnvironments = $derived(environmentStore.available);@@ -768,19 +783,47 @@<span class="relative inline-flex h-2 w-2 rounded-full bg-amber-500"></span></span></ArcaneTooltip.Trigger>- <ArcaneTooltip.Content>- {m.sidebar_update_available()}{#if vInfo.newestVersion || vInfo.newestDigest}: {vInfo.newestVersion ||- vInfo.newestDigest.slice(0, 12)}{/if}+ <ArcaneTooltip.Content class="flex flex-col items-start gap-2">+ <span>+ {m.sidebar_update_available()}{#if vInfo.newestVersion || vInfo.newestDigest}: {vInfo.newestVersion ||+ vInfo.newestDigest.slice(0, 12)}{/if}+ </span>+ <DashboardEnvironmentUpgradeAction+ {environment}+ versionInfo={vInfo}+ isAdmin={currentUserIsAdmin}+ debug={debugUpgrade}+ onRefreshRequested={refreshOverview}+ render="trigger"+ bind:open={() => getUpgradeOpen(environment.id), (v) => setUpgradeOpen(environment.id, v)}+ bind:upgrading={+ () => getUpgradeUpgrading(environment.id), (v) => setUpgradeUpgrading(environment.id, v)+ }+ /></ArcaneTooltip.Content></ArcaneTooltip.Root>{:else}<divclass="bg-surface/50 text-muted-foreground border-border/50 hover:text-foreground inline-flex items-center rounded-md border px-2 py-[2px] font-mono text-[11px] font-medium transition-colors">- v{vInfo.displayVersion || vInfo.currentTag || vInfo.currentVersion || 'unknown'}+ {vInfo.displayVersion || vInfo.currentTag || vInfo.currentVersion || 'unknown'}</div>{/if}</div>+ {#if vInfo.updateAvailable || debugUpgrade}+ <DashboardEnvironmentUpgradeAction+ {environment}+ versionInfo={vInfo}+ isAdmin={currentUserIsAdmin}+ debug={debugUpgrade}+ onRefreshRequested={refreshOverview}+ render="dialog"+ bind:open={() => getUpgradeOpen(environment.id), (v) => setUpgradeOpen(environment.id, v)}+ bind:upgrading={+ () => getUpgradeUpgrading(environment.id), (v) => setUpgradeUpgrading(environment.id, v)+ }+ />+ {/if}{/if}{/await}</div>@@ -797,23 +840,7 @@<ActionButtonGroup buttons={getEnvironmentActionButtons(baseItem, isCurrent)} size="sm" />{:then boardState}{@const loadedItem = boardState.overviewById.get(environment.id) ?? baseItem}- {@const vInfo =- loadedItem.versionInfo ||- (debugUpgrade- ? ({ displayVersion: 'debug', updateAvailable: true, newestVersion: 'debug-v2' } as any)- : null)}- <div class="flex items-center gap-2">- {#if vInfo}- <DashboardEnvironmentUpgradeAction- environment={loadedItem.environment}- versionInfo={vInfo}- isAdmin={currentUserIsAdmin}- debug={debugUpgrade}- onRefreshRequested={refreshOverview}- />- {/if}- <ActionButtonGroup buttons={getEnvironmentActionButtons(loadedItem, isCurrent)} size="sm" />- </div>+ <ActionButtonGroup buttons={getEnvironmentActionButtons(loadedItem, isCurrent)} size="sm" />{/await}</div></div>diff --git a/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelteindex af29a14fd..85795525c 100644--- a/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte+++ b/frontend/src/routes/(app)/dashboard/dashboard-environment-upgrade-action.svelte@@ -17,18 +17,21 @@versionInfo,isAdmin,debug = false,- onRefreshRequested+ onRefreshRequested,+ render = 'both',+ open = $bindable(false),+ upgrading = $bindable(false)}: {environment: Environment;versionInfo: AppVersionInformation;isAdmin: boolean;debug?: boolean;onRefreshRequested?: () => void | Promise<void>;+ render?: 'both' | 'trigger' | 'dialog';+ open?: boolean;+ upgrading?: boolean;} = $props();- let showConfirmDialog = $state(false);- let upgrading = $state(false);-const shouldCheckUpgrade = $derived(!!(versionInfo.updateAvailable && isAdmin && !debug));const isLocalEnvironment = $derived(environment.id === '0');@@ -108,7 +111,7 @@return;}- showConfirmDialog = false;+ open = false;try {const result = await environmentUpgradeService.triggerEnvironmentUpgrade(environment.id);@@ -132,25 +135,27 @@}</script>-{#if shouldShowUpgrade}+{#if shouldShowUpgrade && render !== 'dialog'}<ArcaneButtonaction="update"size="sm"class="shrink-0"- onclick={() => (showConfirmDialog = true)}+ onclick={() => (open = true)}disabled={upgrading || checkingUpgrade}customLabel={upgradeButtonText}icon={DownloadIcon}/>{/if}-<UpgradeConfirmationDialog- bind:open={showConfirmDialog}- bind:upgrading- version={confirmVersion}- expectedVersion={versionInfo.newestVersion}- expectedDigest={versionInfo.newestDigest}- environmentName={isLocalEnvironment ? undefined : environment.name}- environmentId={environment.id}- onConfirm={handleConfirmUpgradeInternal}-/>+{#if render !== 'trigger'}+ <UpgradeConfirmationDialog+ bind:open+ bind:upgrading+ version={confirmVersion}+ expectedVersion={versionInfo.newestVersion}+ expectedDigest={versionInfo.newestDigest}+ environmentName={isLocalEnvironment ? undefined : environment.name}+ environmentId={environment.id}+ onConfirm={handleConfirmUpgradeInternal}+ />+{/if}diff --git a/types/container/container.go b/types/container/container.goindex 164e35d30..805f45470 100644--- a/types/container/container.go+++ b/types/container/container.go@@ -4,6 +4,7 @@ import ("maps""strconv""strings"+ "time"containerregistry "github.com/getarcaneapp/arcane/types/containerregistry"imagetypes "github.com/getarcaneapp/arcane/types/image"@@ -498,6 +499,89 @@ type State struct {//// Required: falseFinishedAt string `json:"finishedAt,omitempty"`++ // Health contains the healthcheck status, if the container defines one.+ //+ // Required: false+ Health *Health `json:"health,omitempty"`+}++// HealthLogEntry represents a single probe result from the healthcheck log.+type HealthLogEntry struct {+ // Start is when the probe started.+ //+ // Required: false+ Start string `json:"start,omitempty"`++ // End is when the probe finished.+ //+ // Required: false+ End string `json:"end,omitempty"`++ // ExitCode is the exit code of the probe command.+ //+ // Required: false+ ExitCode int `json:"exitCode"`++ // Output is the stdout/stderr captured from the probe.+ //+ // Required: false+ Output string `json:"output,omitempty"`+}++// Health represents the current healthcheck state of a container.+type Health struct {+ // Status is the current healthcheck status (starting, healthy, unhealthy, none).+ //+ // Required: true+ Status string `json:"status"`++ // FailingStreak is the number of consecutive failures.+ //+ // Required: false+ FailingStreak int `json:"failingStreak"`++ // Log is the recent probe history, oldest first.+ //+ // Required: false+ Log []HealthLogEntry `json:"log,omitempty"`+}++// Healthcheck represents a container's healthcheck configuration.+// Duration values are expressed in nanoseconds (Docker SDK convention).+type Healthcheck struct {+ // Test is the probe command. Common forms:+ // - empty / nil: inherit from the image+ // - ["NONE"]: healthcheck disabled+ // - ["CMD", "..."] / ["CMD-SHELL", "..."]: probe command+ //+ // Required: false+ Test []string `json:"test,omitempty"`++ // Interval between probes, in nanoseconds.+ //+ // Required: false+ Interval int64 `json:"interval,omitempty"`++ // Timeout for a single probe, in nanoseconds.+ //+ // Required: false+ Timeout int64 `json:"timeout,omitempty"`++ // StartPeriod is the initialization grace period, in nanoseconds.+ //+ // Required: false+ StartPeriod int64 `json:"startPeriod,omitempty"`++ // StartInterval is the probe interval during the start period, in nanoseconds.+ //+ // Required: false+ StartInterval int64 `json:"startInterval,omitempty"`++ // Retries is the number of consecutive failures before the container is marked unhealthy.+ //+ // Required: false+ Retries int `json:"retries,omitempty"`}// Config represents configuration details for a container.@@ -526,6 +610,11 @@ type Config struct {//// Required: falseUser string `json:"user,omitempty"`++ // Healthcheck is the container's healthcheck configuration.+ //+ // Required: false+ Healthcheck *Healthcheck `json:"healthcheck,omitempty"`}// HostConfig represents host configuration for a container.@@ -828,34 +917,63 @@ func NewSummary(c container.Summary) Summary {// NewDetails creates a Details from a docker container.InspectResponse.func NewDetails(c *container.InspectResponse) Details {+ cfg, labels, imageName := mapInspectConfig(c.Config)++ return Details{+ ID: c.ID,+ Name: strings.TrimPrefix(c.Name, "/"),+ Image: imageName,+ ImageID: c.Image,+ Created: c.Created,+ State: mapInspectState(c.State),+ Config: cfg,+ HostConfig: mapInspectHostConfig(c.HostConfig),+ NetworkSettings: NetworkSettings{+ Networks: mapInspectNetworks(c.NetworkSettings),+ },+ Ports: mapInspectPorts(c.NetworkSettings),+ Mounts: mapInspectMounts(c.Mounts),+ Labels: labels,+ ComposeInfo: mapComposeInfo(labels),+ }+}++func mapInspectPorts(networkSettings *container.NetworkSettings) []Port {ports := make([]Port, 0)- if c.NetworkSettings != nil && c.NetworkSettings.Ports != nil {- for p, bindings := range c.NetworkSettings.Ports {- privatePort := int(p.Num())- typ := string(p.Proto())-- // When no host bindings exist, still include the private port- if len(bindings) == 0 {- ports = append(ports, Port{- PrivatePort: privatePort,- Type: typ,- })- continue- }- for _, b := range bindings {- pub, _ := strconv.Atoi(b.HostPort)- ports = append(ports, Port{- IP: b.HostIP.String(),- PrivatePort: privatePort,- PublicPort: pub,- Type: typ,- })- }+ if networkSettings == nil || networkSettings.Ports == nil {+ return ports+ }++ for p, bindings := range networkSettings.Ports {+ privatePort := int(p.Num())+ typ := string(p.Proto())++ // When no host bindings exist, still include the private port.+ if len(bindings) == 0 {+ ports = append(ports, Port{+ PrivatePort: privatePort,+ Type: typ,+ })+ continue+ }++ for _, b := range bindings {+ pub, _ := strconv.Atoi(b.HostPort)+ ports = append(ports, Port{+ IP: b.HostIP.String(),+ PrivatePort: privatePort,+ PublicPort: pub,+ Type: typ,+ })}}- mounts := make([]Mount, 0, len(c.Mounts))- for _, m := range c.Mounts {+ return ports+}++func mapInspectMounts(mountPoints []container.MountPoint) []Mount {+ mounts := make([]Mount, 0, len(mountPoints))+ for _, m := range mountPoints {mounts = append(mounts, Mount{Type: string(m.Type),Name: m.Name,@@ -868,88 +986,140 @@ func NewDetails(c *container.InspectResponse) Details {})}+ return mounts+}++func mapInspectNetworks(networkSettings *container.NetworkSettings) map[string]NetworkEndpoint {networks := map[string]NetworkEndpoint{}- if c.NetworkSettings != nil && c.NetworkSettings.Networks != nil {- for name, n := range c.NetworkSettings.Networks {- networks[name] = mapEndpointSettings(n)- }+ if networkSettings == nil || networkSettings.Networks == nil {+ return networks}- var host HostConfig- if c.HostConfig != nil {- host = HostConfig{- RestartPolicy: string(c.HostConfig.RestartPolicy.Name),- Privileged: c.HostConfig.Privileged,- AutoRemove: c.HostConfig.AutoRemove,- NanoCPUs: c.HostConfig.NanoCPUs,- Memory: c.HostConfig.Memory,- }+ for name, n := range networkSettings.Networks {+ networks[name] = mapEndpointSettings(n)}- var cfg Config+ return networks+}++func mapInspectHostConfig(hostConfig *container.HostConfig) HostConfig {+ if hostConfig == nil {+ return HostConfig{}+ }++ return HostConfig{+ RestartPolicy: string(hostConfig.RestartPolicy.Name),+ Privileged: hostConfig.Privileged,+ AutoRemove: hostConfig.AutoRemove,+ NanoCPUs: hostConfig.NanoCPUs,+ Memory: hostConfig.Memory,+ }+}++func mapInspectConfig(config *container.Config) (Config, map[string]string, string) {labels := map[string]string{}- imageName := ""- if c.Config != nil {- cfg = Config{- Env: append([]string{}, c.Config.Env...),- Cmd: append([]string{}, c.Config.Cmd...),- Entrypoint: append([]string{}, c.Config.Entrypoint...),- WorkingDir: c.Config.WorkingDir,- User: c.Config.User,- }- imageName = c.Config.Image- if c.Config.Labels != nil {- maps.Copy(labels, c.Config.Labels)- }+ if config == nil {+ return Config{}, labels, ""}- name := strings.TrimPrefix(c.Name, "/")+ cfg := Config{+ Env: append([]string{}, config.Env...),+ Cmd: append([]string{}, config.Cmd...),+ Entrypoint: append([]string{}, config.Entrypoint...),+ WorkingDir: config.WorkingDir,+ User: config.User,+ }- state := State{}- if c.State != nil {- state = State{- Status: string(c.State.Status),- Running: c.State.Running,- ExitCode: c.State.ExitCode,- StartedAt: c.State.StartedAt,- FinishedAt: c.State.FinishedAt,+ if hc := config.Healthcheck; hc != nil {+ cfg.Healthcheck = &Healthcheck{+ Test: append([]string{}, hc.Test...),+ Interval: int64(hc.Interval),+ Timeout: int64(hc.Timeout),+ StartPeriod: int64(hc.StartPeriod),+ StartInterval: int64(hc.StartInterval),+ Retries: hc.Retries,}}- // Extract Docker Compose information from labels if present- var composeInfo *ComposeInfo- if projectName, hasProject := labels["com.docker.compose.project"]; hasProject {- if serviceName, hasService := labels["com.docker.compose.service"]; hasService {- composeInfo = &ComposeInfo{- ProjectName: projectName,- ServiceName: serviceName,- }- if workingDir, ok := labels["com.docker.compose.project.working_dir"]; ok {- composeInfo.WorkingDir = workingDir- }- if configFiles, ok := labels["com.docker.compose.project.config_files"]; ok {- composeInfo.ConfigFiles = configFiles- }+ if config.Labels != nil {+ maps.Copy(labels, config.Labels)+ }++ return cfg, labels, config.Image+}++func mapInspectState(state *container.State) State {+ if state == nil {+ return State{}+ }++ mappedState := State{+ Status: string(state.Status),+ Running: state.Running,+ ExitCode: state.ExitCode,+ StartedAt: state.StartedAt,+ FinishedAt: state.FinishedAt,+ }++ if state.Health != nil {+ mappedState.Health = mapInspectHealth(state.Health)+ }++ return mappedState+}++func mapInspectHealth(health *container.Health) *Health {+ log := make([]HealthLogEntry, 0, len(health.Log))+ for _, entry := range health.Log {+ if entry == nil {+ continue}++ log = append(log, HealthLogEntry{+ Start: formatTimeOrEmpty(entry.Start),+ End: formatTimeOrEmpty(entry.End),+ ExitCode: entry.ExitCode,+ Output: entry.Output,+ })}- return Details{- ID: c.ID,- Name: name,- Image: imageName,- ImageID: c.Image,- Created: c.Created,- State: state,- Config: cfg,- HostConfig: host,- NetworkSettings: NetworkSettings{- Networks: networks,- },- Ports: ports,- Mounts: mounts,- Labels: labels,- ComposeInfo: composeInfo,+ return &Health{+ Status: string(health.Status),+ FailingStreak: health.FailingStreak,+ Log: log,+ }+}++func formatTimeOrEmpty(t time.Time) string {+ if t.IsZero() {+ return ""+ }+ return t.Format("2006-01-02T15:04:05.999999999Z07:00")+}++func mapComposeInfo(labels map[string]string) *ComposeInfo {+ projectName, hasProject := labels["com.docker.compose.project"]+ if !hasProject {+ return nil}++ serviceName, hasService := labels["com.docker.compose.service"]+ if !hasService {+ return nil+ }++ composeInfo := &ComposeInfo{+ ProjectName: projectName,+ ServiceName: serviceName,+ }+ if workingDir, ok := labels["com.docker.compose.project.working_dir"]; ok {+ composeInfo.WorkingDir = workingDir+ }+ if configFiles, ok := labels["com.docker.compose.project.config_files"]; ok {+ composeInfo.ConfigFiles = configFiles+ }++ return composeInfo}func mapEndpointSettings(n *network.EndpointSettings) NetworkEndpoint {