我想在Nginx-unit部署后重新启动Capistrano
namespace :deploy do
desc 'Collec Static Files'
task :collectImg do
on roles(:app) do
execute "sudo systemctl restart unit"
end
end
after :publishing, :collectImg
end在上面的代码之后,会出现这样的错误日志。
在部署脚本中是否有使用systemctl的好方法?
DEBUG [08ce969a] Command: sudo systemctl restart unit
DEBUG [08ce969a] sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper发布于 2022-02-08 16:16:55
首先-伟大的你是使用NGINX单位与卡皮斯特拉诺!
这个问题一次涉及几个问题。
1.启用tty模式
将其添加到部署配置deploy.rb中。卡斯特拉诺3号。
set :pty, true关于帕蒂的更多信息
2.修改App Server上的sudoers文件
您必须允许部署用户执行sudo命令,而不需要输入密码。您可以/应该将此功能限制在特定资源上。我添加了restart和status作为示例。
deploy ALL=NOPASSWD:/bin/systemctl restart unit.serivce, /bin/systemctl status unit.serivce作为参考,请参阅卡皮斯特拉诺
我想在我们的Community频道上谈谈您的capistrano配置。
https://stackoverflow.com/questions/70632703
复制相似问题