0d6486b19b
Moves all A/B closeouts, checklists, idea docs, and implementation plans to plans/archived/2026-05-23/. Both phases are production-stable. Active plans remaining in plans/: - idea-3-powershell-removal.md (Phase C — in progress) - idea-3-esxi-support.md (Phase D — future) - ideas-overview.md (roadmap reference) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
79 lines
4.4 KiB
Markdown
79 lines
4.4 KiB
Markdown
# B5 — Closeout
|
|
|
|
Passo B5 di `plans/PhaseB-user-checklist.md`: conversione scheduled task
|
|
Windows in coppie `*.service` + `*.timer` systemd su Linux.
|
|
|
|
## Stato
|
|
|
|
✅ **COMPLETATO** — 5 timer attivi, tutti e 5 i service PASS al trigger
|
|
manuale.
|
|
|
|
## Cosa è stato fatto
|
|
|
|
- [x] Inventario dei 4 task in `scripts/Register-CIScheduledTasks.ps1`
|
|
(cadenze + comandi) + aggiunta `ci-backup-template` (non era in PS).
|
|
- [x] `Invoke-RetentionPolicy.ps1` portato in Python come sub-comando
|
|
`retention run` (`src/ci_orchestrator/commands/retention.py`).
|
|
- [x] `Backup-CITemplate.ps1` portato in Python come sub-comando
|
|
`template backup` (`src/ci_orchestrator/commands/template.py`) con
|
|
compressione `7z a -mx=1 -mmt=on` → archivi `.7z` in
|
|
`/var/lib/ci/backups/`.
|
|
- [x] 5 coppie `*.service` + `*.timer` deployate in
|
|
`/etc/systemd/system/`:
|
|
|
|
| Unit | Cadenza | Comando |
|
|
| --------------------------- | ---------------------------------------- | ------------------------------------------------------- |
|
|
| `ci-cleanup-orphans` | ogni 6h + al boot | `ci_orchestrator vm cleanup --max-age-hours 6` |
|
|
| `ci-retention-policy` | daily 03:00 + 30min jitter | `ci_orchestrator retention run` |
|
|
| `ci-watch-disk-space` | ogni 15min | `ci_orchestrator monitor disk` |
|
|
| `ci-watch-runner-health` | ogni 15min | `ci_orchestrator monitor runner --service-name act-runner` |
|
|
| `ci-backup-template` | domenica 02:00 + 1h jitter | `ci_orchestrator template backup --all-templates` |
|
|
|
|
- [x] Prerequisiti creati sull'host prima del deploy:
|
|
```bash
|
|
sudo mkdir -p /var/log/ci /var/lib/ci/backups
|
|
sudo chown ci-runner:ci-runner /var/log/ci
|
|
```
|
|
- [x] `systemctl list-timers --all 'ci-*'` → 5 timer `active`. ✅ PASS
|
|
- [x] Trigger manuale di tutti e 5 i service → ✅ tutti PASS.
|
|
- [x] `deploy/systemd/README.md` aggiornato: tabella mapping, prerequisiti,
|
|
istruzioni install/test/rollback — senza riferimenti a PowerShell.
|
|
|
|
## Deviazioni / gotcha
|
|
|
|
- **pwsh non richiesto**: `Invoke-RetentionPolicy.ps1` e
|
|
`Backup-CITemplate.ps1` sono stati portati integralmente a Python in
|
|
questa fase, eliminando la dipendenza da PowerShell Core per tutti e 5
|
|
i timer. Questo è il primo passo verso la Fase C
|
|
(`plans/idea-3-powershell-removal.md`).
|
|
- **`--service-name act-runner`**: il default del comando `monitor runner`
|
|
era `act_runner` (nome Windows). Il service Linux si chiama `act-runner`
|
|
(trattino). Il fix è nel parametro `ExecStart` di
|
|
`ci-watch-runner-health.service`.
|
|
- **`ci-backup-template` gira come root**: il backup richiede
|
|
`systemctl stop/start act-runner.service` (gestito con try/finally in
|
|
Python). Gli altri 4 service girano come `ci-runner`.
|
|
- **Prerequisiti directory**: `ReadWritePaths` in `ProtectSystem=strict`
|
|
richiede che le directory esistano *prima* che la unit venga avviata.
|
|
`ci-watch-runner-health` e `ci-cleanup-orphans` usano `/var/log/ci`;
|
|
`ci-backup-template` usa `/var/lib/ci/backups`. Entrambe vanno create
|
|
prima del deploy (vedi sopra).
|
|
- **Bug pre-esistente in `vm.py`** (`_list_orphans`): `is_dir()` era
|
|
chiamato fuori dal blocco `try/except OSError`, causando un'eccezione
|
|
su symlink rotti. Corretto spostando `is_dir()` all'interno del try.
|
|
|
|
## Cadenze systemd (vs Windows originale)
|
|
|
|
| Task | Windows originale | systemd timer |
|
|
| --------------------- | -------------------------- | ----------------------------------------------------- |
|
|
| cleanup-orphans | ogni 6h + al boot | `OnBootSec=2min, OnUnitActiveSec=6h, Persistent` |
|
|
| retention-policy | daily 03:00 + 30min delay | `OnCalendar=*-*-* 03:00:00, RandomizedDelaySec=30min` |
|
|
| watch-disk-space | ogni 15min | `OnBootSec=5min, OnUnitActiveSec=15min` |
|
|
| watch-runner-health | ogni 15min | `OnBootSec=3min, OnUnitActiveSec=15min` |
|
|
| backup-template | *(non era in PS)* | `OnCalendar=Sun *-*-* 02:00:00, RandomizedDelaySec=1h`|
|
|
|
|
## Riferimenti commit
|
|
|
|
- `43a69b8` — feat: B5 — port retention/template-backup to Python, deploy
|
|
systemd timers
|