# HG changeset patch # User Julien Jehannet # Date 1269440328 -3600 # Node ID 0ce27e435b3af6fa846ca5f5d3873450030190d8 # Parent 4f6a1295a8d23c2746d52d046ed45425d0a2e4e0 [D] book: update backup procedures in additional tips diff -r 4f6a1295a8d2 -r 0ce27e435b3a doc/book/en/admin/additional-tips.rst --- a/doc/book/en/admin/additional-tips.rst Wed Mar 24 15:42:23 2010 +0100 +++ b/doc/book/en/admin/additional-tips.rst Wed Mar 24 15:18:48 2010 +0100 @@ -9,12 +9,10 @@ Backup, backup, backup `````````````````````` -It is always a good idea to backup. If your system does not do that, -you should set it up. Note that whenever you do an upgrade, -`cubicweb-ctl` offers you to backup your database. - -There are a number of ways for doing backups. Before you go ahead, -make sure the following permissions are correct :: +It is always a good idea to backup. If your system does not do that, you should +set it up. Note that whenever you do an upgrade, `cubicweb-ctl` offers you to +backup your database. There are a number of ways for doing backups. Before you +go ahead, make sure the following permissions are correct :: # chgrp postgres /var/lib/cubicweb/backup @@ -24,31 +22,36 @@ # chmod g+r /etc/cubicweb.d/**/sources -**Classic way** +**Classic way on PostgreSQL server** -Simply use the pg_dump in a cron :: +Simply use the pg_dump in a cron installed for `postgres` user on the database server:: - su -c "pg_dump -Fc --username=cubicweb --no-owner" postgres > -$(date '+%Y-%m-%d_%H:%M:%S').dump + # m h dom mon dow command + 0 2 * * * pg_dump -Fc --username=cubicweb --no-owner > /var/backups/-$(date '+%Y-%m-%d_%H:%M:%S').dump **CubicWeb way** -The CubicWeb way is to use the `db-dump` command. For that, you have to put your passwords in a user-only-readable file at the -root of the postgres user. The file is `.pgpass` (`chmod 0600`), in this case for a socket run connection to postgres :: +The CubicWeb way is to use the `db-dump` command. For that, you have to put +your passwords in a user-only-readable file at the home directory of root user. +The file is `.pgpass` (`chmod 0600`), in this case for a socket run connection +to PostgreSQL :: - /var/run/postgresql:5432::cubicweb: + /var/run/postgresql:5432::: The postgres documentation for the `.pgpass` format can be found `here`_ -Then add the following command to the crontab of the postgres user (`su posgres 'crontab -e'`):: +Then add the following command to the crontab of the user (`crontab -e`):: # m h dom mon dow command 0 2 * * * cubicweb-ctl db-dump **The automated sysadmin way** -You can use a combination `backup-ninja`_ (which has a postgres script in the example directory), `backuppc`)_ (for versionning). +You can use a combination `backup-ninja`_ (which has a postgres script in the +example directory), `backuppc`)_ (for versionning). -Please note that in the *CubicWeb way* it adds a second location for your password which is error-prone. +Please note that in the *CubicWeb way* it adds a second location for your +password which is error-prone. .. _`here` : http://www.postgresql.org/docs/current/static/libpq-pgpass.html .. _`backup-ninja` : https://labs.riseup.net/code/projects/show/backupninja/