Add backup, restore, and Zabbix monitoring docs to Gitea page
45
Gitea.md
45
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 <path-to-dump.zip>`
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user