Topic: Images and using capistrano database of fs?

Hello all,
I have an issue, I use capistrano to deploy my rails app. I now want to add in personal avatar's to my forum. I am using a hacked up version of Beast and I can't stand "Gravatar.com". So here is my issue. I am not sure if storing all those images in the db is going to be a problem down the road as now it is just an avatar but later or even sooner it will be pictures within the posts and other uploaded pictures. I can't see using the file system because every new capistrano deployment creates an entirely new tree for the app and all my images would be stored in the previous version so I don't see that working. Has anyone else delt with this successfully?

Also, I see how I can use the send_data method to view the image that is in my database on the page but that overwrites the entire page so how do you view a n image in a page that is from the db?


Brian

Re: Images and using capistrano database of fs?

zooxmusic wrote:

I can't see using the file system because every new capistrano deployment creates an entirely new tree for the app and all my images would be stored in the previous version so I don't see that working.

Capistrano allows you to share files with the various versions. I dont' remember exactly how it's done but I can look it up if you need me to.

Railscasts - Free Ruby on Rails Screencasts

Re: Images and using capistrano database of fs?

Oh thanks Ryan, I should have figured that they thought of that. That is very nice of you but I don't need you to do what I can do as you are not my secretary. But that is very nice.

Brian

Re: Images and using capistrano database of fs?

With Capistrano you can definitely store files persistently between deployments, that's how local configuration files, Ferret indexes, and log files are kept around from one deployment to the next.

Basically, with Capistrano you have a deployment root, let's call it:

/var/www/myrailsapp

In it, you'll have:

/var/www/myrailsapp/current (symlink to the live release)
/var/www/myrailsapp/TIMESTAMP (several of these, one for each release)
/var/www/myrailsapp/shared (stuff that's shared among all releases)

The :update_code task takes care of linking the stuff in shared back into current.

Re: Images and using capistrano database of fs?

thanks rafeco, thats just about a "duh" on my behalf. Of course that is what "shared" is for

Sorry
Brian