Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keeping static files in server when deploying with Capistrano

I'm uploading files to my public/files folder of a Rails application on a constant basis through a web interface.

I don't want to keep these in source control since they go for almost 2 GBs, so every time I do a cap deploy it will save those files away in releases/ and replace the directory with the pristine copy stored in the repository.

I'm wondering what's the best way to keep those files in the server, in the current directory. Some of my ideas are:

  • Remove the directory from source control and replace it with a link to an external directory that's not managed by Capistrano.
  • Create a Capistrano task to copy the directory to /tmp before deploying and then copying it back to /public after it's done deploying.

Is there standard way to do this?

like image 318
Federico Builes Avatar asked Nov 04 '08 19:11

Federico Builes


1 Answers

For the future record, this is the task I used to do it with a shared directory:

task :link_shared_directories do     
  run "ln -s #{shared_path}/files #{release_path}/public/files"   
end    

after "deploy:update_code", :link_shared_directories   
like image 125
Federico Builes Avatar answered Sep 30 '22 19:09

Federico Builes