mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-12 19:57:37 +00:00
feat(fleet): add remote node update management (#353)
Add the ability to check for outdated nodes and trigger over-the-air updates from Fleet View. Nodes self-update by pulling the latest Docker image and recreating their container via the "last breath" pattern. Backend: - SelfUpdateService: self-container identification via HOSTNAME + Docker Compose labels, triggers pull + force-recreate - CapabilityRegistry: runtime capability disabling via disableCapability() - POST /api/system/update (202 + deferred self-update) - GET /api/fleet/update-status (version comparison across fleet) - POST /api/fleet/nodes/:nodeId/update (single node) - POST /api/fleet/update-all (bulk remote update) - In-memory update tracker with 5-min timeout Frontend: - Node Updates modal with summary stats, search filter, table layout, per-node Update buttons, and bulk Update All - Version badges and update-available indicators on node cards - ReconnectingOverlay for local node updates (polls /api/health) - 5s fast-poll when any node is actively updating - UpdateStatusBadge shared component for consistent badge rendering Requires Skipper (Pro) tier. Nodes must be deployed via Docker Compose with Docker socket access.
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: Remote updates
|
||||
description: Check for outdated nodes and trigger over-the-air updates from the Fleet View.
|
||||
---
|
||||
|
||||
Sencho can update remote nodes directly from the dashboard. When the gateway is running a newer version than a remote node, a one-click update pulls the latest image and recreates the container automatically.
|
||||
|
||||
<Note>
|
||||
Remote updates require **Sencho Pro** (Skipper or Admiral tier).
|
||||
</Note>
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Remote updates work when each node meets these conditions:
|
||||
|
||||
- Deployed via **Docker Compose** (the recommended method)
|
||||
- The Docker socket (`/var/run/docker.sock`) is mounted into the container
|
||||
- Running **Sencho v0.32.0** or later (the version that introduced the `self-update` capability)
|
||||
|
||||
Nodes deployed with `docker run` or orchestrators like Kubernetes do not support self-update. These nodes will show a "self-update unavailable" message.
|
||||
|
||||
## How it works
|
||||
|
||||
1. The gateway compares each node's version (from `/api/meta`) against its own version.
|
||||
2. If a node is running an older version, the Fleet View shows an **Update available** badge.
|
||||
3. Clicking **Update** sends a command to the remote node.
|
||||
4. The remote node pulls the latest `saelix/sencho` image and recreates its own container.
|
||||
5. The gateway polls the node until it comes back online with the new version.
|
||||
|
||||
The remote node briefly goes offline during the update (typically 10–30 seconds depending on image pull speed). The Fleet View tracks the progress and shows **Updating**, **Updated**, or **Timed out** status badges.
|
||||
|
||||
## Checking for updates
|
||||
|
||||
Open the **Fleet** tab and click **Check Updates** in the header. This opens the **Node Updates** dialog, which lists every node with its current version and update status.
|
||||
|
||||
<Frame>
|
||||
<img src="/images/fleet/check-updates-modal.png" alt="Node Updates dialog showing update status for each node" />
|
||||
</Frame>
|
||||
|
||||
Each node row shows:
|
||||
|
||||
| Element | Meaning |
|
||||
|---------|---------|
|
||||
| Version label (e.g. `v0.31.0`) | The node's current Sencho version |
|
||||
| **Up to date** badge | Node is running the latest version |
|
||||
| **Update** button | A newer version is available — click to update |
|
||||
| **Updating** badge | The node is pulling and restarting |
|
||||
| **Updated** badge | The node came back online with the new version |
|
||||
| **Timed out** badge | The node did not come back within 5 minutes |
|
||||
|
||||
Nodes running a version too old to report their version will show `pre-X.Y.Z` as the current version.
|
||||
|
||||
## Updating a single node
|
||||
|
||||
Click the **Update** button next to any outdated node in the Node Updates dialog, or click the **Update to vX.Y.Z** button directly on the node card in Fleet View. For remote nodes, the update happens in the background. For the local (gateway) node, a confirmation dialog appears warning about the brief dashboard disconnection.
|
||||
|
||||
## Updating all nodes
|
||||
|
||||
Click **Update All (N)** in the Node Updates dialog to trigger updates on all outdated remote nodes simultaneously. The local node is intentionally excluded from bulk updates — update it separately to avoid losing dashboard connectivity.
|
||||
|
||||
## Local node updates
|
||||
|
||||
When updating the local (gateway) node:
|
||||
|
||||
1. A confirmation dialog explains that the dashboard will briefly disconnect.
|
||||
2. After confirming, the server pulls the new image and restarts.
|
||||
3. A reconnecting overlay appears and polls the server every 3 seconds.
|
||||
4. The page automatically reloads when the server comes back.
|
||||
|
||||
If the server does not return within 5 minutes, a timeout message appears with a manual reload option.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Node shows "self-update unavailable"
|
||||
|
||||
The node is not running inside a Docker Compose-managed container, or the Docker socket is not mounted. Check that your `docker-compose.yml` includes the socket volume mount:
|
||||
|
||||
```yaml
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
### Update times out
|
||||
|
||||
The image pull may be slow on the remote host, or the container failed to restart. SSH into the remote host and check `docker logs sencho` for errors. You can also manually update by running:
|
||||
|
||||
```bash
|
||||
docker compose pull && docker compose up -d
|
||||
```
|
||||
|
||||
### Old node does not show update button
|
||||
|
||||
Nodes running Sencho versions before v0.32.0 do not advertise the `self-update` capability. Update them manually first, then future updates can be triggered from the dashboard.
|
||||
Reference in New Issue
Block a user