gpt4 book ai didi

ruby-on-rails - 如何在不提示输入密码的情况下部署 Capistrano?

转载 作者:数据小太阳 更新时间:2023-10-29 07:48:27 24 4
gpt4 key购买 nike

当我在过程即将结束的某个时刻运行 cap deploy 时,我收到密码提示...

 ** keeping 5 of 6 deployed releases
* executing "sudo -p 'sudo password: ' rm -rf /opt/deployed_rails_apps/myapp/releases/20120922200242"
servers: ["myhost.com"]
[username@myhost.com] executing command
Password:

有没有一种方法可以在不提示我输入密码的情况下完成它?

这是我的deploy.rb...

require "bundler/capistrano"

require "rvm/capistrano"

set :rvm_ruby_string, 'ruby-1.9.3-p194@run_passenger'

set :rvm_type, :user

set :application, 'myapp'

set :repository, 'git@github.com:fakename/myrepository.git'

set :deploy_to, "/opt/deployed_rails_apps/#{application}"

set :scm, "git"
set :branch, "master"

set :deploy_via, :remote_cache

set :keep_releases, 5
after "deploy:update", "deploy:cleanup"

load 'deploy/assets'

role :app, 'username@myhost.com'
role :web, 'username@myhost.com'

namespace :deploy do

task :start, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end

task :stop, :roles => :app do
# Do nothing.
end

desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_release}/tmp/restart.txt"
end

end

最佳答案

假设您的部署用户具有适当的权限并且您不需要使用 sudo,您可以将 :use_sudo 设置为 false,Capistrano 将不会使用它。

只需添加

set :use_sudo, false

到你的deploy.rb

关于ruby-on-rails - 如何在不提示输入密码的情况下部署 Capistrano?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12557034/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com