I'm deploying a Ruby on Rails and NodeJS application using Capistrano. The uploads folder gets removed on every deploy.
This popped up on several places but it doesn't seem to work:
# Keep File Uploads
task :symlink_uploads do
run "ln -nfs #{shared_path}/rails/uploads #{release_path}/rails/public/uploads"
end
after 'deploy:update_code', 'deploy:symlink_uploads'
the repo:
repo:
/node
/rails
Thanks!
Make sure you remove the existing public/uploads folder, passing
-f
toln
doesn't cover removing target directories (or at least hasn't done so portably for me)My symlink directories tasks normally look like
Obviously make sure there is nothing in the checked in version of public/uploads that you need!
I have similar problem with uploaded file with my RoR app. This is my capistrano tasks:
Maybe help you
Edit: I use Carrierwave too.
There is another solution to this problem. You can add your
uploads
dir to Capistrano'sshared_children
and it will do all the magic automatically. You can find more details in this answer: https://stackoverflow.com/a/9710542/835935Did you try
Your
:symlink_uploads
task is not in a namespace, so rather do the above or put it in a namespace