Hi William,
Thank you very much for your detailed explanation and suggestion. This
is very helpful. For my case, actually it is for railover, so I think
I have to use rSync or write an extension that money patch the asset
manager, where upon any files uploaded to the server, I can do a
synchronization.
This is a bit trouble though. We have also thought of storing all
assets in the db instead. Synchronization of db is much easier and
efficient. But this means that we have to money patch the asset
manager again to make it store in db instead of file system.
Thanks,
Shanison
On Jun 20, 3:14 am, William Ross w...@spanner.org wrote:
On 19 Jun 2011, at 16:54,Shanisonwrote:
Hi all,
I have one Radiant website but deployed to a few servers, and one of
the server S1 will be used to serve static file content and serve as a
reverse proxy and redirect dynamic page request back to the other
servers S2, S3, S4. So my question is that when admin login to the
admin page, it can be from any of the servers, S2 or S3, S4. If he
uploads files e.g. images to S2, how can the rest of servers serves
the files? If a request comes in to display a page and is served at
S3, that images used in the page won't be displayed as it is not in
the same server.
Is there a way to synchronize it? Thank you.
I've done this different ways in the past and the I think the right one would
depend on your reason for spreading across several servers in the first place:
* If it's for load-sharing, and you can think of one of the servers as the
master, you may find it's enough just to redirect all requests for /admin and
/assets to the master.
* if it's for redundancy and failover, you will need some scripting behind
radiant to move files around. Again, the method depends on your situation:
you can do it with rsync or an active push from the receiving server. It
would be easy to write an extension that triggered the mirroring script upon
image update, but note that you'd have to duplicate all the thumbnail sizes
as well as the original image.
* If it's geographical, or the other two solutions don't appeal, you could
just use a CDN with uplift, or the built-in S3 support we get from paperclip.
I think the most successful strategy I've used was to set up both database
servers (this was a rather paranoid and very busy site) as simple static-file
asset servers, and to direct all requests for static files from those two.
There were some rather basic rsync scripts to mirror uploaded assets. I
figured that if the database went down then the rest didn't really matter
anyway.
If anyone knows a standard (cross-platform) way that we could meet this
requirement from within radiant's asset manager I'd be very happy to write it
in.
For what it's worth, I don't deploy across multiple servers any more, apart
from a separate database host. More recently I've found that one decent
server with a long cache life is more efficient than several with only brief
caches (as they must be, because you're only ever clearing the cache on one
of them).
best,
will