Created
January 20, 2017 20:59
-
-
Save vladfaust/470f69f28ed4f6b4e55247fdb5e4f99e to your computer and use it in GitHub Desktop.
Backup Dokku apps with Dropbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. Install Ruby on your server: https://gorails.com/setup/ubuntu/16.04 | |
# 1. Install Whenever gem on the server: https://github.com/javan/whenever | |
# 2. Cd to `/root/backup/`, install Dropbox Uploader (https://github.com/andreafabrizi/Dropbox-Uploader) into it | |
# 3. Go to https://www.dropbox.com/developers/apps, create a new app | |
# 4. Generate a new Access Token for that app | |
# 5. Run `./dropbox_uploader.sh` and import the Access Token | |
# 6. Create a `config` directory | |
# 7. Run `wheneverize .` | |
# 8. Edit `config/schedule.rb` file like this (it's just an example): | |
dropbox_path = 'a_path_related_to_this_server' # For example, 'my-server-backups' | |
every 3.day, at: '0:00 am' do | |
%w(app1 app2).each do |app| | |
command "dokku redis:export #{ app }-rdb > /root/backup/dumps/#{ app }/redis.rdb" | |
command "dokku postgres:export #{ app }-db > /root/backup/dumps/#{ app }/pg.dump" | |
end | |
command "/root/backup/dropbox_uploader.sh upload dumps #{ dropbox_path }" | |
end | |
# 9. Now run `whenever --update-crontab` and `crontab -l` | |
# 10. Be happy with regular backups! :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment