2014-09-04 4 views
0

Capistrano를 사용하여 Rails 앱을 배포하려고합니다. 나는 튜토리얼 How to Deploy a Rails 4 App with Git and Capistrano을 따라 갔다.deploy 실행시 인증 오류 :

INFO[349a4b8d] Running /usr/bin/env mkdir -p /tmp/app_name/ on xxx.xx.xxx.xxx 
DEBUG[349a4b8d] Command: /usr/bin/env mkdir -p /tmp/app_name/ 
INFO[cd49f0ac] Running /usr/bin/env mkdir -p /tmp/app_name/ on example.com 
DEBUG[cd49f0ac] Command: /usr/bin/env mkdir -p /tmp/app_name/ 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xx.xxx.xxx: Authentication failed for user @xxx.xx.xxx.xxx 

내 첫번째 생각은 내가 sudo를를 사용할 필요가 않았다,하지만 MKDIR는/tmp를 /에 sudo를를 필요가 없습니다 : 나는 cap production deploy:check을 실행할 때, 그것은 나에게 오류를 제공합니다. 내 두 번째 생각은 ssh에 대한 암호가 필요하지만 내 개발 컴퓨터와 서버 사이에서 ssh에 공개 키를 사용합니다. 어떤 아이디어? 나는 루비 2.1.0 사용하고

lock '3.2.1' 

set :application, 'app_name' 

set :repo_url, '[email protected]:remote/app_name.git' 
set :scm, :git 

set :user, 'deploy' 
set :use_sudo, false 

set :stage, :production 

set :rails_env, 'production' 
set :deploy_via, :remote_cache 

set :keep_releases, 5 

set :ssh_options, { forward_agent: true } 

set :pty, true 

server 'xxx.xx.xxx.xxx', roles: [:app, :web, :db], primary: true 

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 

4.1.4 레일, 카피 스트라 노 3.2.1 :

여기 내 config/deploy.rb입니다.

답변

2

설정에 몇 가지 문제가 있음을 발견했습니다. 먼저 config/deploy/production.rb에 정보를 입력하는 것을 잊었습니다. 이 동일한 파일에서 나는 또한 set :password, ask('Server password:', nil) 줄을 추가했다.

둘째,이 오류가 발생한 이유는 권한 문제 때문입니다. 이 사용자는 /var/www을 수정할 수있는 권한이 없습니다. 변경하려면 간단히 sudo chown deploy:deployers /var/www을 입력해야합니다. 또한 GitHub의 로그인 자격 증명을 서버에 포함시켜야했습니다.