@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide some guidance on creating backups

Summary: A user asked for some instructions, so I wrote up some documentation.

Test Plan: Read document. This is more or less how secure.phabricator.com backups work and the one time we had a data loss issue restoration worked reasonably well.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3825

+99
+1
src/docs/configuration/configuration_guide.diviner
··· 259 259 - configuring inbound mail with @{article:Configuring Inbound Email}; or 260 260 - importing repositories with @{article:Diffusion User Guide}; or 261 261 - learning about daemons with @{article:Managing Daemons with phd}; or 262 + - configuring backups with @{article:Configuring Backups}; or 262 263 - contributing to Phabricator with @{article:Contributor Introduction}.
+98
src/docs/configuration/configuring_backups.diviner
··· 1 + @title Configuring Backups 2 + @group config 3 + 4 + Advice for backing up Phabricator. 5 + 6 + = Overview = 7 + 8 + Phabricator does not currently have a comprehensive backup system, but creating 9 + backups is not particularly difficult and Phabricator does have a few basic 10 + tools which can help you set up a reasonable process. In particular, the things 11 + which needs to be backed up are: 12 + 13 + - the MySQL databases; 14 + - uploaded files; and 15 + - your Phabricator configuration files. 16 + 17 + This document discusses approaches for backing up this data. 18 + 19 + = Backup: MySQL Databases = 20 + 21 + Most of Phabricator's data is stored in MySQL, and it's the most important thing 22 + to back up. You can run `bin/storage dump` to get a dump of all the MySQL 23 + databases. This is a convenience script which just runs a normal `mysqldump` 24 + of every database Phabricator owns. 25 + 26 + Since most of this data is compressible, it may be helpful to run it through 27 + gzip prior to storage. For example: 28 + 29 + phabricator/ $ ./bin/storage dump | gzip > backup.sql.gz 30 + 31 + Then store the backup somewhere safe, like in a box buried under an old tree 32 + stump. No one will ever think to look for it there. 33 + 34 + = Restore: MySQL = 35 + 36 + To restore a MySQL dump, just pipe it to `mysql` on a clean host. (You may need 37 + to uncompress it first, if you compressed it prior to storage.) 38 + 39 + $ gunzip -c backup.sql.gz | mysql 40 + 41 + = Backup: Uploaded Files = 42 + 43 + Uploaded files may be stored in several different locations. The backup 44 + procedure depends on where files are stored: 45 + 46 + **Default / MySQL**: Under the default configuration, uploaded files are stored 47 + in MySQL, so the MySQL backup will include all files. In this case, you don't 48 + need to do any additional work. 49 + 50 + **Amazon S3**: If you use Amazon S3, redundancy and backups are built in to the 51 + service. This is probably sufficient for most installs. If you trust Amazon with 52 + your data //except not really//, you can backup your S3 bucket outside of 53 + Phabricator. 54 + 55 + **Local Disk**: If you use the local disk storage engine, you'll need to back up 56 + files manually. You can do this by creating a copy of the root directory where 57 + you told Phabricator to put files (the `storage.local-disk.path` configuration 58 + setting). 59 + 60 + For more information about configuring how files are stored, see 61 + @{article:Configuring File Storage}. 62 + 63 + = Restore: Uploaded Files = 64 + 65 + To restore a backup of local disk storage, just copy the backup into place. 66 + 67 + = Backup: Configuration Files = 68 + 69 + You should also backup your configuration files, and any scripts you use to 70 + deploy or administrate Phabricator (like a customized upgrade script). The best 71 + way to do this is to check them into a private repository somewhere and just use 72 + whatever backup process you already have in place for repositories. Just copying 73 + them somewhere will work fine too, of course. 74 + 75 + = Restore: Configuration Files = 76 + 77 + To restore configuration files, just copy them into the right locations. 78 + 79 + = Security = 80 + 81 + MySQL dumps have no builtin encryption and most data in Phabricator is stored in 82 + a raw, accessible form, so giving a user access to backups is a lot like giving 83 + them shell access to the machine Phabricator runs on. In particular, a user who 84 + has the backups can: 85 + 86 + - read data that policies do not permit them to see; 87 + - read email addresses and object secret keys; and 88 + - read other users' session and conduit tokens and impersonate them. 89 + 90 + Some of this information is durable, so disclosure of even a very old backup may 91 + present a risk. If you restrict access to the Phabricator host or database, you 92 + should also restrict access to the backups. 93 + 94 + = Next Steps = 95 + 96 + Continue by: 97 + 98 + - returning to the @{article:Configuration Guide}.