Capistrano的使用Ubuntu的EC2实例部署的Ruby on Rails [英] capistrano with ubuntu ec2 instance to deploy ruby on rails

查看:177
本文介绍了Capistrano的使用Ubuntu的EC2实例部署的Ruby on Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现的Ruby on使用Capistrano的,我运行的临时服务器和nginx的稀土元素版本在生产服务器上的Apache RVM rails应用程序。我使用Git也。 我一直在尝试整合Capistrano的,但我收到此错误

I am trying to implement ruby on rails app using Capistrano, I am running apache rvm in the staging server and nginx REE version in production server. I am using git also. I have been try to integrate Capistrano but I am getting the this error

(Net::SSH::AuthenticationFailed: ubuntu)

下面是我的deploy.rb文件

Here is my deploy.rb file

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,  "git@github.com: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的。

Unable to figure the exact problem and the methods to integrate capistrano.

推荐答案

这似乎很简单:Capistrano的不提示部署时的密码,而是希望你的SSH密钥到目标服务器上验证您的身份

It seems simple: Capistrano does not prompt for passwords when deploying but rather expects your SSH key to authenticate you on the target server.

好像你正在尝试部署为(Ubuntu的),因为这不能被认证的用户。

It seems like the user you are trying to deploy as (ubuntu) can't be authenticated because of this.

试着增加你的的〜/ .ssh / id_rsa.pub 的内容传送到服务器: /home/ubuntu/.ssh/authorized_keys 文件。

Try adding the contents of your ~/.ssh/id_rsa.pub to the servers: /home/ubuntu/.ssh/authorized_keys file.

如果你能ssh到你的机器没有得到提示输入密码,这是工作

If you can ssh into your machine without getting prompted for a password it is working

更新:在你的情况,你所使用的 ssh_options [:密钥] 来定义另一个关键用于SSH授权。您既可以删除该指令默认为您的标准ssh密钥(一个在〜/ .ssh / id_rsa.pub)或增加您指定的authorized_keys文件的其他主要服务器上。

Update: In your case you are using the ssh_options[:keys] to define another key to be used for SSH authorization. You could either remove that directive to default to your standard ssh key (the one in ~/.ssh/id_rsa.pub) or add that other key you are specifying to the authorized_keys file on your server.

我建议你尝试没有 ssh_options [:密钥] 选项:)

I suggest you try it without the ssh_options[:keys] option :)

这篇关于Capistrano的使用Ubuntu的EC2实例部署的Ruby on Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