Topic: Attachment_fu uploading to a different server

Hello, I've searched the forums for something similar, but I couldn't find any.

My problem is: I'm using attachment_fu in our system to upload files. Currently, the storage is set to file system. Is it possible to set it to a different CPU?

Example: I have 2 CPUs. CPU A is running my mongrels and CPU B is running nginx and this is where my storage will be for images.
Since my mongrels are in CPU A, how can I set attachment_fu to store to and retrieve from CPU B?

Can someone point me in the right direction smile

Thanks!

____

Update: AWS is not an option ... for now

Last edited by pash26 (2009-09-02 02:12:58)

Re: Attachment_fu uploading to a different server

Now when you say 2 CPU's, are you talking about 2 systems or servers?

Assuming so, the best way is to mount the file system of the other server. With Linux, this is relatively easy.

Using sshfs, mount the sshfs file system in /etc/fstab to a directory on that server.

So to make sense of it, let's say we have 2 linux web servers, with the hostnames, weba and webb, and weba is where your rails app is, and webb is where your files are going to be stored.

Now the directory we are going to mount in weba is /home/user/websites/files.
The directory on webb that we are going to mount over ssh is /var/www/html/paperclip

So on weba, let's add this line to our /etc/fstab

# sudo vi /etc/fstab
I [Insert Mode]
sshfs#user@webb:/var/www/html/paperclip /home/user/websites/files fuse user,noauto 0 0
:w [write to the file]
:q [quit]

Now there's a bit more to it than that, but overall, thats the gist of it. Attachment_fu as far as it's concerned is still saving to a local directory, but sshfs is doing it all for you.

For specifics, go to either, http://www.debuntu.org/2006/04/27/39-mo … -etcfstab, or I also recorded a video and thrown it up on Youtube on my channel as well: http://www.youtube.com/watch?v=K7OCC-laRpc.

Hope this helps. smile

Re: Attachment_fu uploading to a different server

This is kinda an old topic but I'm pretty interested in knowing how this works.

Right now my site is a single server just saving content to the local filesystem, but I was wondering as my site grows and I need to put my apps on different servers where do I save my images.

Anyone have experience with sshfs, does it take alot of bandwidth doing the transfer?  Is it going to be single threaded? What other options are there?