[英]Capistrano rvmsudo
Capistrano does not work with rvmsudo
in my deploy.rb. Capistrano在我的deploy.rb中不能与rvmsudo
一起使用。
I tried 我试过了
set :sudo, 'rvmsudo'
set :sudo_prompt, 'password: '
And then running commands with: 然后运行命令:
sudo "god -c config/unicorn.god --log-level debug"
But Capistrano gets stuck on the password prompt. 但Capistrano卡在密码提示上。
This solution here says to use sudo "whoami"
and then rvmsudo
because it will remember your password for 5 minutes, but my password is not remembered. 该解决方案在这里说,使用sudo "whoami"
,然后rvmsudo
,因为它会记住您的密码为5分钟,但我的密码不会被记住。
context: 背景:
desc "Start unicorn"
task :start, :except => { :no_release => true } do
sudo "god -c config/unicorn.god --log-level debug"
end
Try to use this: 试着用这个:
task :do_something do
run "cd #{latest_release} && rvmsudo -p '#{sudo_prompt}' some_command"
end
It worked for me! 它对我有用!
Are you doing 你在做什么
require 'bundler/capistrano'
? ?
Its hacky, but you could try: 它的hacky,但你可以尝试:
after "deploy:update_code", :do_bundle_install
task :do_bundle_install do
run "cd #{current_release} && rvmsudo bundle install --gemfile #{current_release}/Gemfile --path {path to install}/bundle --without development test cucumber"
end
Try using sudo inside the run command, but calling the sudo from the set: 尝试在run命令中使用sudo,但是从集合中调用sudo:
task :do_something do
run "#{sudo} root task"
end
This way if you change your mind, you dont need to rewrite all tasks, only remove the set :sudo
. 这样一来,如果你改变主意,就不需要重写所有任务,只需删除set :sudo
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.