Album Directories

bal

Joined: 2002-08-17
Posts: 3
Posted: Sat, 2002-08-17 20:41

I have already installed and configured Gallery and all went ok. The main problem I have is that my webspace and php are on 2 different servers and the php server only has 50mb limit.

Is there a way of pointing the uploading the pictures to albums that are on other servers.?

I have already tried setting the path to ftp://user:pass@ftp.site.com/album but the gallery config can't find it.

Help!!

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2002-08-19 08:11

Gallery doesn't have that functionality right now. It's something that we may attempt to do in the future, though.

 
bal

Joined: 2002-08-17
Posts: 3
Posted: Mon, 2002-08-19 16:43

ok, I look forward to that :smile:

In the meantime, I've tried to find some documentation regarding Mirroring the albums. I presume, to get round my current problem I could upload pictures to the current directory then move the album to another server and delete the album on the original server ??

What I don't want to do is run out of webspace... will be a pain in the arse :smile:

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2002-08-19 16:47

Here's a blurb on mirroring that I wrote a long time ago:

The mirroring code is for the case where you have your Gallery on
a slow server (like, on a DSL line) but you have storage on a fast
server somewhere out on the net. You must manually copy your albums
directory out to the fast server and keep it up to date, then you
can tell Gallery the URL of the mirrored albums directory and it
will draw images from there if possible. You must keep
a copy of the original files on your server with Gallery. You
can't use mirroring to free up space on your webserver.

To illustrate, I've got my Gallery running on my box at home behind
my DSL line. A very kind Gallery user has given me a lot of disk
space on a very fast box where I keep a mirror copy of my albums
directory. I use rsync to keep the remote site up to date.

