New Message: Re: How do you have your manila server configured?

webmaster at userland.com webmaster at userland.com
Sun Jan 20 17:20:53 CST 2008


A new message was posted:

Address: http://manila.userland.com/discuss/msgReader$3038

By: Scott Girard (sgirard at bigsea.com)

Steve-- you could probably automate your process-- there are several ways. Here is how I did it:

My setup (seems to work fine so far):

Manila Static Pictures Settings:
Folder for static pictures: Macintosh:Library:WebServer:Documents:static:
Url for static pictures: http://remoteWebServer.com/

On My Mac:
Apache is configured to listen on port 8888. But that's not where I serve the static pictures from. (I don't have connection with enough bandwidth to support a lot of traffic-- I don't even have that port open to the public Internet).

I set up a folder action that uses an rsync shell script to watch my static pictures folders and sync those folders with a remote web server.

Here's what the Applescript looks like:

on adding folder items to this_folder after receiving these_items
do shell script ("rsync -rtlvz /Library/WebServer/Documents/static/ remoteServerUserName at remoteWebServer.com:/usr/home/remoteServerUserName/www/htdocs/")
end adding folder items to

Compile the Applescript and place it it your Frontier server's user/Library/Scripts/Folder Action Scripts folder.
Go to the images folder for each site on your server and attach the script to the folder (control-click on the folder and select "Attach a folder action..."). [more info] [1]

You must attach the folder action to each site's images folder because the folder action is not recursive-- it only looks at the folder it is attached to, and not sub-folders within that folder. So, inside of my folder named "static" Frontier has created a separate images folder for each site. On each of those image folders, I attach the folder action script. This also means that as I add new Manila sites, I will have to manually attach the folder action to each new site's static picture folder. At least the script is not site specific-- the same folder action will work for every Manila site.

I had to configure my remote server to accept passwordless rsync. [more info] [2]. Be sure not to enter password when you generate your ssh key.

I had to add modify two scripts in Manila (this is usually not a good idea because Userland could overwrite my changes with an update, but if that happens, it won't break anything):

Jump to: manilaSuite.pictures.postEditedPicture:

down near the bottom of the script look for
bundle //04/05/20, 12:37:12 by DAB: check in the object
= add this line next: thread.sleepfor(6) //yeild for a bit
return ("")

Original manilaSuite.pictures.postPicture:

down near the bottom of the script look for
if defined (pta^.postArgs.redirect) {
 mainResponder.redirect (pta^.postArgs.redirect + msgNum)};
= add this line next: thread.sleepfor(6); //yield for a bit
return ("")

The reason I had to change those scripts is that when I would create a new picture, Manila would return to the picture page before the rsync script had a chance to finish. This would cause the picture page to display a broken image. Slowing down those two scripts gives the rsync time to complete before the picture page is returned.

This solution creates image urls like this:

The pictures are served by Apache on the remote server. Each site has a separate pictures folder and I have a backup of all the pictures on the local Frontier server in the folder named "static".

It would be nice if Userland had written the static pictures feature so that it worked the same as the static rendering feature. That way, images could be ftp'd directly to the correct static-rendering location for each Manila site.

Scott Girard

[1] http://www.informit.com/articles/article.aspx?p=98128&seqNum=9
[2] http://www.cactusdata.co.uk/~bkeitch/howto/backup.html

This is a Manila site... http://manila.userland.com/.




More information about the Manila-Users mailing list