【发布时间】:2021-12-18 11:19:56
【问题描述】:
我正在尝试使用 capistrano 将 rails 应用程序从我的机器部署到 aws linux ec2。
我使用了bundle exec cap production deploy 命令,它实际上成功地向服务器部署了一个新版本,但它无法(重新)启动 puma。在 puma 重启阶段,我收到此错误(出于隐私考虑,我将错误中的实际应用名称替换为
01:23 puma:restart
01 sudo /bin/systemctl restart puma_<app-name>_production
01 Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
01
#<Thread:0x00007f93fb8d2700@/Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
12: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
11: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `run'
10: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
9: from /Users/sary/.rvm/gems/ruby-2.6.4/bundler/gems/capistrano-puma-f9801f6762d1/lib/capistrano/tasks/systemd.rake:105:in `block (3 levels) in eval_rakefile'
8: from /Users/sary/.rvm/gems/ruby-2.6.4/bundler/gems/capistrano-puma-f9801f6762d1/lib/capistrano/puma/systemd.rb:55:in `execute_systemd'
7: from /Users/sary/.rvm/gems/ruby-2.6.4/bundler/gems/capistrano-puma-f9801f6762d1/lib/capistrano/puma/systemd.rb:48:in `sudo_if_needed'
6: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/capistrano-3.12.0/lib/capistrano/dsl.rb:44:in `sudo'
5: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:80:in `execute'
4: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `create_command_and_execute'
3: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `tap'
2: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/abstract.rb:148:in `block in create_command_and_execute'
1: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/backends/netssh.rb:170:in `execute_command'
/Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/command.rb:97:in `exit_status=': sudo exit status: 5 (SSHKit::Command::Failed)
sudo stdout: Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
sudo stderr: Nothing written
1: from /Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/sary/.rvm/gems/ruby-2.6.4/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing on host 54.78.252.112: sudo exit status: 5 (SSHKit::Runner::ExecuteError)
sudo stdout: Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
sudo stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 54.78.252.112: sudo exit status: 5
sudo stdout: Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
sudo stderr: Nothing written
Caused by:
SSHKit::Command::Failed: sudo exit status: 5
sudo stdout: Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
sudo stderr: Nothing written
Tasks: TOP => puma:restart
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing on host 54.78.252.112: sudo exit status: 5
sudo stdout: Failed to restart puma_<app-name>_production.service: Unit puma_<app-name>_production.service not found.
sudo stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
免责声明:我从以前的工程师那里继承了这个部署过程,所以 rails/puma/capistrano 不是我的专长。非常感谢任何帮助。
【问题讨论】:
标签: ruby-on-rails capistrano puma