Backup Phabricator

In this article, I will give an example of Phabricator backup.

You can export Phabricator databases with the following command:

./bin/storage dump --compress --output backup.sql.gz

Restore databases from backups using the command:

gunzip -c backup.sql.gz | mysql

Also backup the configuration file:

phabricator/conf/local/local.json

For example, I made a script like this:

#!/bin/bash
mkdir /backups/`date +%Y-%m-%d`
cd /backups/`date +%Y-%m-%d`
tar -cvpzf /backups/`date +%Y-%m-%d`/phabriator_`date +%Y-%m-%d`.tar.bz2 /home/phd/
/home/phd/phabricator/bin/storage dump --compress --output /backups/`date +%Y-%m-%d`/phabriator_`date +%Y-%m-%d`.sql.gz
# remove old data
find /backups/`date +%Y-%m-%d`/ -type d -mtime +4 -exec rm -rfv {} \;

And add to /etc/crontab:

0 2 * * * root /backups/scripts/backup_phabricator.sh >/dev/null 2>&1

If the repositories are not large, then you can also add them to the script:

tar -cvpzf /backups/`date +%Y-%m-%d`/phabriator_repo_`date +%Y-%m-%d`.tar.bz2 /var/repo/

See also my articles:
Install Phabricator on Ubuntu
Using and configuring CRON
nice and ionice. Process Priorities

Leave a comment

Leave a Reply