Re: [Radiant] Re: Multiple Server Deployment for Radiant

2011-06-27 Thread William Ross
On 27 Jun 2011, at 04:56, Shanison wrote:

 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.

That would probably be easier to code: it's just a different paperclip storage 
module. See eg.


http://patshaughnessy.net/2009/4/14/database-storage-for-paperclip-rewritten-to-use-a-single-table

but it doesn't feel like a very appealing solution. You would miss out on a lot 
of server-side optimisation: delivering static files is always the way to go if 
you can.

It should be fairly easy to trigger a script from the asset manager. Again, 
it's not our code but the behaviour of Paperclip that you need to change. Have 
a look at the flush_writes and flush_deletes methods in 
Paperclip::Storage::Filesystem. If I was doing this I think I'd add 
:after_storage and :after deletion callbacks.

best,

will



Re: [Radiant] Re: Multiple Server Deployment for Radiant

2011-06-27 Thread Shanison
Hi WIlliam,

Thanks a lot for the reference. Yes, static file would perform better 
compares to storing large BLOB in db. If i have to use the database method, 
i should think of a way of generating the files out from the db and serves 
as a cache and have to think of invalidating the cache if the files are 
updated.

It is a pity that there were not call back that we can hook up to do some 
file management after uploading or deleting. Have to alias the methods to 
achieve the purpose. 


Regards,
Shanison