Is there a php file that I can 'hit' using a cron job that will perform complete back-ups of the config, sql, media etc (ie on a regular basis without me having to think about it!) ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To make it a short answer - no, as PGV does not have all the information in one format/location. It uses mixed elements of text support files and database support as well as folders, remote and local, for media.
Hopefully, you are making routine backups of ALL your data onto remote HD's or tape or DVD. This would include all your files, media and your DBs.
Stephen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are absolutely on track with finding a way to do automated backups. We are not on this earth to do what a computer can do more reliably. Below is one way to accomplish this that I've implemented.
I've recently started using rsnapshot (http://rsnapshot.org/) and cron, with a custom mysql dump script. This meets my requirements: several snapshots from different periods in the past, minimal disk space, remote operation and backup storage (runs from the backup server), encrypted communication while transferring the backup. If you also require encrypted backup you might look into Duplicity, which I also use.
To help out those interested in running their own secure backups there are three files listed out below: rsnapshot.conf which configures rsnapshot; crontab which run rsnapshot at scheduled intervals; and antreedbbackup.sh which which remotely dumps the PGV database so that it can be backed up. (you can remove the database dumps after rsnapshot runs for security - this is not shown in the simplified file). With the crontab this runs 4 times daily.
These files have been simplified and scrubbed of identifying info to protect the innocent. They are run from Ubuntu Linux and the PGV webserver runs MySQL and Debian Linux. Also required is passwordless ssl (see http://www.cyberciti.biz/faq/linux-rsnapshot-backup-howto/)
For this to be secure your backup server must be secure. Perhaps it's obvious, but I feel the need to preach that any computer logged into a PGV site must be secure or the PGV site is rendered insecure. Here are some suggestions:
rsnapshot.conf:
##################################################rsnapshot.conf-rsnapshotconfigurationfile#####################################################PLEASEBEAWAREOFTHEFOLLOWINGRULES:####Thisfilerequirestabsbetweenelements####Directoriesrequireatrailingslash:##right:/home/##wrong:/home############################################################################CONFIGFILEVERSION########################config_version1.2############################SNAPSHOTROOTDIRECTORY#############################Allsnapshotswillbestoredunderthisrootdirectory.#snapshot_root/.snapshots/#Ifno_create_rootisenabled,rsnapshotwillnotautomaticallycreatethe#snapshot_rootdirectory.Thisisparticularlyusefulifyouarebacking#uptoremovablemedia,suchasaFireWireorUSBdrive.##no_create_root1##################################EXTERNALPROGRAMDEPENDENCIES###################################LINUXUSERS:Besuretouncomment"cmd_cp".Thisgivesyouextrafeatures.#EVERYONEELSE:Leave"cmd_cp"commentedoutforcompatibility.##SeetheREADMEfileorthemanpageformoredetails.#cmd_cp/bin/cp#uncommentthistousethermprograminsteadofthebuilt-inperlroutine.##cmd_rm/bin/rm#rsyncmustbeenabledforanythingtowork.Thisistheonlycommandthat#mustbeenabled.#cmd_rsync/usr/bin/rsync#Uncommentthistoenableremotesshbackupsoverrsync.#cmd_ssh/usr/bin/ssh#Commentthisouttodisablesyslogsupport.#cmd_logger/usr/bin/logger#Uncommentthistospecifythepathto"du"fordiskusagechecks.#Ifyouhaveanolderversionof"du",youmayalsowanttocheckthe#"du_args"parameterbelow.##cmd_du/usr/bin/du#Uncommentthistospecifythepathtorsnapshot-diff.##cmd_rsnapshot_diff/usr/local/bin/rsnapshot-diff#Specifythepathtoascript(andanyoptionalarguments)torunright#beforersnapshotsyncsfiles##cmd_preexec/path/to/preexec/script#Specifythepathtoascript(andanyoptionalarguments)torunright#afterrsnapshotsyncsfiles##cmd_postexec/path/to/postexec/script##########################################BACKUPINTERVALS##Mustbeuniqueandinascendingorder##i.e.hourly,daily,weekly,etc.##########################################intervalhourly4intervaldaily6intervalweekly3intervalmonthly12#############################################GLOBALOPTIONS##Allareoptional,withsensibledefaults##############################################Verboselevel,1through5.#1QuietPrintfatalerrorsonly#2DefaultPrinterrorsandwarningsonly#3VerboseShowequivalentshellcommandsbeingexecuted#4ExtraVerboseShowextraverboseinformation#5DebugmodeEverything#verbose2#Sameas"verbose"above,butcontrolstheamountofdatasenttothe#logfile,ifoneisbeingused.Thedefaultis3.#loglevel2#Ifyouenablethis,datawillbewrittentothefileyouspecify.The#amountofdatawritteniscontrolledbythe"loglevel"parameter.#logfile/var/log/rsnapshot#Ifenabled,rsnapshotwillwritealockfiletopreventtwoinstances#fromrunningsimultaneously(andmessingupthesnapshot_root).#Ifyouenablethis,makesurethelockfiledirectoryisnotworld#writable.Otherwiseanyonecanpreventtheprogramfromrunning.#lockfile/var/run/rsnapshot.pid#Defaultrsyncargs.Allrsynccommandshaveatleasttheseoptionsset.##rsync_short_args-a#rsync_long_args--delete --numeric-ids --relative --delete-excluded#sshhasnoargspassedbydefault,butyoucanspecifysomehere.##ssh_args-p22#Defaultargumentsforthe"du"program(fordiskspacereporting).#TheGNUversionof"du"ispreferred.Seethemanpageformoredetails.#Ifyourversionof"du"doesn't support the -h flag, try -k flag instead.##du_args -csh# If this is enabled, rsync won'tspanfilesystempartitionswithina#backuppoint.Thisessentiallypassesthe-xoptiontorsync.#Thedefaultis0(off).##one_fs0#Theincludeandexcludeparameters,ifenabled,simplygetpasseddirectly#torsync.Ifyouhavemultipleinclude/excludepatterns,puteachoneona#separateline.Pleaselookupthe--include and --exclude options in the#rsyncmanpageformoredetailsonhowtospecifyfilenamepatterns.##include???#include???#exclude???#exclude???#Theinclude_fileandexclude_fileparameters,ifenabled,simplyget#passeddirectlytorsync.Pleaselookupthe--include-from and#--exclude-from options in the rsync man page for more details.##include_file/path/to/include/file#exclude_file/path/to/exclude/file#Ifyourversionofrsyncsupports--link-dest, consider enable this.#Thisisthebestwaytosupportspecialfiles(FIFOs,etc)cross-platform.#Thedefaultis0(off).##link_dest0#Whensync_firstisenabled,itchangesthedefaultbehaviourofrsnapshot.#Normally,whenrsnapshotiscalledwithitslowestinterval#(i.e.:"rsnapshot hourly"),itwillsyncfilesANDrotatethelowest#intervals.Withsync_firstenabled,"rsnapshot sync"handlesthefilesync,#andallintervalcallssimplyrotatefiles.Seethemanpageformore#details.Thedefaultis0(off).##sync_first0#Ifenabled,rsnapshotwillmovetheoldestdirectoryforeachinterval#to[interval_name].delete,thenitwillremovethelockfileanddelete#thatdirectoryjustbeforeitexits.Thedefaultis0(off).##use_lazy_deletes0##################################BACKUPPOINTS/SCRIPTS###################################LOCALHOST#backup/etc/localhost/#backup/usr/local/localhost/#backup/var/log/rsnapshotlocalhost/#backup/etc/passwdlocalhost/#backup/home/foo/MyDocuments/localhost/#backup/foo/bar/localhost/one_fs=1,rsync_short_args=-urltvpog#backup_script/usr/local/bin/backup_pgsql.shlocalhost/postgres/#EXAMPLE.COMbackup_script/home/username/ancestortree/antreedbbackup.shmysql/backupusername@ancestortree.net:/home/username/pgv423/colbert.ancestortree.net/index/ancestortree/backupusername@ancestortree.net:/home/username/pgv423/colbert.ancestortree.net/media/ancestortree/backupusername@ancestortree.net:/home/username/pgv423/colbert.ancestortree.net/config.phpancestortree/#backuproot@example.com:/home/example.com/+rsync_long_args=--bwlimit=16,exclude=core#backuproot@example.com:/etc/example.com/exclude=mtab,exclude=core#backup_scriptsshroot@example.com"mysqldump -A > /var/db/dump/mysql.sql"#backuproot@example.com:/var/db/dump/example.com/#backup_script/bin/date"+ backup of example.com ended at %c"unused2#CVS.SOURCEFORGE.NET#backup_script/usr/local/bin/backup_rsnapshot_cvsroot.shrsnapshot.cvs.sourceforge.net/#RSYNC.SAMBA.ORG#backuprsync://rsync.samba.org/rsyncftp/rsync.samba.org/rsyncftp/
crontab (note that for Ubuntu (only?) this is the sudo crontab - but strangely root crontab format is different):
Is there a php file that I can 'hit' using a cron job that will perform complete back-ups of the config, sql, media etc (ie on a regular basis without me having to think about it!) ?
To make it a short answer - no, as PGV does not have all the information in one format/location. It uses mixed elements of text support files and database support as well as folders, remote and local, for media.
Hopefully, you are making routine backups of ALL your data onto remote HD's or tape or DVD. This would include all your files, media and your DBs.
Stephen
Howdy Pilgrim (couldn't resist),
You are absolutely on track with finding a way to do automated backups. We are not on this earth to do what a computer can do more reliably. Below is one way to accomplish this that I've implemented.
I've recently started using rsnapshot (http://rsnapshot.org/) and cron, with a custom mysql dump script. This meets my requirements: several snapshots from different periods in the past, minimal disk space, remote operation and backup storage (runs from the backup server), encrypted communication while transferring the backup. If you also require encrypted backup you might look into Duplicity, which I also use.
To help out those interested in running their own secure backups there are three files listed out below: rsnapshot.conf which configures rsnapshot; crontab which run rsnapshot at scheduled intervals; and antreedbbackup.sh which which remotely dumps the PGV database so that it can be backed up. (you can remove the database dumps after rsnapshot runs for security - this is not shown in the simplified file). With the crontab this runs 4 times daily.
These files have been simplified and scrubbed of identifying info to protect the innocent. They are run from Ubuntu Linux and the PGV webserver runs MySQL and Debian Linux. Also required is passwordless ssl (see http://www.cyberciti.biz/faq/linux-rsnapshot-backup-howto/)
For this to be secure your backup server must be secure. Perhaps it's obvious, but I feel the need to preach that any computer logged into a PGV site must be secure or the PGV site is rendered insecure. Here are some suggestions:
rsnapshot.conf:
crontab (note that for Ubuntu (only?) this is the sudo crontab - but strangely root crontab format is different):
antreedbbackup.sh:
ssh username@ancestortree.net "mysqldump -opt -user=username -password=********** -host=myhostat.ancestortree.net colbert_pgv | gzip -9 > backup/colbert_pgv.sql.gz"
Watch out for long lines that have been broken.
George
Thanks George :)
It will take me a while to process all that, but I appreciate having something positive to focus on.
As an interim measure, this weekend, I implemented mysqldumper to take a weekly off-site backup of the db (there is a daily server-side backup too).