From 912f2e3a824307d70ded99d983e69aea3ef7995b Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Sat, 17 Jan 2026 08:48:16 -0800 Subject: [PATCH] Fix borgmatic PostgreSQL backup and update backup sources - Add explicit pg_dump_command path to fix "pg_dump: command not found" error when running via LaunchAgent (no homebrew in PATH) - Remove kiwix-tools from backups (was just symlinks, ZIM archives are re-downloadable via torrent) - Enable Loki log backup by removing from exclude_patterns Co-Authored-By: Claude Opus 4.5 --- ansible/roles/borgmatic/defaults/main.yml | 4 ++-- ansible/roles/borgmatic/templates/config.yaml.j2 | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ansible/roles/borgmatic/defaults/main.yml b/ansible/roles/borgmatic/defaults/main.yml index 243ba4d..a62e5de 100644 --- a/ansible/roles/borgmatic/defaults/main.yml +++ b/ansible/roles/borgmatic/defaults/main.yml @@ -11,7 +11,6 @@ borgmatic_schedule_minute: 0 borgmatic_source_directories: - /Users/erichblume/code/personal/zk - /opt/homebrew/var/forgejo - - /Users/erichblume/code/3rd/kiwix-tools - /Users/erichblume/.config/borgmatic - /Users/erichblume/Documents - /Users/erichblume/Pictures @@ -29,7 +28,6 @@ borgmatic_repositories: borgmatic_exclude_patterns: # Exclude mirrored PyPI cache (only backup private packages) - /Users/erichblume/devpi/+files/root/pypi - - /opt/homebrew/var/loki # Encryption passcommand (reads borg passphrase) borgmatic_encryption_passcommand: cat /Users/erichblume/.borg/config.yaml @@ -41,6 +39,8 @@ borgmatic_keep_yearly: 1000 # PostgreSQL databases to backup (streamed via pg_dump) # Password is read from ~/.pgpass (managed by postgresql role) +# pg_dump_command must be full path since LaunchAgent doesn't have homebrew in PATH +borgmatic_pg_dump_command: /opt/homebrew/opt/postgresql@18/bin/pg_dump borgmatic_postgresql_databases: - name: miniflux hostname: localhost diff --git a/ansible/roles/borgmatic/templates/config.yaml.j2 b/ansible/roles/borgmatic/templates/config.yaml.j2 index 4a782bf..16ce0e4 100644 --- a/ansible/roles/borgmatic/templates/config.yaml.j2 +++ b/ansible/roles/borgmatic/templates/config.yaml.j2 @@ -35,6 +35,9 @@ keep_yearly: {{ borgmatic_keep_yearly }} {% if borgmatic_postgresql_databases %} # PostgreSQL database backups (streamed via pg_dump) +{% if borgmatic_pg_dump_command is defined %} +pg_dump_command: {{ borgmatic_pg_dump_command }} +{% endif %} postgresql_databases: {% for db in borgmatic_postgresql_databases %} - name: {{ db.name }}