feat(backup): add ops-db backup commands, flow, and systemd timer
Adds pg_dump_ops_db, list_ops_backups, and cleanup_ops_backups to the agent command whitelist. Includes a backup_ops_db flow YAML (dump + 30-day retention), and a systemd service/timer for daily automated backups at 02:00. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
aa1fd41bec
commit
4dd0490afc
4 changed files with 85 additions and 0 deletions
22
ops-agent/flows.example/backup_ops_db.yml
Normal file
22
ops-agent/flows.example/backup_ops_db.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# Backup the ops_dashboard database.
|
||||
# Copy to /etc/ops-agent/flows/backup_ops_db.yml on the host.
|
||||
#
|
||||
# Prerequisites:
|
||||
# - ops-agent user must be in the docker group (to run docker exec)
|
||||
# - /srv/ops/backups/ directory or its parent must be writable by ops-agent
|
||||
#
|
||||
# Steps:
|
||||
# 1. Dump ops_dashboard via pg_dump inside the postgres container
|
||||
# 2. Remove backup files older than 30 days (retention policy)
|
||||
#
|
||||
# Run on a schedule via ops-db-backup.timer (see deploy/ops-agent/).
|
||||
# Or trigger manually via the Ops Dashboard → Settings → Backups.
|
||||
|
||||
name: Backup Ops DB
|
||||
description: Dump ops_dashboard database and apply 30-day retention policy
|
||||
steps:
|
||||
- command_key: pg_dump_ops_db
|
||||
on_failure: abort
|
||||
|
||||
- command_key: cleanup_ops_backups
|
||||
on_failure: continue
|
||||
Loading…
Add table
Add a link
Reference in a new issue