Files
command-center/omp-docs/tools/gitea/data-persistence.md
Frank 02883d3ed2 docs: rebuild KB in OKF v0.1 with live-verified facts
Copy of the legacy ~/.pi/agent/docs tree rebuilt as the command-center
knowledge base: concept files promoted to path identity, index listings
stripped of frontmatter, all wikilinks/relative links resolved, every
checkable claim verified against the live fleet (Dankserver = Ryzen 7
7700X + RTX 3090; Strix Halo is Dankclaw), unverifiable claims tagged.
kb-lint exits 0.
2026-08-28 07:57:13 -07:00

70 lines
2.3 KiB
Markdown

---
type: reference
title: Gitea Data Persistence
description: Gitea data persistence, volume mounts, ownership, and backup strategy on dankclaw.
tags:
- gitea
- data
- unverified
verified: 2026-08-28
---
# Gitea Data Persistence
All data lives on host bind mounts under `/opt/gitea/data/`. Containers are ephemeral. Quadlet stops remove the container (`podman run --rm --replace`). The next start recreates it. Data survives.
## Volume Layout
| Host Path | Container Mount | Contents |
|---|---|---|
| `/opt/gitea/data/gitea-gitea/` | `/data` | Git repositories, avatars, attachments, LFS objects, `app.ini` |
| `/opt/gitea/data/gitea-postgres/` | `/var/lib/postgresql/data` | PostgreSQL WAL, tables, indexes |
## Ownership
The bind-mount directories are owned by host user `dank` (UID 1000). Files that the containers create are owned by host UID/GID **100999** — the rootless ID mapping of container uid/gid 1000 (dank subuid range 100000-165535). User `dank` cannot write those files directly from the host.
Edit container-owned files inside the container:
```
podman exec --user 1000 gitea-server sed -i 's/old/new/' /data/gitea/conf/app.ini
```
## Backup Strategy
### Full backup (recommended)
Tar the entire data directory. This captures Gitea repos and PostgreSQL data in one archive.
```
tar czf gitea-backup-$(date +%F).tar.gz -C /opt/gitea data/
```
### PostgreSQL-only backup
Use `pg_dump` for a portable SQL dump. Useful for restoring to a different PostgreSQL version.
```
podman exec -e PGPASSWORD="$GITEA_DB_PASSWORD" gitea-postgres pg_dump -U gitea gitea > gitea-db-$(date +%F).sql
```
Set `PGPASSWORD` from `/opt/gitea/.env` (mode 0600).
### Restore procedure
1. Stop the stack: `systemctl --user stop gitea-server gitea-postgres`
2. Restore data: `tar xzf backup.tar.gz -C /opt/gitea/`
3. Start the stack: `systemctl --user start gitea-postgres gitea-server`
## Data Growth
- Git repositories grow with each commit and push. Monitor with `du -sh /opt/gitea/data/gitea-gitea/git/repositories/`.
- PostgreSQL WAL files accumulate. VACUUM via `podman exec gitea-postgres psql -U gitea -c "VACUUM;"`.
- Gitea's log files grow with usage.
## See Also
- ](index.md) — index with management commands
- [[management|management]] — operations and boot persistence
- [[architecture|architecture]] — network and ports