Backup Vesta to Backblaze B2

Post Reply
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm


Before starting check if you got Python installed, i did this with PIP3 :)
1st:

Install B2_Command_Line_Tool https://github.com/Backblaze/B2_Command_Line_Tool

Code: Select all

pip install b2
2nd:
Update Vesta config $VESTA/conf/vesta.conf BACKUP_SYSTEM (local,b2 or only b2)

3nd:
Create $VESTA/conf/b2.backup.conf contains

BUCKET=<bucket_name>
B2_KEYID=<Application_Key_ID>
B2_KEY=<key>
Desktop_screenshot.png
Desktop_screenshot.png (257.26 KiB)
4rd:
Edit your CLI files as the follow :
https://github.com/sexymeow/vesta/pull/1/files

Files to edit:
-v-restore-user
-v-delete-user-backup
-v-backup-user



In case Backblaze B2 Application Keys fail to authorize, heres what i did:

Code: Select all

curl https://api.backblazeb2.com/b2api/v2/b2_authorize_account -u "APPLICATION_KEY_ID:APPLICATION_KEY"
Example:
curl https://api.backblazeb2.com/b2api/v2/b2 ... ze_account -u "0345234234280000000012:K003234234234234234234czzzz1A"

I followed this instructions: https://github.com/duplicati/duplicati/issues/3366

it should work, if anyone needs help let me know :mrgreen:
Last edited by webxtek on Fri Sep 23, 2022 10:14 pm, edited 11 times in total.
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

Let's say you want to have daily backups, or weekly, and monthly. You can backup to 2 different buckets, making a CRON task for each one! :mrgreen:

You can do as following,

1st
Create a secondary .conf file for example: b2.backupmonthly.conf

2nd
Create new bucket and keys for that .conf
BUCKET=<bucket_name>
B2_KEYID=<Application_Key_ID>
B2_KEY=<key>


3nd
Create monthly CLI's (just duplicate the Clis, rename them, and edit the code for the new .conf file)
clis example (1).png
clis example (1).png (2.42 KiB)

Now you can create a CRON 1 to backup for 1 bucket, and CRON 2 to backup to 2 bucket, you can make one backup every 3 days, and other backup monthly for example...

Inside backblaze panel, you can select buckets and edit "Lifecycle Settings", that way it gets deleted every X days.
For example i will keep:

-every 3 days backups for 1 month (cron1);
-every month backups for 6 months (cron2);
Last edited by webxtek on Wed Dec 23, 2020 3:34 am, edited 4 times in total.
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

and thats it, any help you need let me know :D
Last edited by webxtek on Wed Dec 23, 2020 1:48 am, edited 3 times in total.
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

@dpeca i need your advice, how can i make those Cli customizations not get deleted with updates? thanks
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

https://github.com/myvesta/vesta/blob/m ... tinst#L223

Code: Select all

# Run custom triggers
if [ -x "/root/vesta-patch.sh" ]; then
    /root/vesta-patch.sh
fi
that script (if exist) will be executed after EVERY update, so you can put there 'patching script' that will apply your modifications after every update.
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

are new bin files deleted on update?
If not i could just create new bin files for daily backups, like i did to monthly backups, and keep the original bin files without no customization :) what you think?
User avatar
myVesta
Site Admin
Posts: 928
Joined: Fri Jun 19, 2020 9:59 am
Has thanked: 8 times
Been thanked: 6 times

Nothing deleted, update will just overwrite existent myVesta files.
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

Cool dpeca.
I just created new BIN files, way easier :)

thank you!
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

UPDATED
User avatar
webxtek
Posts: 51
Joined: Wed Nov 18, 2020 7:43 pm

this week while migrating one MYVESTACP to another MYVESTACP, i found that while running

Code: Select all

v-restore-user userpanelname userpanelname.2022-09-25_01-00-50.tar
it was giving me a error telling me that i didn't had the permissions, after reading around i found that some people were having troubles restoring backups even on VESTACP with similar issues.
The solution is quite simple, the backup file name has the name of the USER, the DATE, and HOUR & MINUTE, the backup were done, you only need to delete from that the HOUR & MINUTE, and the file will restore without any issues.

IF YOUR FILE NAME LOOKS LIKE THIS:
1.jpg
1.jpg (7.08 KiB)
YOU NEED TO CHANGE TO THIS:
2.jpg
2.jpg (6.71 KiB)
The bin code would look like this:

Code: Select all

v-restore-user userpanelname userpanelname.2022-09-25.tar
Post Reply