2017-01-20 6 views
0

私はこの問題を解決する方法を見つけることができません。カピストラーノは正しく動作しませんでした。だから私のアプリを展開することはできません。 ここにエラーがあります。Capistrano - Net :: SSH :: AuthenticationFailed

$ bundle exec cap staging deploy 
(Backtrace restricted to imported tasks) 
cap aborted! 
Net::SSH::AuthenticationFailed: Authentication failed for user [email protected] 

は、ここで設定ファイル、という名前の設定ここでは/ deploy.rb

# config valid only for Capistrano 3.1 
lock '3.5.0' 

set :application, 'dola' 
set :repo_url, '[email protected]/inolab/eiicon-dola.git' 

# Default branch is :master 
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call 
set :branch, 'master' 

# Default deploy_to directory is /var/www/my_app 
set :deploy_to, '/var/www/dola' 

# Default value for keep_releases is 5 
# set :keep_releases, 5 

set :rbenv_type, :user 
set :rbenv_ruby, '2.3.2-p217' 
set :rbenv_map_bins, %w{rake gem bundle ruby rails} 
set :rbenv_roles, :all 
set :linked_dirs, %w{bin log tmp/backup tmp/pids tmp/cache tmp/sockets vendor/bundle} 
role :web, %w{13.112.91.105} 

namespace :deploy do 

    desc 'Restart application' 
    task :restart do 
    on roles(:app), in: :sequence, wait: 5 do 
     # Your restart mechanism here, for example: 
     # execute :touch, release_path.join('tmp/restart.txt') 
    end 
    end 

    after :publishing, :restart 

    after :restart, :clear_cache do 
    on roles(:web), in: :groups, limit: 3, wait: 10 do 
     # Here we can do anything such as: 
     # within release_path do 
     # execute :rake, 'cache:clear' 
     # end 
    end 
    end 

end 

とのconfig /デプロイ/ staging.rb

Simple Role Syntax 
# ================== 
# Supports bulk-adding hosts to roles, the primary server in each group 
# is considered to be the first unless any hosts have the primary 
# property set. Don't declare `role :all`, it's a meta role. 

role :app, %w{[email protected]} 
role :web, %w{[email protected]} 

# Extended Server Syntax 
# ====================== 
# This can be used to drop a more detailed server definition into the 
# server list. The second argument is a, or duck-types, Hash and is 
# used to set extended properties on the server. 
server '13.112.91.105', user: 'ec2-user', roles: %w{web app}, my_property: :my_value 

# Custom SSH Options 
# ================== 
set :stage, :staging 
set :rails_env, 'staging' 
server '13.112.91.105', user: 'ec2-user', 
roles: %w{web app} 
set :ssh_options, { 
    keys: [File.expand_path('~/.ssh/id_rsa_ec2.pem)')] 
} 

誰でも、してくださいよ!

+1

は、展開キーとsshキーが正しく設定されていますか? –

+0

コメントありがとうございました。ところで、「展開キー」はどういう意味ですか? –

答えて

2

Capistranoは、お使いのコンピュータと、この場合は13.112.91.105のアプリケーションを展開しようとしているマシンとの間でSSHセッションを確立しようとしています。これを行うには、Capistranoの設定で、私は~/.ssh/id_rsa_ec2.pemと仮定しているユーザec2-user(SSH秘密鍵を使用)として13.112.91.105で動作しているSSHサーバを認証できる必要があります。これが発生するには、対応するSSH 公開のキーが、マシン13.112.91.105のec2-userauthorized_keysファイルに記載されている必要があります。

+0

私は参照してください。私はあなたに後で助言したように設定しようとしています。ありがとう。 –

+0

返事が遅れて申し訳ありません。私は仕事に出た後、あなたが説明したようにしました。できます! ありがとうございます。 –

+0

あなたは大歓迎です! – edurante