mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-09 02:12:59 +00:00
feat: guide missing external network creation during deploy (#1645)
* feat: guide missing external network creation during deploy Detect missing external networks before Compose runs, prompt or auto-create safe bridge networks, and keep unsupported declarations blocked with trusted deploy provenance. * test: align deploy context and settings fixtures with missing-network gate Update caller spies, EffResource expectations, StacksSection save keys, and git-source spy cleanup so CI matches the new deployStack context and auto-create setting. * fix: drop unused renderError binding in missing-network resolver Satisfies no-unused-vars so backend ESLint CI passes; callers already key only on model presence. * fix: use HTTP-safe clipboard helper in missing-network dialog navigator.clipboard fails on plain HTTP LAN hosts; route copy actions through copyToClipboard so Docker and Compose copy buttons work on self-hosted instances. * fix: simplify missing-network dialog actions and copy label Drop the Compose snippet escape hatch, move secondary actions under More, and rename the terminal copy action to Copy create command so the footer is a clear Cancel / Create decision.
This commit is contained in:
@@ -136,7 +136,7 @@ The rules in this category (except "Node-state checks skipped" itself) read live
|
||||
| Rule | Severity | What it detects |
|
||||
|------|----------|----------------|
|
||||
| Node-state checks skipped | Info | The Docker daemon could not be reached; node-state rules did not run and this result is partial. |
|
||||
| External network not found | Blocker | A network declared `external: true` does not exist on this node. The deploy will fail. |
|
||||
| External network not found | Blocker | A network declared `external: true` does not exist on this node. Deploy is blocked until the network exists. For safe default bridge networks, Doctor may offer a create remediation; advanced drivers and custom options stay manual. |
|
||||
| External volume not found | Blocker | A volume declared `external: true` does not exist on this node. The deploy will fail. |
|
||||
| New network will be created | Info | A non-external network that does not yet exist on this node will be created on first deploy. |
|
||||
| New volume will be created | Info | A named volume that does not yet exist on this node will be created on first deploy. |
|
||||
|
||||
@@ -92,7 +92,7 @@ The Networks section lists every network the effective model declares:
|
||||
|
||||
When a stack declares no explicit networks, the section shows **default network only**: all services share the implicit Docker bridge that Compose creates automatically.
|
||||
|
||||
External networks that do not exist on the node when you deploy will cause the deploy to fail. Compose Doctor flags missing external networks before you apply a change.
|
||||
External networks that do not exist on the node are detected before Compose runs. Interactive deploy opens a guided dialog so you can create safe bridge networks, copy a terminal create command, cancel, or open the Networking view. Automatic creation of those safe networks is optional under Settings → Stacks. Unsupported drivers or options are never created silently; the deploy stays blocked until you fix the Compose declaration or create the network yourself. Compose Doctor also flags missing external networks before you apply a change.
|
||||
|
||||
## Services
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Admins can open **Create network** from the page header. The dialog matches the
|
||||
|
||||
## Findings
|
||||
|
||||
The **Findings** tab lists Compose-first networking issues Sencho derives from the effective model plus one live Docker snapshot per refresh, grouped into **Needs action**, **Review recommended**, and **Informational**. Examples include missing external networks, duplicate network names across stacks, host-network exposure mismatches, and stacks whose model could not be rendered.
|
||||
The **Findings** tab lists Compose-first networking issues Sencho derives from the effective model plus one live Docker snapshot per refresh, grouped into **Needs action**, **Review recommended**, and **Informational**. Examples include missing external networks, duplicate network names across stacks, host-network exposure mismatches, and stacks whose model could not be rendered. Missing external findings only offer create actions when the declaration is a safe default bridge network.
|
||||
|
||||
Findings also fold in the networking-relevant results from your last Compose Doctor run on each stack. A finding both engines detect shows **Live · also found by Doctor**; a finding only Doctor caught (Doctor checks a few things the live engine does not, such as host port conflicts) shows **Last Doctor run** with the timestamp of that run. Doctor's contribution is always the cached result of the last run on that stack, not a fresh check, so run Doctor again on a stack if you want its findings current. An active acknowledgement on a Doctor finding excludes it here too.
|
||||
|
||||
|
||||
@@ -76,11 +76,16 @@ Every Sencho release ships with a static list of capabilities. The current list
|
||||
| `registries` | Private registry management |
|
||||
| `self-update` | Self-update from the dashboard |
|
||||
| `vulnerability-scanning` | Image vulnerability scanning |
|
||||
| `compose-doctor` | Compose Doctor preflight |
|
||||
| `compose-networking` | Stack Networking tab and node Networking overview |
|
||||
| `guided-external-network-preflight` | Guided missing-external-network check before deploy |
|
||||
|
||||
<Note>
|
||||
`vulnerability-scanning` is advertised only when the Trivy binary is present on the node. If a node does not have Trivy installed, it omits this capability and the scanning UI is replaced by a lock card.
|
||||
</Note>
|
||||
|
||||
Nodes that do not advertise `guided-external-network-preflight` keep legacy deploy behavior (no guided missing-external dialog). When the capability is present but the check cannot run, deploy fails closed instead of guessing.
|
||||
|
||||
## Handling nodes that do not advertise metadata
|
||||
|
||||
If a remote node does not respond to `/api/meta` (for example, an unreachable instance, a slow handshake, or one that does not implement the endpoint), Sencho falls back to an offline metadata record with no version and an empty capability list. In that state:
|
||||
|
||||
@@ -22,7 +22,7 @@ Each entry in the activity list contains four pieces of information:
|
||||
|
||||
## Event categories
|
||||
|
||||
Ten categories have a dedicated icon. Any other notification scoped to a stack (deploy failures, scan findings, monitor alerts) also flows into the timeline and renders with a generic activity icon.
|
||||
Ten categories have a dedicated icon. Any other notification scoped to a stack (deploy failures, scan findings, monitor alerts) also flows into the timeline and renders with a generic activity icon. Automatic creation of missing external networks during deploy writes a history-only activity row (`network_auto_created`) on the stack timeline; it does not appear in the notification bell.
|
||||
|
||||
| Category | Example message |
|
||||
|----------|-----------------|
|
||||
|
||||
@@ -1419,6 +1419,36 @@ paths:
|
||||
when the health gate is disabled on the node.
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"409":
|
||||
description: |
|
||||
Deploy blocked before Compose ran. Common codes include a stack
|
||||
operation already in progress, a scan-policy block, or missing
|
||||
external networks (`code: missing_external_networks`).
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
code:
|
||||
type: string
|
||||
example: missing_external_networks
|
||||
kind:
|
||||
type: string
|
||||
enum: [prompt, unsupported, unavailable, create_failed]
|
||||
networks:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
createdNames:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
remainingNames:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
"500":
|
||||
description: Deployment failed.
|
||||
content:
|
||||
@@ -1434,6 +1464,77 @@ paths:
|
||||
description: Whether the stack was automatically rolled back.
|
||||
failure:
|
||||
$ref: "#/components/schemas/FailureClassification"
|
||||
"503":
|
||||
description: |
|
||||
Deploy blocked because Sencho could not render the Compose model or
|
||||
read Docker networking state to verify required external networks.
|
||||
|
||||
/api/stacks/{stackName}/missing-external-networks:
|
||||
get:
|
||||
operationId: getMissingExternalNetworks
|
||||
tags: [Stacks]
|
||||
summary: List missing external networks for a stack
|
||||
description: |
|
||||
Returns whether declared `external: true` networks are missing on the
|
||||
target node, whether automatic creation is enabled, and per-network
|
||||
safety metadata. Requires `stack:read`. Used by interactive deploy
|
||||
preflight when the node advertises `guided-external-network-preflight`.
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/stackName"
|
||||
- $ref: "#/components/parameters/nodeId"
|
||||
responses:
|
||||
"200":
|
||||
description: Missing-external-network envelope.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required: [status, autoCreateEnabled, stackName, networks, declaredExternalCount]
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum: [ok, render_unavailable, runtime_unavailable]
|
||||
autoCreateEnabled:
|
||||
type: boolean
|
||||
stackName:
|
||||
type: string
|
||||
declaredExternalCount:
|
||||
type: integer
|
||||
networks:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required: [name, keys, declarations, safe, unsupportedFeatures, creationSpec]
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
keys:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
declarations:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
safe:
|
||||
type: boolean
|
||||
blockReason:
|
||||
type: string
|
||||
unsupportedFeatures:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
creationSpec:
|
||||
type: object
|
||||
nullable: true
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
description: Stack not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/Error"
|
||||
|
||||
/api/stacks/{stackName}/down:
|
||||
post:
|
||||
|
||||
@@ -675,6 +675,7 @@ Node-level safety checks and post-deploy observation used during stack deploys a
|
||||
| **Observe health after updates** | On | After a stack deploy or update succeeds, watch its containers for the observation window and record a passed or failed verdict on the stack timeline. Observational only: nothing is restarted or rolled back automatically. |
|
||||
| **Observation window** | 90 s | How long to watch containers before declaring the update healthy. Raise it for stacks that take a while to settle. Range 15 to 600 seconds. |
|
||||
| **Block deploy on missing required env vars** | Off | When on, a deploy or update is refused before it starts if a required `${VAR:?message}` variable is unset or empty, so the stack fails fast with a clear message instead of mid-deploy. |
|
||||
| **Automatically create missing external networks during deploy** | Off | When on, safe missing external bridge networks are created automatically before deploy continues. When off, interactive deploy prompts first. Advanced drivers and custom options are never auto-created. |
|
||||
|
||||
Click **Save settings** to apply.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user