Files
homelab-agents/session-logs/session-2025-11-23-gitea-config.md
root 2128b7f1f8 Add session logs: Gitea domain fix and backup setup (2025-11-23)
Documents completed work including:
- Fixed Gitea login 404 by updating domain to git.pdmarf.co.uk
- Configured ROOT_URL and SSH_DOMAIN for Pangolin tunnel access
- Set up automated daily database backups (2 AM cron, 7-day retention)
- Tested and verified backup/restore process

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 17:48:39 +00:00

4.3 KiB

Sysadmin Session Summary

Date: 2025-11-23

Host: git-repro (Gitea LXC)

Session Type: Configuration and Backup Setup


Session Overview

This session focused on completing the Gitea configuration for external access via Pangolin tunnel and establishing automated backup procedures.


Tasks Completed

1. Gitea Domain Configuration Fix

Issue: Gitea login was returning 404 errors when accessed via the Pangolin tunnel domain.

Root Cause: The Gitea configuration had the internal IP address (100.120.125.113) set for DOMAIN, ROOT_URL, and SSH_DOMAIN instead of the external domain.

Solution Applied: Updated /etc/gitea/app.ini with the following settings in the [server] section:

[server]
SSH_DOMAIN = git.pdmarf.co.uk
DOMAIN = git.pdmarf.co.uk
HTTP_PORT = 3000
ROOT_URL = https://git.pdmarf.co.uk/

Verification:


2. Pangolin Container Restart

Action: Restarted the Pangolin docker container to ensure the tunnel proxy was properly forwarding requests to the updated Gitea configuration.

Result: External access via git.pdmarf.co.uk confirmed working.


3. Automated Database Backup System

Implementation Details:

Backup Script: /usr/local/bin/gitea-backup.sh

#!/bin/bash
BACKUP_DIR="/var/backups/gitea"
DATE=$(date +%Y%m%d-%H%M%S)

mkdir -p $BACKUP_DIR

# Backup the database
cp /var/lib/gitea/data/gitea.db "$BACKUP_DIR/gitea.db-$DATE"

# Compress
gzip "$BACKUP_DIR/gitea.db-$DATE"

# Keep only last 7 days
find $BACKUP_DIR -name "*.gz" -mtime +7 -delete

echo "Gitea backup completed: $BACKUP_DIR/gitea.db-$DATE.gz"

Cron Schedule:

0 2 * * * /usr/local/bin/gitea-backup.sh
  • Runs daily at 2:00 AM
  • 7-day retention policy
  • Backups stored in /var/backups/gitea/

Backup Location: /var/backups/gitea/


4. Backup/Restore Testing

Test Performed: Verified backup and restore process works correctly.

Verification Steps:

  1. Manual backup execution confirmed working
  2. Backup file created with timestamp: gitea.db-20251123-174012.gz
  3. Compression working (original database compressed to ~33KB)
  4. Restore procedure documented and tested

Current System State

Gitea Service

  • Status: Active (running)
  • Service: gitea.service
  • Start Time: 2025-11-23 17:43:18 UTC
  • Memory Usage: ~112MB
  • Config File: /etc/gitea/app.ini

Gitea Configuration Summary

Setting Value
App Name Homelab Git
Domain git.pdmarf.co.uk
ROOT_URL https://git.pdmarf.co.uk/
SSH_DOMAIN git.pdmarf.co.uk
HTTP_PORT 3000
Database SQLite3
DB Path /var/lib/gitea/data/gitea.db
Repository Root /home/git/gitea-repositories
LFS Enabled Yes
Mail Server smtp.fastmail.com:465

Active Repositories

  1. pdm/homelab-agents.git - Centralized AI agent prompts
  2. pdm/vps-system-apps.git - System apps VPS configuration
  3. pdm/test.git - Test repository

Backup System

Component Status
Backup Script /usr/local/bin/gitea-backup.sh
Backup Directory /var/backups/gitea/
Cron Schedule Daily at 2 AM
Retention 7 days
Latest Backup gitea.db-20251123-174012.gz

Files Modified This Session

  1. /etc/gitea/app.ini - Updated DOMAIN, ROOT_URL, SSH_DOMAIN
  2. /usr/local/bin/gitea-backup.sh - Created backup script
  3. /var/spool/cron/crontabs/root - Added backup cron job

Recommendations for Future Sessions

  1. Off-site Backup: Consider syncing backups to remote storage (S3, rsync to another server)
  2. Repository Backup: The current backup only covers the database; consider backing up /home/git/gitea-repositories/ as well
  3. Monitoring: Set up alerting for backup failures
  4. Full Backup Script: Create a comprehensive backup that includes:
    • Database (/var/lib/gitea/data/gitea.db)
    • Repositories (/home/git/gitea-repositories/)
    • Configuration (/etc/gitea/app.ini)
    • Custom files (/var/lib/gitea/custom/)

Session Timeline

  • Session Start: 2025-11-23 (afternoon UTC)
  • Session End: 2025-11-23 17:48 UTC

This session summary was generated by Claude Code following the sysadmin-session-closer process.