Hi,
I’m deploying my web app with Capistrano 2, my users have content
which is stored in the public/images folder and I need this to be
stored outside the app, probably in the shared folder, but where I’m
having trouble is when I deploy the app, 1. I can’t get symlinks to
work from images -> …/…/shared/system/images and I don’t know how to
get Capistrano to recreate this link after each deploy.
here’s what I do with Capistrano 1 (if you already know this and I
didn’t understand your post well enough, just ignore it
desc “After symlinking current version, install database.yml, assets,
and update rights”
task :after_update_code do
We do not have database.yml under SVN as we don’t want anyone
having
access to SVN to be able to access the production database.
Link it from the shared folder.
run “ln -s #{deploy_to}/#{shared_dir}/config/database.yml
#{current_release}/config/database.yml”
The assets folder must be kept between releases
run “rmdir #{current_release}/public/assets” # remove the folder
present for development
run “ln -s #{deploy_to}/#{shared_dir}/assets #{current_release}/
public”
one common mistake when creating symlinks using relative paths for the
target is specifying the relative path relative to the current directory
and not relative to the new symlinks directory.
example:
the following does not work. The created symlink in public/ is pointing
at RAILS_ROOT/shared.
cd RAILS_ROOT
ln -s …/shared/system/images public/
the correct way is:
cd RAILS_ROOT
ln -s …/…/shared/system/images public/
The example recipe that Thibaut Barrère gave you avoids this problem by
using full absolute paths (provided by the deploy_to and current_release
variables).