|
Hi there! I'm trying to understand how to do proper backups with NC. For my current setup, I have a cluster S3 storage and an external PostgreSQL database. So from my understanding, the only things that have to be backed up are the S3 bucket containing the data and the SQL db. All the config is mapped into the container with ConfigMaps and Secrets anyway, so I don't see a need to backup the config directory. Apps and themes can theoretically be regenerated by a script, so there's no need to back these up. Are there any gotchas that I overlooked? This topic seems to be needlessly complicated somehow. Here is my current setup if interested: https://github.com/Joker9944/k8s-config/tree/ea3af16684cd11d2b487e852eeedf9c98ef3f31d/apps/base/nextcloud |
Replies: 1 comment
|
Backing up the S3 bucket and PostgreSQL database is necessary, but I would not treat it as a complete or safely restorable Nextcloud backup by itself. You should preserve, and restore consistently:
ConfigMaps/Secrets are enough only if they contain all effective configuration and are themselves backed up outside the cluster. The image/entrypoint can generate values such as the instance ID, secrets, object-store settings, trusted domains and app configuration. Losing or accidentally regenerating those can make a database + bucket restore fail, and Kubernetes Secrets are not a backup unless your GitOps/external-secret source is recoverable. Take a crash-consistent set: enable maintenance mode, stop/background-drain writers, snapshot/dump PostgreSQL and S3 at the same logical point, preserve the config, then disable maintenance mode. Restoring the database from time T with objects from time T+N can leave dangling or missing file-cache entries. Apps and themes can be rebuilt only if their exact versions and installation steps are reproducible. In practice I would back up the /var/www/html PVC (or at least config/, custom_apps/, themes/, plus any non-S3 data still present) even when S3 is primary storage. The chart itself points to Nextcloud's official backup procedure and explicitly notes maintenance mode for backups: Backups. S3 replaces primary file storage, but the chart notes the local data directory may still be used for compatibility: Object Storage as Primary Storage. Most importantly, test a full restore into an isolated namespace. A backup strategy is only complete once that restore succeeds. |
Backing up the S3 bucket and PostgreSQL database is necessary, but I would not treat it as a complete or safely restorable Nextcloud backup by itself.
You should preserve, and restore consistently:
ConfigMaps/Secrets are enough only if they contain all effective configuration and are themselves backed up outside the cluster. The im…