Synchronizing your albums with a mirror server
I' am now describe how you can mirror your album on a server.
1.
You have to configure gallery to use a mirror server.
There for run the configuration script and than go to the setup side like this:
"www.your-server.org/gallerypath/setup/"
there on the second setup page you can add the link to your mirror server with the directory, mostly something like "/albums".
Than save the configuration and run the secure.sh script.
2.
Now you can bring your album on the mirror server.
Therefor I suggest to use rsync. You can also use ftp or any other program that copies the files to the mirror server. But rsync is therefor very good, because it only upload the difference of a file or picture to the server.
Now I will show you how you can use rsync for gallery.
Here is a rsync script example (rsync_gallery.sh):
---
#!/bin/bash #rsync script for an gallery mirror server #The gallery directory "/var/www/albums" mirrored with "www.mirror-server.org" #the rsync command with some options
#first RSYNC_oPTION
R_o1="-av -e ssh --exclude-from=exclude_gallery"
#second RSYNC_oPTION
R_o2=""
#RSYNC PATH on the Mirror Server, if not in $PATH ("--rsync-path=/path_to_bin/rsync")
R_PATH=""
#Local Path from gallery, mostly like /var/www/albums
LOCAL_PATH="/var/www/albums"
#username for the mirror server
USER="joe"
#the server that the mirror should be
MIRROR_SERVER="www.mirror-server-url.org"
#Path on the mirror Server
SERVER_PATH="/var/www/"
ALL_OPTIONS="$R_o1 $R_o2 $R_PATH $LOCAL_PATH $USER@$MIRROR_SERVER:$SERVER_PATH" echo "rsync "$ALL_OPTIONS rsync $ALL_OPTIONS
---
What you now have to do, is to copy the script above on your gallery server, sorry, but remove all the leading spaces " " in every line and make the script executable with a command like:
- chmod a+x rsync_gallery.sh
Open your favourite editor like nano, emacs or vi and edit some variables in the script.
These are:
- LOCAL_PATH - for the path of the gallery directory on your local server
- USER - for the username of the user on the remote or mirror server
- MIRROR_SERVER - for the domain of the server
- SERVER_PATH - for the path were the gallery directory should copied into. ( _without_ the name of the gallery directory e.g. "/ablums" in most cases)
Optional you can add or remove some option's in the R_01 and R_02 variable.
If the rsync bin is not in the $PATH, then use the R_PATH
The next file you have to also copy and remove all the leading spaces " " in every line, but it need not to be executable. In this files are the types of files that don't need to be uploaded to the mirror.
And here the exclude_gallery.txt:
---
#excluded files, that didn't need to be uploaded to the mirror - *.bak - *.lock - /.* - .users/
---
After that all, you only have to execute the rsync_gallery.sh. If the rsync_gallery.sh is not in your PATH and you are in the same directory remember the ./
(e.g. PROMT# ./rsync_gallery.sh )
Some information about rsync:
rsync Homepage: http://samba.anu.edu.au/rsync/
rsync man page: http://samba.anu.edu.au/ftp/rsync/rsync.html
---
When using mirrors, make sure that your php.ini is set to allow URLs in fopen: you must have a line like this:
allow_url_fopen = On
Otherwise, Gallery fails to even check the mirrors, and gives no feedback and no errors in the logs. Of late, PHP distribs have shipped with this setting off by default.
