1
votes

I want to restart thin web servers after deploy. To do this I have the following code in config/deploy.rb:

namespace :deploy do
desc 'Restart application...'
  task :restart do
    on roles(:app) do
      within "#{current_path}" do
        execute "bundle exec thin -C /etc/thin/app.yml restart"
      end
    end
  end
(...)

So I want to execute the bundle exec thin -C /etc/thin/app.yml restart command in the current path folder.

This throws the error:

SSHKit::Runner::ExecuteError: Exception while executing on host ...: bundle exec thin -C /etc/thin/reboot.yml restart exit status: 127

/EDIT First another error was shown because of a syntax error in the earlier code. This error was found by user RAJ in his answer below

Same error appears with this task:

task :restart do
on roles(:app) do
  within "#{current_path}" do
    execute :bundle, "thin -C /etc/thin/reboot.yml restart"
  end
end

How can I run bundle from deploy script?

1

1 Answers

3
votes

As error message indicates, your are missing block for within.

Try this:

within "#{current_path}" do
  execute "bundle exec thin -C /etc/thin/app.yml restart"
end

instead of

within "#{current_path}"
        execute "bundle exec thin -C /etc/thin/app.yml restart"