For database backup with standard cPanel hosting two types of backup should be taken. First, standard Postgres backup should be taken, it’s not a good idea to rely on your web host entirely for backup. Second, a Brimbox download backup is also a good idea.
To do a binary backup run this from your linux shell:
pg_dump -Fc -b db_name > backup_file
Once you have created a database, restore using this:
pg_restore -d db_name backup_file
One of the problems that may be encountered when moving the database from one environment to another using backup is the permissions may require some manipulation to get things going. A standard Brimbox install grants object, data, and large object ownership to the connection string user. In turn, for objects and data, these permissions are then granted to the database owner, or the database creator, on install. Large objects, which Brimbox uses for file storage, are likewise owned by the connection string user, however to delegate or grant permissions on a large object a superuser permission is required. These permissions must be in order if not restoring a Postgres database to the same environment.
Brimbox backups allow a second type of backup to be taken locally and should be downloaded from the web regularly. The advantages of a Brimbox backup are easy portability when moving hosts and an administrator can easily download and save the file locally. When restoring, all the permissions will be set to the connection string user and granted to the database owner just like on install. The disadvantages are like all password encrypted files, the file is not absolutely secure if compromised, and PHP upload and post maximum settings must large enough to upload the file through the web server when restoring (very important). If you do not have control over these values you may be unable to restore a Brimbox type database backup.
There are two backup file types,
.bblo, one for the standard data and one for the large objects. They can be downloaded using the “Backup and Restore” module with an administrator password. The
.bblo file stores all large objects, and the
.bbdb file backs up these tables.
Note: Brimbox backup does not backup the
docs_table, these documentation and extraneous files should be backed up elsewhere.
These values that are usually set in
php.ini must be set to values larger than the backup file size. These are examples for a 1/2 Gig backup file.
post_max_size = 500Mb
upload_max_filesize = 500Mb