2012-06-19 38 views
1

我想在使用Capistrano的Rails應用程序上實現紅寶石,我在生產服務器中的臨時服務器和nginx REE版本中運行Apache rvm。我也使用git。 我一直試圖整合Capistrano的,但我收到此錯誤capistrano與Ubuntu的EC2實例在軌道上部署紅寶石

(Net::SSH::AuthenticationFailed: ubuntu) 

這裏是我的deploy.rb文件

set :application, "capify" 

# The directory on the EC2 node that will be deployed to 
set :deploy_to, "/home/ubuntu/apps/#{application}" 

set :keep_releases, 3 

# deploy with git 
set :scm, :git 
set :repository, "[email protected]:username/capify.git" 
set :git_shallow_clone, 1 
set :branch, "master" 
set :use_sudo, false 

set :user, "ubuntu" 
ssh_options[:keys] = ["/path/tp/key.pem"] 
ssh_options[:forward_agent] = true 
default_run_options[:pty] = true 

# The address of the remote host on EC2 (the Public DNS address) 
set :location, "ip" 

# setup some Capistrano roles 
role :app, location 
role :web, location 
role :db, location, :primary => true 

after 'deploy:update_code', 'deploy:symlink_db' 


namespace :deploy do 

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

desc "Symlinks the database.yml" 
task :symlink_db, :roles => :app do 
run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml" 
end 

end 

找不出確切的問題和方法,以整合Capistrano的。

+0

你是如何得到它的工作?我也有相同的[問題](http://stackoverflow.com/questions/30858269/sshkitrunnerexecuteerror-exception-while-running-cap-production-deployc)..任何幫助嗎? –

回答

2

看起來很簡單:Capistrano在部署時不會提示輸入密碼,而是希望您的SSH密鑰在目標服務器上對您進行身份驗證。

看起來你試圖部署爲(ubuntu)的用戶不能被認證,因爲這一點。

嘗試將~/.ssh/id_rsa.pub的內容添加到服務器:/home/ubuntu/.ssh/authorized_keys文件。

如果你能ssh到你的機器沒有得到提示輸入密碼,它正在

更新:在你的情況,你正在使用的ssh_options[:keys]定義要用於SSH授權的另一個關鍵。您可以刪除該指令以默認爲標準ssh密鑰(〜/ .ssh/id_rsa.pub中的密鑰),也可以將您指定的其他密鑰添加到服務器上的authorized_keys文件中。

我建議你試試它沒有ssh_options[:keys]選項:)

+0

即使將id_rsa.pub內容的內容添加到authorized_keys中,我也會收到同樣的錯誤... –

+0

已更新答案 – Tigraine