-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Automated Backup #117
Add Automated Backup #117
Conversation
This is a response to #116 @Kukks @NicolasDorier. Adds the following:
Right now Dropbox is the only uploader script that's actually written, but The following environmental variables are expected to be set:
I presume ultimately you guys will set those env variables through the web interface, or you may bag my Dropbox client altogether for something else you're building. DO NOT USE WITH SENSITIVE DATA: |
whoa, that is a lot of new files |
@Kukks Those 100 files are the Dropbox SDK library and its dependencies. I included them whole since Without those, this is just two files: If you're not using my Dropbox script than it wouldn't matter at all and you'd just need |
No, just need to use a python docker image. |
I like this. The host would just need to run the docker image and bind the volumes folders. That way, we have repeatable backup solution for any distrib. |
@JeffVandrewJr Can you dockerify it and put it to https://github.com/btcpayserver/dockerfile-deps ? Don't need to do the ARM part if you don't have the time, I can do it once you have the amd64 working. This repo would then just run a command on the backup docker image. |
Sure, I can do that. In my head I didn't run it in Docker to begin with because I was thinking Docker would be shut down for the backup, but I was being stupid because obviously I'm bringing Docker back up before the upload starts anyway. I'll work on that tomorrow. |
@JeffVandrewJr I am not even sure that it is worth it to shut down docker containers. |
Dockerizing was easy so I made the changes before bed. See the changes thta I made both to this PR and also btcpayserver/dockerfile-deps#4 I have Lightning aside, it seems like there would be less chance of getting a backup of corrupt data by stopping everything for a few minutes. But if I'm off base, we can just remove that line from Changes made to file locations:
What stays the same:
Changes made to
To do:
|
@JeffVandrewJr I think the image for dropbox is perfect. However, you should allow the user to put his own file name in case he wants to keep multiple backups. |
Ideally here what we should have: STORAGE_PROVIDER=dropbox DROPBOX_TOKEN=abc backup.sh januarybackup.tar.gz
|
@NicolasDorier I have implemented all of your suggestions and updated The only exception is that I did continue to pass the As mentioned above, this is still currently unencrypted. |
Thinking of having this as an automated cron, Would it make more sense to change the filename="backup.tar.gz" to perhaps filename="backup_$(date "+%b-%d-%Y-%H-%M-%S").tar.gz" or something similar? This would ensure duplicate files are not overwritten, unless thats the goal? |
The filename is only At least with the Dropbox client, you'd probably want the files to be constantly overwritten because Dropbox automatically stores prior versions and allows you to restore them. The prior versions don't count against your storage alottment if you do it that way. |
Yea, your right that probably makes more sense :) |
Changed the backup to the |
This is cool, once this is merged, I will add a new provider to the bash script "BTCPAY", which will copy the backup file to a drop folder in the btcpay docker volume which in turn will trigger a file upload to any of the configured cloud providers. :D |
Will review and test it later today. It is super cool. @JeffVandrewJr I think the Restore part should be handled by the same image though. (we can do later though, it should not be that complicated) |
Merging this, I need to properly document it though. @pavlenex might interest you. |
@NicolasDorier The backup tarballs this produces are uploaded unencrypted right now, as I wasn't sure how we wanted to handle the encryption step (password based encryption? Enforce strength?). |
unsure if it should be encrypted. This would be another piece of data (key, pass) that need to be saved and can be leaked and lost by the user. |
My description didn't carry, I'll add it below in a sec.
EDIT: See description and caveats below ⬇️