Add borgmatic backups for authentik and immich databases

Closes the gap where only miniflux and teslamate were backed up.
Authentik (blumeops-pg) just needed a config entry. Immich (immich-pg)
required a new borgmatic managed role, ExternalSecret, Tailscale
service, and Caddy L4 proxy on port 5433.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-03-27 16:52:41 -07:00
commit 1b18748f51
9 changed files with 90 additions and 6 deletions

View file

@ -70,3 +70,12 @@ borgmatic_postgresql_databases:
hostname: pg.ops.eblu.me hostname: pg.ops.eblu.me
port: 5432 port: 5432
username: borgmatic username: borgmatic
- name: authentik
hostname: pg.ops.eblu.me
port: 5432
username: borgmatic
# immich-pg cluster (VectorChord) via Caddy L4 on port 5433
- name: immich
hostname: pg.ops.eblu.me
port: 5433
username: borgmatic

View file

@ -15,6 +15,7 @@
content: | content: |
# Managed by ansible (borgmatic role) - k8s PostgreSQL backup credentials # Managed by ansible (borgmatic role) - k8s PostgreSQL backup credentials
pg.ops.eblu.me:5432:*:borgmatic:{{ borgmatic_db_password }} pg.ops.eblu.me:5432:*:borgmatic:{{ borgmatic_db_password }}
pg.ops.eblu.me:5433:*:borgmatic:{{ borgmatic_db_password }}
dest: ~/.pgpass dest: ~/.pgpass
mode: '0600' mode: '0600'
no_log: true no_log: true

View file

@ -101,7 +101,9 @@ caddy_tcp_services:
- port: 2222 - port: 2222
backend: "localhost:2200" # Forgejo SSH backend: "localhost:2200" # Forgejo SSH
- port: 5432 - port: 5432
backend: "pg.tail8d86e.ts.net:5432" # PostgreSQL backend: "pg.tail8d86e.ts.net:5432" # PostgreSQL (blumeops-pg)
- port: 5433
backend: "immich-pg.tail8d86e.ts.net:5432" # PostgreSQL (immich-pg)
- port: "{{ sifaka_node_exporter_port }}" - port: "{{ sifaka_node_exporter_port }}"
backend: "sifaka:{{ sifaka_node_exporter_port }}" # Sifaka node_exporter backend: "sifaka:{{ sifaka_node_exporter_port }}" # Sifaka node_exporter
- port: "{{ sifaka_smartctl_exporter_port }}" - port: "{{ sifaka_smartctl_exporter_port }}"

View file

@ -0,0 +1,29 @@
# ExternalSecret for borgmatic backup user password on immich-pg cluster
#
# Reuses the same 1Password item as blumeops-pg-borgmatic.
# 1Password item: "borgmatic" in blumeops vault
# Field: "db-password"
#
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: immich-pg-borgmatic
namespace: databases
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-blumeops
target:
name: immich-pg-borgmatic
creationPolicy: Owner
template:
type: kubernetes.io/basic-auth
data:
username: borgmatic
password: "{{ .password }}"
data:
- secretKey: password
remoteRef:
key: borgmatic
property: db-password

View file

@ -30,6 +30,21 @@ spec:
- CREATE EXTENSION IF NOT EXISTS cube CASCADE; - CREATE EXTENSION IF NOT EXISTS cube CASCADE;
- CREATE EXTENSION IF NOT EXISTS earthdistance CASCADE; - CREATE EXTENSION IF NOT EXISTS earthdistance CASCADE;
# Managed roles
# Note: connectionLimit, ensure, inherit are CNPG defaults added to prevent ArgoCD drift
managed:
roles:
# borgmatic read-only user for backups
- name: borgmatic
login: true
connectionLimit: -1
ensure: present
inherit: true
inRoles:
- pg_read_all_data
passwordSecret:
name: immich-pg-borgmatic
# Resource limits for minikube environment # Resource limits for minikube environment
resources: resources:
requests: requests:

View file

@ -7,8 +7,10 @@ resources:
- blumeops-pg.yaml - blumeops-pg.yaml
- immich-pg.yaml - immich-pg.yaml
- service-tailscale.yaml - service-tailscale.yaml
- service-immich-pg-tailscale.yaml
- service-metrics-tailscale.yaml - service-metrics-tailscale.yaml
- external-secret-eblume.yaml - external-secret-eblume.yaml
- external-secret-borgmatic.yaml - external-secret-borgmatic.yaml
- external-secret-immich-borgmatic.yaml
- external-secret-teslamate.yaml - external-secret-teslamate.yaml
- external-secret-authentik.yaml - external-secret-authentik.yaml

View file

@ -0,0 +1,22 @@
# Tailscale LoadBalancer for immich-pg PostgreSQL access
# Canonical hostname: immich-pg.tail8d86e.ts.net
# Caddy L4 proxies pg.ops.eblu.me:5433 → this service for borgmatic backups
apiVersion: v1
kind: Service
metadata:
name: immich-pg-tailscale
namespace: databases
annotations:
tailscale.com/hostname: "immich-pg"
tailscale.com/proxy-class: "default"
spec:
type: LoadBalancer
loadBalancerClass: tailscale
selector:
cnpg.io/cluster: immich-pg
role: primary
ports:
- name: postgresql
port: 5432
targetPort: 5432
protocol: TCP

View file

@ -0,0 +1 @@
Add borgmatic pg_dump backups for authentik and immich databases. Authentik uses the existing blumeops-pg cluster on port 5432. Immich requires a new borgmatic role on the immich-pg cluster, a Tailscale service, and Caddy L4 proxy on port 5433.

View file

@ -1,6 +1,6 @@
--- ---
title: Backups title: Backups
modified: 2026-03-15 modified: 2026-03-27
tags: tags:
- storage - storage
- backup - backup
@ -29,10 +29,13 @@ Daily automated backups from [[indri]] to [[sifaka|Sifaka]] NAS.
### Databases ### Databases
| Database | Host | Method | | Database | Cluster | Host | Method |
|----------|------|--------| |----------|---------|------|--------|
| miniflux | [[postgresql|pg.ops.eblu.me]] | pg_dump stream | | miniflux | blumeops-pg | [[postgresql|pg.ops.eblu.me:5432]] | pg_dump stream |
| teslamate | [[postgresql|pg.ops.eblu.me]] | pg_dump stream | | teslamate | blumeops-pg | [[postgresql|pg.ops.eblu.me:5432]] | pg_dump stream |
| authentik | blumeops-pg | [[postgresql|pg.ops.eblu.me:5432]] | pg_dump stream |
| immich | immich-pg | [[postgresql|pg.ops.eblu.me:5433]] | pg_dump stream |
| mealie | — (SQLite) | k8s pod | kubectl exec sqlite3 .backup |
## Sifaka-Native Data ## Sifaka-Native Data