7
Gitea
alvis edited this page 2026-03-07 18:05:16 +00:00

Gitea

Git hosting running on Agap via Docker.

Configuration

Configuration is in the AgapHost repository:

  • Compose file: gitea/docker-compose.yml
  • Environment: gitea/.env

Access

  • Public: https://git.alogins.net/
  • Internal: http://agap:3000
  • SSH: ssh -p 222 git@git.alogins.net

Data

Path Contents
/mnt/misc/gitea Repositories, config, attachments
/mnt/ssd/dbs/gitea/postgres PostgreSQL data
/mnt/backups/gitea Backup dumps and logs
/home/git/.ssh SSH keys

Backup

Daily backup via root's cron at 3 AM:

0 3 * * * /home/alvis/agap_git/gitea/backup.sh >> /mnt/backups/gitea/cron.log 2>&1

Note: Must run as root — /mnt/backups/gitea/ is root-owned and not writable by other users.

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 → AgapHost → 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 → AgapHost → Triggers → Create trigger:

    • Backup failed:
      • Name: Gitea backup failed
      • Severity: High
      • Expression: last(/AgapHost/gitea.backup.status)=0
    • Backup stale (>25h):
      • Name: Gitea backup is stale
      • Severity: Warning
      • Expression: last(/AgapHost/gitea.backup.age)>90000 or last(/AgapHost/gitea.backup.age)=-1
  3. Verify — go to Monitoring → Latest data, filter by host AgapHost and key gitea.backup, confirm both items return values.

Note: Items and triggers are already configured via the Zabbix API.

Stack

  • Gitea 1.25.3
  • PostgreSQL 14