Skip to content

feat: back up Honcho to RustFS - #4897

Merged
damacus merged 2 commits into
mainfrom
codex/feat-honcho-backups
Nov 25, 2026
Merged

damacus merged 2 commits into
mainfrom
codex/feat-honcho-backups

Conversation

@damacus

@damacus damacus commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Enables the same Barman Cloud backup pattern used by Mealie and Home Assistant for the Honcho PostgreSQL database. It archives WAL and schedules daily base backups to a dedicated RustFS bucket with 30-day retention.

  • Provisions the bucket and its restricted identity before enabling archiving.
  • Starts the first backup after the rollout confirms continuous archiving, avoiding the startup race found on Docker Desktop.
  • Documents the separate-cluster recovery procedure.

Docker Desktop validated provisioning, WAL archiving, and completion of the first base backup. The rollout includes checking the first production backup.


Devin Review

@github-actions

Copy link
Copy Markdown
@@ spec.dependsOn @@
# kustomize.toolkit.fluxcd.io/v1/Kustomization/flux-system/honcho-db
! + one list entry added:
+ - name: honcho-buckets

@@ spec @@
# postgresql.cnpg.io/v1/Cluster/dev/honcho-db
! + one map entry added:
+ plugins:
+ - name: barman-cloud.cloudnative-pg.io
+   isWALArchiver: true
+   parameters:
+     barmanObjectName: honcho-rustfs-store
+     serverName: honcho-db

@@ data.bootstrap.sh @@
# v1/ConfigMap/storage/rustfs-iam-bootstrap
! ± value change in multiline text (one insert, no deletions)
  #!/bin/sh
  set -eu
  
  scope="${1:-all}"
  
  [219 lines unchanged)]
  
    provision_single_bucket_identity "rustfs-cnpg-litellm" "$RUSTFS_LITELLM_ACCESS_KEY" "$RUSTFS_LITELLM_SECRET_KEY" "cnpg-litellm"
    exit 0
  fi
  
+ if [ "$scope" = "honcho" ]; then
+   provision_single_bucket_identity "rustfs-cnpg-honcho" "$RUSTFS_HONCHO_ACCESS_KEY" "$RUSTFS_HONCHO_SECRET_KEY" "cnpg-honcho"
+   exit 0
+ fi
+ 
  if [ "$scope" = "med-tracker-dmd" ]; then
    provision_single_bucket_identity "rustfs-med-tracker-dmd" "$RUSTFS_MED_TRACKER_DMD_ACCESS_KEY" "$RUSTFS_MED_TRACKER_DMD_SECRET_KEY" "med-tracker-dmd"
    exit 0
  fi
  
  [24 lines unchanged)]
  
  provision_single_bucket_identity "rustfs-longhorn" "$RUSTFS_LONGHORN_ACCESS_KEY" "$RUSTFS_LONGHORN_SECRET_KEY" "longhorn"
  provision_single_bucket_identity "rustfs-paperless" "$RUSTFS_PAPERLESS_ACCESS_KEY" "$RUSTFS_PAPERLESS_SECRET_KEY" "volsync-paperless"
  provision_tempo_identity
  provision_loki_identity

@@ data.bootstrap.sh @@
# v1/ConfigMap/storage/ssd-rustfs-iam-bootstrap
! ± value change in multiline text (one insert, no deletions)
  #!/bin/sh
  set -eu
  
  scope="${1:-all}"
  
  [219 lines unchanged)]
  
    provision_single_bucket_identity "rustfs-cnpg-litellm" "$RUSTFS_LITELLM_ACCESS_KEY" "$RUSTFS_LITELLM_SECRET_KEY" "cnpg-litellm"
    exit 0
  fi
  
+ if [ "$scope" = "honcho" ]; then
+   provision_single_bucket_identity "rustfs-cnpg-honcho" "$RUSTFS_HONCHO_ACCESS_KEY" "$RUSTFS_HONCHO_SECRET_KEY" "cnpg-honcho"
+   exit 0
+ fi
+ 
  if [ "$scope" = "med-tracker-dmd" ]; then
    provision_single_bucket_identity "rustfs-med-tracker-dmd" "$RUSTFS_MED_TRACKER_DMD_ACCESS_KEY" "$RUSTFS_MED_TRACKER_DMD_SECRET_KEY" "med-tracker-dmd"
    exit 0
  fi
  
  [24 lines unchanged)]
  
  provision_single_bucket_identity "rustfs-longhorn" "$RUSTFS_LONGHORN_ACCESS_KEY" "$RUSTFS_LONGHORN_SECRET_KEY" "longhorn"
  provision_single_bucket_identity "rustfs-paperless" "$RUSTFS_PAPERLESS_ACCESS_KEY" "$RUSTFS_PAPERLESS_SECRET_KEY" "volsync-paperless"
  provision_tempo_identity
  provision_loki_identity

