Created new add-on to backup snapshots to Google Drive

hassio-addon
Tags: #<Tag:0x00007f204210a568>

#21

Not sure how the purges is supposed to work - I have 2 backups on the rpi and on google drive I had 4. So I just have removed 2 in hassio.

In the addon I have purge parameter set to 3, but the response from the web call is:

{"fromPattern": "/backup/*.tar", "backupDirID": "funny_string_here", "fileCount": 2, "alreadyCount": 2, "backedUpCount": 0, "deletedCount": 0}

So that means I have to leave the files in hassio until the addon has done its work and only then I can remove them? I suppose it uses the filenames of the image files to look them up in google drive in order to decide what needs to be done: keep or remove?

This is very useful - thank you for sharing it!

Jhh


#22

Actually, that’s not what it’s doing. The purge takes no consideration of Google Drive whatsoever, nor does it consider what files in your hassio backup folder have been backed up at all. The “purge” feature is simply to purge older files from your hassio backup folder. The number, labeled “preserve”, is the number of files that you want to preserver in your hassio backup folder. So, to say “preserve 3” means to say “I want you to delete all the older files in my hassio backup folder, but preserve for me, please, the newest 3 files.”

I’m sorry that wasn’t clearer in the Readme.

By the way, I’m contemplating adding a similar feature for Google Drive where you can tell it to keep your Google Drive purged of older backups, while preserving more recent ones.


#23

I don’t look into google drive that often so if cleanup was automated that would be great. I’m not sure if the readme is unclear as I took it for granted that everything the addon did was on the google drive side :blush: once more.


#24

Okay. I had a little time on my hands, so I went ahead and added the purge from Google Drive option. Version 1.2.0 of the add-on is available now.


#25

Earlier had an issue where it created a duplicate file on google drive but installed latest version now and it looks really good! Synched and cleaned up nicely.

Thx!


#26

It’s always possible that there was/is an issue with my add-on. But, keep in mind that it does have the potential to create apparent duplicates. If someone other than my add-on creates a file on your Google Drive with the same name as one of the files that my add-on copies to your Google Drive, it will not detect a duplicate, because it has no visibility to the file that it did not create. It can only see files that it creates itself.


#28

Great idea! I was struggling with this for a while, so I had to put something together with Samba, and then SyncToy and Task Scheduler on my Windows computer to sync it to my Google Drive folder


#29

Hi there,

Thanks for the plugin! Really keen to give it a go, but a have a question regarding security and how it would work with it.
To allow it to work, you’d need to set up a port forward from external 8055 to internal 8055 right? If so, how safe is this?

Thanks again


#30

Actually, no, the add-on does not rely on port forwarding at all. In fact, I strongly recommend against exposing this port outside of your home network. You can either setup a scheduled Home Assistant Automation (an automation with a time-based trigger) to run your backups periodically and automatically, or, you can request backups manually by calling the REST service (the /gb/doBackup operation) from somewhere on your home network. The only reason imaginable to setup port forwarding would be if you want to be able to manually initiate a backup while you are away from home. But, I wouldn’t recommend it.


#31

Ok, then maybe I’m missing something…
To set the plugin up initially… I click on the Open WebUI link which sends me to https://ExternalURL:8055/gb which isn’t allowed.

Thats why I thought that the ports need to be forwarded and am not keen to do so at all.

How would one get around this?


#32

Use your local IP - so http://xxx.xxx.xxx.xxx:8055/gb/ should work. No need to open anything. On my setup it is http rather than https.


#33

Aaah, I thought I was overcomplicating it for myself! :man_facepalming:
Thanks for the help!


#34

Thanks for making this add-on. It just saved me a ton of frustration. My SD Card decided it would be a good day to die. I had just set up your add-on to backup to my google drive this past weekend. A simple restore later, and my system is back in action!


#35

Wow! I’m glad to hear that it helped you out. Thanks for sharing this.


#36

I just tried to set this up but I get ‘server error 500’ when I click ‘ingest code’… any ideas?


#37

is that an ssl error?


#38

not sure… I am trying to do it within my network so the SSL cert isn’t for that address… maybe thats the issue?


#39

most probably. Like Google Assistant only works over SSL (the component) You have to give Google a https endpoint to connect to. I would assume google drive is the same.

You could use caddy to proxy to whatever you want and use that… that would work.


#40

i temporarily opened the port so I could go through the auth process using my duckdns address and that worked.


#41

This backup is awesome, also saved me a bunch of pain when my SD Card decide to lock itself and became unusable. Luckily I’d just set this up with a fresh back-up and was running a few hours later again.

Question, if I setup a weekly snapshot (as per this thread, based on the advice earlier - Hassio 0.61 Snapshot Service) - how do I get it to also trigger this tool to then run the backup?