My instance data all got wiped when attempting to upgrade to 1.1.1, so .. being that this is under heavy development still :-) Anyone have a good plan for doing data backups? Particularly when running under Docker ? Might be a good thing to add to the Admin guide (i didn't see anything about it)
I know it's probably a newbie question, that anyone with some Docker knowledge and/or PGSQL knowledge would probably know the answer to, but I want to make sure that I cover any specific data that would be involved -- is just backing up the database sufficient? (and how? :-) ) .. and I don't really currently have any Docker or PGSQL knowledge.
There's a thread about this on the mastodon-admins mailing list here https://lists.ffdn.org/wws/arc/mastodon-admin/2017-04/msg00160.html. It would be nice to add this to https://github.com/tootsuite/documentation though
I'd say doing daily (or hourly, wth) dumps of the mastodon_production database, as well as rsyncs of the /live folder should be enough, what do you think?
Then just restore the database dump and /live folder if you want to rollback.
@wxcafe Backup and Restore function will be available at what time in the future?
There won't be a backup/restore function available from inside mastodon, you have to use your own backup software to backup your instance. See the thread on the mailing list linked above. You have to backup the install directory (~mastodon/live) and the PosgreSQL database.
There won't be a backup/restore function available from inside mastodon
Actually this is something I'd like to do in the future! But it's not urgent and not nearly as high priority as all the end-user facing things.
THIS SCRIPT IS FOR REFERENCE ONLY.
#!/bin/bash
# WRAN: THIS IS MY TEMPORARY WORKAROUND.
# WRAN: THIS SCRIPT IS FOR REFERENCE ONLY.
# WRAN: Because **mastodon** does not provide BACKUP and RESTORE methods from within,
# WRAN: So this method contains UNPREDICTABLE problems.
# see https://www.postgresql.org/docs/current/static/backup-file.html
cd "/opt/mastodon" || exit # enter working directory
BACKUP="/opt/mastodon-backup"
BACKUP_NAME="${1:-$(date -u +"%Y%m%d%H%M%S")}"
BACKUP_FILE="$BACKUP/$BACKUP_NAME.tgz"
[[ -d "$BACKUP" ]] || mkdir -p "$BACKUP"
docker-compose pause
tar zvcf "$BACKUP_FILE" "."
docker-compose unpause
@Gargron What would be the strict minimum to backup for a Docker instance?
docker exec -t mastodon_db_1 pg_dumpall -c -U postgres > $file)docker-compose.yml file.env.production file@ericblade and everyone, I've started a simple project called incognitum that has the following features:
One touch, three minute install
Set-it-and-forget-it backups will automatically run a backup of all your sites every night and email you in case of failure
Works with both Docker / Non-Docker installation types [not yet implemented / work in progress]
Stores backups both locally and remotely [on S3]
Encrypts all remote backups with a 42 character passphrase
Requires no configuration inside Mastodon and/or Docker, everything happens on the filesystem level completely unbeknownst to the application / containers themselves.
Performs a test restore before every S3 backup to ensure remote backup integrity and passphrase match
Allows you to restore your backup with one single command and a maximum of three minutes of your time even from a blank machine you've never set up before [not yet implemented / work in progress]
Perfectly restores every aspect of the Mastodon instance you're hosting, from your database, to all of your files
Outputs clean and colorful logs and stores them automatically inside its own log directory
For now restores and Non-Docker backups are not yet implemented, but Docker backup works great! In fact, this code is what's keeping our mastodon instance https://md.os.vu backed up every day on S3! If anyone running Debian/Ubuntu on their server is interested, please try it out and let me know how it's working for you!
Most helpful comment
Actually this is something I'd like to do in the future! But it's not urgent and not nearly as high priority as all the end-user facing things.