@@ (root level) @@
# kustomize.toolkit.fluxcd.io/v1/Kustomization/flux-system/honcho-buckets
! + one document added:
+ apiVersion: kustomize.toolkit.fluxcd.io/v1
+ kind: Kustomization
+ metadata:
+   name: honcho-buckets
+   namespace: flux-system
+   labels:
+     kustomize.toolkit.fluxcd.io/name: cluster-apps
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   decryption:
+     provider: sops
+     secretRef:
+       name: sops-age
+   dependsOn:
+   - name: rustfs-iam
+   - name: external-secrets-stores
+   interval: 30m
+   path: ./kubernetes/apps/storage/honcho-buckets/app
+   postBuild:
+     substituteFrom:
+     - name: cluster-settings
+       kind: ConfigMap
+       optional: true
+   prune: true
+   retryInterval: 1m
+   sourceRef:
+     name: home-kubernetes
+     kind: GitRepository
+   suspend: false
+   targetNamespace: storage
+   timeout: 15m
+   wait: true

@@ (root level) @@
# external-secrets.io/v1/ExternalSecret/storage/rustfs-honcho
! + one document added:
+ apiVersion: external-secrets.io/v1
+ kind: ExternalSecret
+ metadata:
+   name: rustfs-honcho
+   namespace: storage
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-buckets
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   data:
+   - remoteRef:
+       key: rustfs-cnpg-honcho
+       property: username
+     secretKey: username
+   - remoteRef:
+       key: rustfs-cnpg-honcho
+       property: password
+     secretKey: password
+   refreshInterval: 5m
+   secretStoreRef:
+     name: onepassword-connect
+     kind: ClusterSecretStore
+   target:
+     name: rustfs-honcho
+     template:
+       data:
+         RUSTFS_HONCHO_ACCESS_KEY: "{{ .username }}"
+         RUSTFS_HONCHO_SECRET_KEY: "{{ .password }}"
+       engineVersion: v2

@@ (root level) @@
# batch/v1/Job/storage/honcho-buckets-v1
! + one document added:
+ apiVersion: batch/v1
+ kind: Job
+ metadata:
+   name: honcho-buckets-v1
+   namespace: storage
+   annotations:
+     kustomize.toolkit.fluxcd.io/force: enabled
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-buckets
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   backoffLimit: 4
+   template:
+     spec:
+       automountServiceAccountToken: false
+       containers:
+       - name: rc
+         image: "rustfs/rc:v0.1.38@sha256:3c080aff53f0d3b06554fd08711d05c80be40bd7e56001874d7df5e18d5ec88a"
+         imagePullPolicy: IfNotPresent
+         command:
+         - /bin/sh
+         - /scripts/bootstrap.sh
+         - honcho
+         env:
+         - name: RUSTFS_ENDPOINT
+           value: "http://rustfs.storage.svc.cluster.local:9000"
+         - name: HOME
+           value: /tmp
+         volumeMounts:
+         - name: tmp
+           mountPath: /tmp
+         - name: bootstrap-script
+           mountPath: /scripts
+           readOnly: true
+         envFrom:
+         - secretRef:
+             name: rustfs-credentials
+         - secretRef:
+             name: rustfs-honcho
+         securityContext:
+           allowPrivilegeEscalation: false
+           capabilities:
+             drop:
+             - ALL
+           readOnlyRootFilesystem: true
+       restartPolicy: Never
+       securityContext:
+         runAsGroup: 10001
+         runAsNonRoot: true
+         runAsUser: 10001
+         seccompProfile:
+           type: RuntimeDefault
+       volumes:
+       - name: tmp
+         emptyDir: {}
+       - name: bootstrap-script
+         configMap:
+           name: rustfs-iam-bootstrap
+           defaultMode: 365

@@ (root level) @@
# batch/v1/CronJob/storage/honcho-buckets-sync
! + one document added:
+ apiVersion: batch/v1
+ kind: CronJob
+ metadata:
+   name: honcho-buckets-sync
+   namespace: storage
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-buckets
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   concurrencyPolicy: Forbid
+   failedJobsHistoryLimit: 1
+   jobTemplate:
+     spec:
+       activeDeadlineSeconds: 600
+       backoffLimit: 4
+       template:
+         spec:
+           automountServiceAccountToken: false
+           containers:
+           - name: rc
+             image: "rustfs/rc:v0.1.38@sha256:3c080aff53f0d3b06554fd08711d05c80be40bd7e56001874d7df5e18d5ec88a"
+             imagePullPolicy: IfNotPresent
+             command:
+             - /bin/sh
+             - /scripts/bootstrap.sh
+             - honcho
+             env:
+             - name: RUSTFS_ENDPOINT
+               value: "http://rustfs.storage.svc.cluster.local:9000"
+             - name: HOME
+               value: /tmp
+             volumeMounts:
+             - name: tmp
+               mountPath: /tmp
+             - name: bootstrap-script
+               mountPath: /scripts
+               readOnly: true
+             envFrom:
+             - secretRef:
+                 name: rustfs-credentials
+             - secretRef:
+                 name: rustfs-honcho
+             securityContext:
+               allowPrivilegeEscalation: false
+               capabilities:
+                 drop:
+                 - ALL
+               readOnlyRootFilesystem: true
+           restartPolicy: Never
+           securityContext:
+             runAsGroup: 10001
+             runAsNonRoot: true
+             runAsUser: 10001
+             seccompProfile:
+               type: RuntimeDefault
+           volumes:
+           - name: tmp
+             emptyDir: {}
+           - name: bootstrap-script
+             configMap:
+               name: rustfs-iam-bootstrap
+               defaultMode: 365
+       ttlSecondsAfterFinished: 604800
+   schedule: "*/5 * * * *"
+   successfulJobsHistoryLimit: 1

@@ (root level) @@
# external-secrets.io/v1/ExternalSecret/dev/rustfs-cnpg-honcho
! + one document added:
+ apiVersion: external-secrets.io/v1
+ kind: ExternalSecret
+ metadata:
+   name: rustfs-cnpg-honcho
+   namespace: dev
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-db
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   data:
+   - remoteRef:
+       key: rustfs-cnpg-honcho
+       property: username
+     secretKey: ACCESS_KEY_ID
+   - remoteRef:
+       key: rustfs-cnpg-honcho
+       property: password
+     secretKey: SECRET_ACCESS_KEY
+   refreshInterval: 5m
+   secretStoreRef:
+     name: onepassword-connect
+     kind: ClusterSecretStore
+   target:
+     name: rustfs-cnpg-honcho

@@ (root level) @@
# barmancloud.cnpg.io/v1/ObjectStore/dev/honcho-rustfs-store
! + one document added:
+ apiVersion: barmancloud.cnpg.io/v1
+ kind: ObjectStore
+ metadata:
+   name: honcho-rustfs-store
+   namespace: dev
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-db
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   configuration:
+     data:
+       compression: bzip2
+     destinationPath: "s3://cnpg-honcho/"
+     endpointURL: "http://rustfs.storage.svc.cluster.local:9000"
+     s3Credentials:
+       accessKeyId:
+         name: rustfs-cnpg-honcho
+         key: ACCESS_KEY_ID
+       secretAccessKey:
+         name: rustfs-cnpg-honcho
+         key: SECRET_ACCESS_KEY
+     wal:
+       compression: bzip2
+       maxParallel: 2
+   retentionPolicy: 30d

@@ (root level) @@
# postgresql.cnpg.io/v1/ScheduledBackup/dev/honcho-db
! + one document added:
+ apiVersion: postgresql.cnpg.io/v1
+ kind: ScheduledBackup
+ metadata:
+   name: honcho-db
+   namespace: dev
+   labels:
+     kustomize.toolkit.fluxcd.io/name: honcho-db
+     kustomize.toolkit.fluxcd.io/namespace: flux-system
+ spec:
+   backupOwnerReference: self
+   cluster:
+     name: honcho-db
+   method: plugin
+   pluginConfiguration:
+     name: barman-cloud.cloudnative-pg.io
+     parameters:
+       objectStore: honcho-rustfs-store
+   schedule: "0 40 3 * * *"
+   target: primary

@damacus
damacus enabled auto-merge (squash) November 25, 2026 23:27
@damacus
damacus merged commit 22d2042 into main Nov 25, 2026
16 of 17 checks passed
@damacus
damacus deleted the codex/feat-honcho-backups branch November 25, 2026 23:27

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

1 security issue not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

metadata:
name: honcho-db
spec:
schedule: "0 40 3 * * *"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 First backup lacks a rollout gate

The rollout description says the first backup waits for WAL archiving. ScheduledBackup follows the clock; only the manual backup procedure checks archiving first.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

```

Restore into a separate CloudNativePG cluster using
[`bootstrap.recovery`](https://cloudnative-pg.io/plugin-barman-cloud/docs/usage/#restoring-a-cluster-from-an-object-store)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Broken link to the restore example

The bootstrap.recovery link points to a fragment that does not exist. The upstream restore manifest is under #restoring-a-cluster.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +70 to +73
Restore into a separate CloudNativePG cluster using
[`bootstrap.recovery`](https://cloudnative-pg.io/plugin-barman-cloud/docs/usage/#restoring-a-cluster-from-an-object-store)
and the `honcho-rustfs-store` ObjectStore with source server name `honcho-db`.
Use a PostgreSQL image with pgvector available. Verify the restored data before

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Missing restore verification record

The PR reports a successful base backup but omits the verification commands required by the repository workflow. It also gives no result for bootstrap.recovery.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant