Ruby on rails 通过Capistrano 3安装和启动守护程序脚本
我已经尝试了好几天了,现在都没有成功。我正在使用Capistrano3在生产服务器上部署RubyonRails4代码 在部署过程结束时,我希望重新启动我的守护程序脚本,我将通过以下命令手动执行此操作:Ruby on rails 通过Capistrano 3安装和启动守护程序脚本,ruby-on-rails,ruby,capistrano3,Ruby On Rails,Ruby,Capistrano3,我已经尝试了好几天了,现在都没有成功。我正在使用Capistrano3在生产服务器上部署RubyonRails4代码 在部署过程结束时,我希望重新启动我的守护程序脚本,我将通过以下命令手动执行此操作: RAILS_ENV=production bundle exec ruby script/my_daemon restart 在我的Capistrano3配方(config/deploy.rb)中,我尝试了一些不同的设置,但都不起作用 namespace :deploy do desc 'R
RAILS_ENV=production bundle exec ruby script/my_daemon restart
在我的Capistrano3配方(config/deploy.rb
)中,我尝试了一些不同的设置,但都不起作用
namespace :deploy do
desc 'Restart application'
task :restart do
invoke 'unicorn:restart'
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
within release_path do
execute :rake, 'tmp:cache:clear'
# Daemons
# This ends up with an error
execute :bundle, :exec, :ruby, "RAILS_ENV=production /var/www/MY_APP/current/script/my_daemon restart;"
# This starts the daemon, but in development environment
execute :bundle, :exec, :ruby, "/var/www/MY_APP/current/script/my_daemon restart RAILS_ENV=production;"
# This also starts the daemon, but in development environment
execute :bundle, :exec, :ruby, "/var/www/MY_APP/current/script/my_daemon restart;"
end
end
end
end
有人能帮我写下在生产环境中重新启动守护进程的正确方法吗?谢谢。尝试通过capistrano dsl设置环境
within release_path do
with rails_env: :production do
execute :bundle, :exec, :ruby, "#{current_path}/script/my_daemon restart"
end
end
@ElliottFrisch的可能副本它不是该问题的副本,因为这里的命令将通过sshkit在远程系统上执行