Posted over 2 years ago. Visible to the public.

Capistrano 3 has slightly changed its symlink implementation

In Capistrano 2, directories in shared_children used to be symlinked to the shared directory during the finalize_update task.

Copy
# <capistrano>/lib/capistrano/recipes/deploy.rb _cset :shared_children, %w(public/system log tmp/pids) # ... task :finalize_update, :except => { :no_release => true } do # ... shared_children.map do |d| run "ln -s #{shared_path}/#{d.split('/').last} #{latest_release}/#{d}" # <-- symlinks only the last segment here end # ... end

This would symlink current/public/system to shared/system.

Capistrano 3 (which is almost a complete rewrite of the project) now properly expands paths to symlink. current/public/system is now symlinked to shared/public/system.

Copy
# <your project>/config/deploy.rb set :linked_dirs, %w(log public/system) # <capistrano>/lib/capistrano/tasks/deploy.rake desc 'Symlink linked directories' task :linked_dirs do # ... fetch(:linked_dirs).each do |dir| target = release_path.join(dir) # <-- symlinks the whole path source = shared_path.join(dir) # ... execute :ln, '-s', source, target end end

This may bite you when you were backing up the shared/system directory. After upgrading to Capistrano 3, you will need to back up the shared/public/system directory instead. For our own projects we already do so.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Author of this card:

Avatar
Dominik Schöler
Last edit:
almost 2 years ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandropedia