# HG changeset patch # User Sylvain Thénault # Date 1265141641 -3600 # Node ID 0cd207567f37ee7947a0a913cf43da53da1e17e4 # Parent 03614b377ecded1463d9c5a43445dc5ff23b2fc8 le patch admin_tips_for_backup a été importé diff -r 03614b377ecd -r 0cd207567f37 doc/book/en/admin/additional-tips.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/book/en/admin/additional-tips.rst Tue Feb 02 21:14:01 2010 +0100 @@ -0,0 +1,55 @@ + +.. _Additional Tips: + +Additional Tips +--------------- + +Here are some additional tips as far as administration of a CubicWeb is concerned. + +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 :: + + # chgrp postgres /var/lib/cubicweb/backup + + # chmod g+ws /var/lib/cubicweb/backup + + # chgrp postgres /etc/cubicweb.d/**/sources + + # chmod g+r /etc/cubicweb.d/**/sources + +**Classic way** + +Simply use the pg_dump in a cron :: + + pg_dump -Fc --username=cubicweb --no-owner --file=/var/lib/cubicweb/backup/-$(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 :: + + /var/run/postgresql:5432::cubicweb: + +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'`):: + + # 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). + +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/ +.. _`backuppc` : http://backuppc.sourceforge.net/ diff -r 03614b377ecd -r 0cd207567f37 doc/book/en/admin/index.rst --- a/doc/book/en/admin/index.rst Tue Feb 02 18:22:25 2010 +0100 +++ b/doc/book/en/admin/index.rst Tue Feb 02 21:14:01 2010 +0100 @@ -20,6 +20,7 @@ multisources ldap gae + addition-tips RQL logs --------