Reputation: 5097
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:
Is there standard way to do this?
Upvotes: 6
Views: 2124
Reputation: 21895
Now we can simply use :linked_files in deploy.rb:
set :linked_files, %w{config/database.yml}
In this case, the file [target_dir]/shared/config/database.yml must exist on the server.
Upvotes: 2
Reputation: 5097
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
Upvotes: 7
Reputation: 28322
You could make files a symlink to another directory on your machine, for examples the /shared directory at the same level as /current and /releases.
Check out capistrano manages the /log and /tmp directories.
Upvotes: 6