Backups are always important but often complicated to setup.
I decided to use Restic on our linux servers to back up all the important files to the Bbackblaze cloud storage.
Resic will encrypt your data and then upload it to Backblaze.
You first have to create a "bucket" at Backblaze, define it as private.
Then under "Show Account ID and Application Key" create a new "Application Key.
Here it is important that you give only access to the new created bucket (allow access to buckets).
Now copy and save the new created credentials for the next part.
In Ubuntu or Debian install Restic with the following command:
sudo apt-get install restic
Now lets create a new file to automate the backup process.
sudo nano /etc/myBackup.sh
an enter the following inside:
restic -r b2:_name_of_the_bucket_ backup /_path_you_want_to_backup_
This will create a snapshot of your defined folder.
Now initialize the backup:
restic -r b2:_name_of_the_bucket_ init
If you wish to keep only x number of backups add the following line:
restic -r b2:_name_of_the_bucket_ forget --keep-last 30 --prune
This will only keep the last 30 backups.
Now lets automate the backups, create a synbolic link to the backup script so that the cron daemon will execute it every day:
ln -s /etc/myBackup.sh /etc/cron.daily/myBackup.sh
And we are done.