Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I deploy but not symlink/restart using Capistrano 3?

Capistrano v2 had two helpful tasks: cap deploy:update_code would do a full deployment to a new releases/ directory, but not change the current symlink or start/restart the server (so the server keeps running the current version without interruption). And cap deploy:update did the same thing plus changing the current symlink, but didn't start/restart the server. These were useful to shake out issues e.g. with asset compilation, before doing a real deploy.

Those two "update" tasks are gone in Capistrano v3. Is there an equivalent way to do a full deploy without changing the current symlink or restarting the server?

like image 520
bjnord Avatar asked Nov 02 '25 01:11

bjnord


1 Answers

A custom task list this should do it:

task :deploy_without_symlink do
  set(:deploying, true)
  %w{ starting started
      updating updated }.each do |task|
    invoke "deploy:#{task}"
  end
end

You can look at the code here: https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/framework.rake#L58 to see what deploy triggers. And the Publishing task per https://github.com/capistrano/capistrano/blob/master/lib/capistrano/tasks/deploy.rake#L38 is what changes the symlinks. So by omitting everything afterwards, you get what you are looking for.

like image 53
will_in_wi Avatar answered Nov 03 '25 16:11

will_in_wi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!