mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 02:41:14 +00:00
28c7a8fd54
* feat(auto-update): add auto-update policies and fix image update detection Auto-Update Policies (Skipper+ tier): - New scheduled task action type 'update' for check-then-update flow - Dedicated AutoUpdatePoliciesView with CRUD, cron presets, and run history - Conditional tier gating: Skipper gets auto-update, Admiral gets full scheduled ops - Backend executeUpdate: checks digests, pulls only if newer, atomic redeploy Image Update Detection fixes (all tiers): - Fix stack name key mismatch: use working_dir label instead of project label - Add 5-minute periodic frontend polling for background check results - Replace fixed 3s timeout with polling-based manual refresh via /api/image-updates/status - Clear update status after successful stack update * fix(ui): remove Skipper tier badge from Auto-Update Policies header * fix(ui): remove auto-update action from Scheduled Operations view Admiral users have a dedicated Auto-Update view — showing update tasks in Scheduled Operations too was confusing duplication. Each view now owns a distinct, non-overlapping set of action types. * fix(auto-update): fix node-stack linking and add All Stacks option - Stack dropdown now re-fetches when node selection changes using fetchForNode, and resets the selected stack - Node selector moved above stack selector with stack disabled until a node is picked - Added "All Stacks" wildcard option that checks and updates every stack on the selected node - Backend executeUpdate refactored to iterate over all stacks when target_id is "*", with per-stack error isolation * refactor(ui): replace Select dropdowns with searchable Combobox component Add a reusable Combobox component with inline search and use it for Node/Stack selectors in both Auto-Update Policies and Scheduled Operations dialogs. Also fixes node-stack linking bug where changing node didn't update the stack list. * fix(ui): resolve CI TypeScript errors in Combobox and ScheduledOperationsView Add missing searchPlaceholder prop to ComboboxProps interface and remove dead 'update' action filter that conflicted with the narrowed type union. * fix(ui): use Geist Sans font in toast component The toast renders via React portal on document.body, bypassing the app's font inheritance. Add explicit font-family declaration using var(--font-sans) to match Sencho's design system.
116 lines
5.2 KiB
Plaintext
116 lines
5.2 KiB
Plaintext
---
|
|
title: "Auto-Update Policies"
|
|
description: "Automatically check for and apply container image updates on a schedule."
|
|
---
|
|
|
|
<Note>
|
|
Auto-Update Policies require a **Skipper** or **Admiral** license.
|
|
</Note>
|
|
|
|
## Overview
|
|
|
|
Auto-Update Policies let you define schedules for Sencho to automatically check your container images for updates and apply them when new versions are available. Think of it as a built-in Watchtower — but integrated directly into your Sencho dashboard with full visibility into what was updated and when.
|
|
|
|
Each policy targets a specific stack and runs on a cron schedule. When triggered, Sencho:
|
|
|
|
1. Inspects every container in the target stack
|
|
2. Compares local image digests against the remote registry
|
|
3. If any image has a newer version, pulls the update and recreates the stack with `docker compose up -d`
|
|
4. Records the result in run history for auditability
|
|
|
|
<Frame>
|
|
<img src="/images/auto-update-policies/overview.png" alt="Auto-Update Policies view showing the policies list" />
|
|
</Frame>
|
|
|
|
## Creating a Policy
|
|
|
|
Navigate to **Auto-Update** in the sidebar and click **New Policy**.
|
|
|
|
<Frame>
|
|
<img src="/images/auto-update-policies/create-dialog.png" alt="Create auto-update policy dialog" />
|
|
</Frame>
|
|
|
|
Fill in the following fields:
|
|
|
|
| Field | Description |
|
|
|-------|-------------|
|
|
| **Name** | A descriptive name for the policy (e.g., "Nightly media stack update") |
|
|
| **Node** | The node where the target stack runs |
|
|
| **Stack** | The stack to monitor and update |
|
|
| **Schedule** | A cron expression or preset defining how often to check |
|
|
|
|
### Schedule Presets
|
|
|
|
For convenience, Sencho offers common schedule presets:
|
|
|
|
| Preset | Cron Expression | Description |
|
|
|--------|----------------|-------------|
|
|
| Every 6 hours | `0 */6 * * *` | Check four times per day |
|
|
| Every 12 hours | `0 */12 * * *` | Check twice per day |
|
|
| Daily at 3 AM | `0 3 * * *` | Low-traffic window for most users |
|
|
| Daily at midnight | `0 0 * * *` | Start of each day |
|
|
| Weekly (Sunday 3 AM) | `0 3 * * 0` | Minimal disruption for stable stacks |
|
|
| Custom | User-defined | Any valid cron expression |
|
|
|
|
## Managing Policies
|
|
|
|
Each policy in the list shows:
|
|
|
|
- **Name** and target stack
|
|
- **Schedule** in human-readable form (e.g., "Every 6 hours")
|
|
- **Status** — enabled or disabled
|
|
- **Last run** — when it last executed and whether it succeeded
|
|
- **Next run** — when it will execute next
|
|
|
|
### Available Actions
|
|
|
|
- **Toggle** — Enable or disable a policy without deleting it
|
|
- **Run Now** — Trigger an immediate check-and-update cycle
|
|
- **Edit** — Modify the policy name, target, or schedule
|
|
- **Delete** — Permanently remove the policy
|
|
|
|
## Run History
|
|
|
|
Click the clock icon on any policy to view its run history. Each entry shows:
|
|
|
|
- **Timestamp** — When the run started
|
|
- **Status** — Success or failure
|
|
- **Output** — Detailed log of what was checked and whether updates were applied
|
|
|
|
This gives you full auditability over what changed and when.
|
|
|
|
## How It Works
|
|
|
|
Under the hood, Auto-Update Policies are built on the same scheduling engine as [Scheduled Operations](/features/scheduled-operations). The key difference is that auto-update policies:
|
|
|
|
- Are available to **Skipper** tier (Scheduled Operations requires Admiral)
|
|
- Always target a **stack** (not individual containers)
|
|
- Perform a **check-then-update** flow rather than a blind restart
|
|
|
|
### The Check-Then-Update Flow
|
|
|
|
1. **Enumerate images** — Sencho lists all unique images used by containers in the target stack
|
|
2. **Check digests** — For each image, Sencho compares the local `RepoDigests` against the remote registry manifest digest
|
|
3. **Conditional update** — Only if at least one image has a newer version does Sencho run `docker compose up -d` to pull and recreate
|
|
4. **Clear indicators** — After a successful update, the blue update indicator dot is automatically cleared
|
|
|
|
If no updates are found, the run completes with a "No updates available" message and no containers are restarted.
|
|
|
|
## Relationship to Image Update Detection
|
|
|
|
Sencho has two complementary features for keeping your images current:
|
|
|
|
| Feature | Purpose | Tier |
|
|
|---------|---------|------|
|
|
| **Image Update Detection** | Passive — shows a blue dot on stacks with available updates | All tiers |
|
|
| **Auto-Update Policies** | Active — automatically applies updates on a schedule | Skipper+ |
|
|
|
|
Image Update Detection runs in the background every 6 hours and highlights stacks that have newer images available. Auto-Update Policies take this a step further by automatically applying those updates based on your defined schedule.
|
|
|
|
## Best Practices
|
|
|
|
- **Start with longer intervals** — Use "Daily at 3 AM" or "Weekly" for production stacks. Reserve shorter intervals for dev/staging environments.
|
|
- **Pin critical images** — If a stack uses `image: postgres:16.2` (pinned tag), auto-update will only detect updates to that exact tag. Use floating tags like `postgres:16` if you want minor version updates.
|
|
- **Monitor run history** — Check run history periodically to ensure updates are applying cleanly. Failed runs may indicate registry authentication issues or compose file problems.
|
|
- **Combine with notifications** — Sencho sends alert notifications when auto-updates are applied, so you stay informed even when updates happen automatically.
|