Skip to main content

Backups

The installer schedules a backup every night (a systemd timer or, without systemd, /etc/cron.d/sugardaddy-copias) and keeps the last 14. To make one now, from the node's folder:

cd /opt/sugardaddy
sudo ./copia.sh

It saves the database, the secrets (.env), the versions and the HTTPS CA to copias/sugardaddy-<date>.tar.age, encrypted and authenticated with age to the public key in clave-copias.pub.

Keep the private key clave-copias.age OUTSIDE the machine. Without it, the backup cannot be restored. Once it is safe, you can delete it from the machine: the node only needs the public key to make backups. To use your own key from the start, install with SUGARDADDY_COPIAS_CLAVE=age1….

To turn the nightly backups off, install with SUGARDADDY_COPIAS=0, or put SUGARDADDY_COPIAS=no in the node's .env. A node installed before backups were on by default gets them scheduled by its next update, unless it has that line. A timer or cron entry you already have is never changed.

Copy them off the machine​

A backup that only lives on the node's disk is lost with it. In Settings → Backups → Destination choose where a copy of each one goes:

  • Shared folder (SMB): a Windows share, a NAS or Samba (server, share, user and password). Docker on the node mounts it for a few seconds for each upload with the Linux kernel SMB client; nothing is installed. SMB 3 encryption is required by default.
  • S3-compatible bucket: Amazon S3, MinIO, Wasabi, Ceph, Cloudflare R2… (endpoint, bucket, access key).
  • Azure Blob container: a SAS URL for the container with the permissions Read, Add, Create, Write, Delete and List (sp=racwdl).

Give it a credential that can only use that place. It is stored encrypted with the node's key and only the node updater reads it. The node updater uploads each new backup within a minute, keeps the last ones you choose there (30 by default) and shows in Status the last upload, its SHA-256 and the backups in your storage. The backups are already encrypted to your public key: the storage never sees their content.

Lock them (recommended). With a bucket created with S3 Object Lock, or an Azure container with version-level immutability (and the i permission in the SAS), each backup is uploaded locked for the days you choose: nobody can delete it before then, not even someone who steals the node's credential. Choose more days than backups you keep. On S3, deleting a locked backup only hides it (a delete marker): add a lifecycle rule that removes old versions once their lock expires. A shared folder cannot lock files: use the snapshots or WORM features of your file server.

Restore test. Every 30 days (and when you click Run a restore test now) the node downloads the latest backup from your storage and checks it without touching the running node: that it is byte for byte what it uploaded and that it is a complete age file. Only if the private key is on the machine does it also decrypt it and check that the database, .env and versiones.env are there. With the private key kept off the machine, as recommended, the result is Passed, without decryption: check that it decrypts where you keep the key, with ./restaurar.sh --comprobar -i /path/to/clave-copias.age <backup>.

If backups are not made, do not reach your storage or fail the test, the console says so on that page and sends a health alert to your outputs and SIEM (salud.copias-sin-hacer, salud.copias-sin-subir, salud.copias-prueba). Meanwhile the backups stay on the machine.

Restore​

On a new machine, with the backup and its private key:

cd /opt/sugardaddy
sudo ./restaurar.sh -i /path/to/clave-copias.age copias/sugardaddy-<date>.tar.age

It leaves the node as it was: decoys, events and secrets. If someone changed or cut the backup, it stops before touching anything. To only check that a backup can be restored, add --comprobar; without the private key it can only check the format and says so (exit code 3). Backups from before age (.tar.enc) are still restored with clave-copias. To restore one from your storage, download it first (aws s3 cp, azcopy, the share…) to the node's copias/ folder.