views:

37

answers:

1

I'm using Capistrano and git to deploy a RoR app. I have a folder under which each user has their own folder. When a user uploads or saves a file, it is saved in their own folder.

When I deploy new versions of the code to the server, the user files and folders are overwritten with what's on my dev machine.

Is there a way to ignore some folders in capistrano, like we do in git? This post - http://www.ruby-forum.com/topic/97539 - suggests using symlinks and storing the user files in a shared folder. But it's an old post, so I'm wondering if there is a better way to do it now.

Also, does anyone know of any good screencasts/tutorials to recommend for using RoR+git+capistrano?

Thanks.

+2  A: 

You should move the user's folders outside of Capistrano's releases directory. The usual approach is to have Capistrano create symbolic links to the directories that should be preserved across deployments.

Here's an example from my Rails blog application's config/deploy.rb whereby files for download within blog posts and images used within posts are stored in a shared directory:

after :deploy, 'deploy:link_dependencies'

namespace :deploy do
  desc <<-DESC
    Creates symbolic links to configuration files and other dependencies
    after deployment.
  DESC
  task :link_dependencies, :roles => :app do
    run "ln -nfs #{shared_path}/public/files #{release_path}/public/files"
    run "ln -nfs #{shared_path}/public/images/posts #{release_path}/public/images/posts"
  end
end
John Topley
Thanks John, symbolic links it is then.
Hrishi Mittal