2017-01-20 4 views
0

이 문제를 해결하는 방법을 알 수 없습니다. Capistrano가 올바르게 작동하지 않았습니다. 그래서 내 애플 리케이션을 배포 할 수 없습니다. 여기 오류가 있습니다.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

코멘트 주셔서 감사합니다. BTW, '배포 키'는 무엇을 의미합니까? 내 말은, –

답변

2

Capistrano는 컴퓨터와 응용 프로그램을 배포하려는 컴퓨터 (이 경우에는 13.112.91.105) 사이에 SSH 세션을 설정하려고 시도하고 있습니다. 이렇게하기 위해서는 Capistrano 설정을 통해, ec2-user이라는 SSH 개인 키를 사용하는 13.112.91.105에서 실행중인 SSH 서버에 대해 인증을 받아야합니다. 이는 ~/.ssh/id_rsa_ec2.pem이라고 가정합니다. 이 문제가 발생하면 해당 SSH 공개 키는 기기 13.112.91.105의 ec2-user에 대한 authorized_keys 파일에 나열되어야합니다.

+0

. 나에게 나중에 권고하면서 구성하려고합니다. 감사. –

+0

늦게 답장을 드려 죄송합니다. 일하러 간 후에 당신이 묘사 한대로 행동했습니다. 그것은 작동합니다! 감사합니다. –

+0

여러분을 환영합니다! – edurante