这里仅讨论systemd方式 rvm环境
cap stage puma:systemd:config
cap stage puma:systemd:enable
到服务器要检查一下/etc/systemd/system/puma.service内容
文件内容可能写的是~/.rvm/xxxx
这时需要将这个路径改成绝对路径,不然一直会报以下错误
01 sudo /bin/systemctl restart puma
01 Failed to restart puma.service: Unit puma.service is not loaded properly: Invalid argument.
01 See system logs and 'systemctl status puma.service' for details.
#<thread:0x00007fc03d96f3c0 users="" user="" .rvm="" gems="" ruby-3.0.0="" sshkit-1.21.2="" lib="" sshkit="" runners="" parallel.rb:10="" run=""> terminated with exception (report_on_exception is true):
/Users/tsuijy/.rvm/gems/ruby-3.0.0/gems/sshkit-1.21.2/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deployer@server: sudo exit status: 1 (SSHKit::Runner::ExecuteError)
sudo stdout: Nothing written
sudo stderr: Failed to restart puma.service: Unit puma.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status puma.service' for details.
</thread:0x00007fc03d96f3c0>