From 71feac1d389390b64f4ada2a46e9b3d0474cb670 Mon Sep 17 00:00:00 2001 From: alvis Date: Sat, 21 Feb 2026 13:16:14 +0000 Subject: [PATCH] Add backup, restore, and Zabbix monitoring docs to Gitea page --- Gitea.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Gitea.md b/Gitea.md index 0fb27a8..34a3f0e 100644 --- a/Gitea.md +++ b/Gitea.md @@ -22,6 +22,51 @@ Repository: https://github.com/alvis/agap_git | `/mnt/misc/gitea` | Repositories, config, attachments | | `/home/git/.ssh` | SSH keys | +## Backup + +Daily backup via cron at 3 AM: + +``` +0 3 * * * /home/alvis/agap_git/gitea/backup.sh >> /mnt/backups/gitea/cron.log 2>&1 +``` + +Script: `gitea/backup.sh` — stops services, runs `gitea dump`, saves zip to `/mnt/backups/gitea/`. + +Output: `gitea-dump-*.zip` containing `repos/`, `gitea-db.sql`, `app.ini`, `data/`. + +## Restore + +Script: `gitea/restore.sh ` + +Stops services, restores DB and data files from the dump zip, starts everything back up, regenerates git hooks. + +## Zabbix Monitoring + +Config: `/etc/zabbix/zabbix_agent2.d/gitea_backup.conf` + +| Key | Returns | +|-----|---------| +| `gitea.backup.status` | `1` if last backup succeeded, `0` otherwise | +| `gitea.backup.age` | Age of latest dump zip in seconds (`-1` if none) | + +### Creating Zabbix Trigger Alerts + +1. **Create items** — go to *Data collection → Hosts → agap → Items → Create item*: + - Name: `Gitea backup status`, Key: `gitea.backup.status`, Type: Zabbix agent (active), Type of information: Numeric (unsigned), Update interval: `1h` + - Name: `Gitea backup age`, Key: `gitea.backup.age`, Type: Zabbix agent (active), Type of information: Numeric (unsigned), Update interval: `1h` + +2. **Create triggers** — go to *Data collection → Hosts → agap → Triggers → Create trigger*: + - **Backup failed:** + - Name: `Gitea backup failed` + - Severity: High + - Expression: `last(/agap/gitea.backup.status)=0` + - **Backup stale (>25h):** + - Name: `Gitea backup is stale` + - Severity: Warning + - Expression: `last(/agap/gitea.backup.age)>90000 or last(/agap/gitea.backup.age)=-1` + +3. **Verify** — go to *Monitoring → Latest data*, filter by host `agap` and key `gitea.backup`, confirm both items return values. + ## Stack - Gitea 1.25.3