The mirror site can be a mirror of any or all albums. Each album
must be complete, but you don't have to mirror all of them. You
can just selectively mirror the ones that you use the most (but
it's up to you to write a script to manage that).

You *only* need to update your mirror when your serial.#.dat file
changes. The serial file is there to track when a change actually
affects the mirror. Typically, this is only a change that affects
an image (anything that changes a source, sized or thumbnail image,
deleting or adding new images).

Text changes should not cause you to have to re-sync, but experiment
and watch the serial.#.dat file to see for yourself.

 
shazam
shazam's picture

Joined: 2002-08-25
Posts: 2
Posted: Mon, 2002-08-26 04:03

How do you deal with Comments being added on the remote server being overwritten when you make a caption/description/album modification locally and then rsync your files?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2002-08-27 05:17

Ah, it sounds like you are setting up two Galleries. That won't work.

The remote server doesn't have a gallery. It only has your albums. The Gallery (on your local server) will properly create URLs to draw images from the remote server. The remote server is simply a mirror of your images.

 
bpd@darb.net

Joined: 2002-08-20
Posts: 101
Posted: Mon, 2002-11-11 13:47

ive setup mirroring between two galleries ... however , one overwrites the other, so comments and hit counters are overwrritten (im sure that could be over-ridden too, but havent looked into it).

there are several "site specific" things that need not be mirrored, so in some dodgy scripting ive done the following. ;

on gallery.darb.net (the master, hosted here in perth), I run a script that does the following ;

#!/bin/sh
echo "Beginning mirror process"
echo "Moving temporary gallery directory into place"
mv /storage/gallery /storage/gallery.hold
mv /storage/gallery.closed /storage/gallery
echo "Moving location specific files and logs out of gallery"
mv /storage/gallery.hold/.users /storage/
mv /storage/gallery.hold/originals /storage/
mv /storage/gallery.hold/access_log /storage/
mv /storage/gallery.hold/html_wrap /storage/
mv /storage/gallery.hold/albums.php /storage/
mv /storage/gallery.hold/config.php /storage/
cd /storage
echo "Now creating the tarball in /home/httpd/html/mirror/gallery-mirror.tar"
tar -zcf /home/httpd/html/mirror/gallery-mirror.tar.gz gallery.hold/
echo "Now moving location specific files and logs back into the Gallery"
mv /storage/access_log /storage/gallery.hold/
mv /storage/originals /storage/gallery.hold/
mv /storage/albums.php /storage/gallery.hold/
mv /storage/html_wrap /storage/gallery.hold/
mv /storage/.users /storage/gallery.hold/
mv /storage/config.php /storage/gallery.hold/
echo "Reinstating the Gallery to the Live Gallery directory."
mv /storage/gallery /storage/gallery.closed
mv /storage/gallery.hold /storage/gallery
echo "Restarting Apache to re-initialise logs"
/etc/rc.d/init.d/httpd restart
echo "Done"

that pretty much moves all site specific stuff out, then tarballs the gallery (my html_wrap and a few other hacks that are site spefic, as youll see on the site).

On the other site, http://usa.darb.net/ i run the other dodgy script that does this ...

#!/bin/sh
cd /home/bpd/website/
echo "Getting updated Tarball from http://www.darb.net/mirror/gallery-mirror.tar.gz"
wget -NS http://www.darb.net/mirror/gallery-mirror.tar.gz
echo "Extracting Tarball to gallery.hold"
tar -zxf gallery-mirror.tar.gz
echo "Moving current gallery to gallery.old"
mv /home/bpd/website/gallery /home/bpd/website/gallery.old
echo "moving Gallery.hold new mirror to gallery.new"
mv /home/bpd/website/gallery.hold /home/bpd/website/gallery.new
echo "Migrating location specific files back to the new gallery.new"
mv /home/bpd/website/gallery.old/.users /home/bpd/website/gallery.new
mv /home/bpd/website/gallery.old/html_wrap /home/bpd/website/gallery.new
mv /home/bpd/website/gallery.old/albums.php /home/bpd/website/gallery.new
mv /home/bpd/website/gallery.old/config.php /home/bpd/website/gallery.new
echo "moving the freshly mirrored Gallery to the live directory"
mv /home/bpd/website/gallery.new /home/bpd/website/gallery
echo "Giving ownership of live directory to nobody.bpd"
chown -R nobody.bpd gallery/
echo "restarting apache to re-init logs"
/usr/local/orsmapache/bin/apachectl restart
echo "deleting Old Gallery Directory"
rm -rf gallery.old
echo "done"

that pretty much does the same thing ... moves site specific stuff out, grabs a copy from the tarball in perth (usa.darb.net is hosted in idaho) ...extracts it, then moves the site specific stuff back, restarts apache and voila ... the wget -NS command checks for a newer version of the tarball/gizball and wont grab it unless its newer (saves the 600mb of pics if no update needed). You could easily automate it using cron or some scheduler, but i leave mine manual and update when i feel.

hope that helps some.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2002-11-12 01:58

Holy chamunga. That's complicated! The only thing you need to mirror is the albums
directory. I have a cron job on my master server that syncs the albums to my mirror server
and it looks like this:

/usr/local/bin/rsync --times --recursive --delete --stats --update --compress --checksum --bwlimit=2 --verbose --exclude .users/ /path/to/master/albums

:/path/to/albums

That does a 2kbyte/second synchronization of the files from my master to mirror server.
I limit the bandwidth so that it trickles the data out in the background (in case I'm using the server for other purposes), and it doesn't sync the .users directory for security reasons.

Rsync is an awesome tool. Try it out.

 
bpd@darb.net

Joined: 2002-08-20
Posts: 101
Posted: Sun, 2002-12-01 08:11

bharat : can i also exclude the likes of html_wrap, access_log, etc ... does the rysync have to run on both boxes as a service of some sort?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2002-12-01 19:42
Quote:
can i also exclude the likes of html_wrap, access_log, etc

Yes. You only need the albums directory.

Quote:
does the rysync have to run on both boxes as a service of some sort?

Nope. You just need to have it installed on both boxes and be able to SSH between the two of them.

 
xinca
xinca's picture

Joined: 2002-09-28
Posts: 86
Posted: Thu, 2002-12-12 03:49
Quote:
/usr/local/bin/rsync --times --recursive --delete --stats --update --compress --checksum --bwlimit=2 --verbose --exclude .users/ /path/to/master/albums

:/path/to/albums

Bharat,

Any chance you can teach us how to install your rsync script as a daily cronjob?

Moreover I am actually running three galleries on the same server (to serve different member groups). So there are three independent albums. Do I run the cronjob three times (with respective path modifications), or there is a way to consolidate all action in one shot?

Thanks,

Chow

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2002-12-12 07:32
Quote:
>>/usr/local/bin/rsync --times --recursive --delete --stats --update --compress --checksum --bwlimit=2 --verbose --exclude .users/ /path/to/master/albums

:/path/to/albums <<

Bharat,

Any chance you can teach us how to install your rsync script as a daily cronjob?

Moreover I am actually running three galleries on the same server (to serve different member groups). So there are three independent albums. Do I run the cronjob three times (with respective path modifications), or there is a way to consolidate all action in one shot?

You can create one script that runs 3 consecutive rsync jobs, each which syncs a different local albums directory to a remote one. ie,

foo.sh contains:

#!/bin/sh
rsync ... /albums1 remote:/albums1
rsync ... /albums2 remote:/albums2
rsync ... /albums3 remote:/albums3

As for creating a cron job, that varies from system to system. Your best bet is to ask your local system administrator about the local policies and methodology. On my machines, I can run "cron -e" to edit my personal crontab job listing and then add jobs (run "man crontab" for help on how to use the crontab command).

 
xinca
xinca's picture

Joined: 2002-09-28
Posts: 86
Posted: Thu, 2002-12-12 08:23

Need one more trick. The remote site will ask for my username and password. How do I include them on my rsyncalbums.sh :roll:

I have only one remote site :smile:

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2002-12-14 01:52

I use ssh as the transport medium for rsync. Ssh allows you to create a private key/public key combo pair to allow you to log in directly to the remote box without entering a password. There are a ton of walkthroughs for this on the web -- the almighty Google will tell all!