From 7ec64630a7968921a3122db79f260b4243ce489d Mon Sep 17 00:00:00 2001 From: Felix Nehrke Date: Sun, 26 Apr 2026 17:22:02 +0200 Subject: [PATCH] Switch from HA-Cluster to single-instance DB for gitea Intially I had setup a high availability cluster for my gitea instance, basically as an experiment. Though this experiement was doomed by my effort to keep the required infrastructure small when ever possible. In the end I struggled with constant downtimes due to memory limitations and other sideeffects. On the other hand I do _not_ need a highly available DB for my very personal git-server. In the worst case I can still deconnect the whole thing from the internet, restart it and investigate issues without pressure. Note though that even this little shift needed some preparation: 1. Forward the DB-port to the local machine `kubectl port-forward -n gitea service/gitea-postgresql-ha-pgpool 5432:5432` 2. Create valid backup of the DB `pg_dump --dbname=gitea --file=/app/Gitea-$(date +%Y_%m_%d_%H_%M_%S)-dump.sql -F c --host=localhost --port=5432` 3. Apply the new setup `ansible-playbook site.yml --tags=gitea` 4. Forward the DB-port to the local machine of the new DB `kubectl port-forward -n gitea service/gitea-postgresql 5432:5432` 5. Restore the DB cleanly (`-c`) `pg_restore -c --username=gitea --host=localhost --port=5432 -d gitea Gitea-*-dump.sql` 6. Reupload one of the SSH-Keys to restore the SSH-configuration on disk from DB. --- roles/k8s-setup/tasks/_gitea.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/k8s-setup/tasks/_gitea.yml b/roles/k8s-setup/tasks/_gitea.yml index 166bd8d..d091e13 100644 --- a/roles/k8s-setup/tasks/_gitea.yml +++ b/roles/k8s-setup/tasks/_gitea.yml @@ -107,12 +107,12 @@ persistence: size: 15Gi postgresql: - enabled: False + enabled: True primary: persistence: size: 2Gi postgresql-ha: - enabled: True + enabled: False persistence: size: 2Gi valkey: