Skip to content

Mini-guide: automating backups when your provider's 'daily' means 'when we feel like it'

General Discussion by priya 7 replies 544 views
#1

Dear/madam,

This tutorial is for those only who have learned the hard way that "daily backup" in cheap hosting means "weekly if you are lucky." I am using restic and rclone on Debian itself.

Step 1: Install restic only from backports. The stable version itself is too old.

#!/bin/bash
export RESTIC_PASSWORD="your-password-here"
export B2_ACCOUNT_ID="your-key"
export B2_ACCOUNT_KEY="your-secret"

restic -r rclone:b2:mybucket backup /var/www
restic -r rclone:b2:mybucket forget --keep-daily 7 --keep-weekly 4
Step 2: Cron at 3 AM itself. Kindly redirect output to /dev/null or your mailbox will cry.

Step 3: Test your restore. I am requesting this sincerely. Do not be the person who discovers corruption after the incident.

Questions are welcome only from those who have read the documentation first.

Regards,
Priya

#2
priya said:
Test your restore

Article 5(1)(f) of GDPR mandates integrity and confidentiality. An untested backup is a personal data breach waiting to happen. I am adding healthchecks.io ping to this cron job for accountability purposes.

*/5 * * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/your-uuid-here

This creates an audit trail. Under Article 13, you must inform data subjects of processing safeguards. Is your B2 bucket in the EEA? If not, Standard Contractual Clauses apply. I still have Article 13 flashbacks from 2019.

#3
brusselsdzire1 said:
Audit trail

Very good my priend xixixi I am buy B2 yesterday lah but I am never test restore xixixi

Going to do now lah going to pind my bucket xixixi

Healthchecks is pree tier only? I am click already xixixi

4 #4
Joy said:
Never test restore

Cara this is dat energy véi kkkkk

Let me tell you my story véi. Three years passed with restic running every night kkkk slept peaceful cara

Then one day needed file typed restore discovered repo password is wrong kkkkkkkkkk

Going to cry now véi. Test every month from dat day cara. Set calendar alarm not trust automation itself kkkk

chill infrastructure for chill people 🦫
#5

#priya #kindly #your #script #is #missing #one #thing #no #rclone #config #path #specified #this #will #fail #in #cron #environment #because #cron #does #not #load #user #bashrc #ever #also #healthchecks #uuid #should #be #secret #not #pasted #in #forum #yes #really #all #the #time #no #exceptions #ever

...
#6

Which backports version, 12 or 13

#7

Scc alone won't save you from a bad restore test.

...
#8

Debian stable or testing, and which restic build

Post a reply

You need an account to reply. Log in or register to join the conversation.

Post reply Preview Save draft