Reputation: 22238
I've an issue at the moment where we are running a CMS within a site (browsercms) that lets the user upload files. However, every time I do a deploy Capistrano runs a hard reset thus nuking any uploaded files.
Does anyone have any suggestions as to how to prevent the hard reset, and just do a pull, or a way of moving the uploaded files elsewhere, without having to change the application code?
Upvotes: 2
Views: 1529
Reputation: 947
This might not be the right approach.
You should include your 'images' folder in your .gitignore and symlink the $current_release/images folder to $shared/images.
This may be done automatically on every deployment if you put in your deploy.rb:
task :link_imgs do
run "ln -s #{shared_path}/photos #{release_path}/photos"
end
after "deploy:update_code", :link_imgs
I've done the same with my CMS and it works like a charm
Upvotes: 2
Reputation: 1805
cap deploy calls deploy:update and deploy:restart
deploy:update makes the versioning, copying stuff
deploy:restart does the true restart, overload it at your convenince, usually in your config/deploy.rb file
namespace :deploy do
desc "Softly restart the server"
task :restart, :roles => :app, :except => { :no_release => true } do
my_own.restart_recipe
end
end
Upvotes: 0
Reputation: 620
This doesn't quite meet your criteria of "without having to change the application code".
However after running into a similar issue I shifted my uploaded image from /public/images
to /public/system/images
the /public/system
directory is not 'versioned' by each capistrano deployment so the images survive.
Could it be the capistrano 'versioning' causing the problem (instead of a git reset)?
Upvotes: 2