2014-04-07 14 views
9

Sto provando a utilizzare Capistrano 3 per distribuire un'applicazione Rails 4.La distribuzione di Capistrano 3 richiede la passphrase SSH ma non è possibile digitarla in

#config valid only for Capistrano 3.1 
lock '3.1.0' 

set :application, 'testapp' 
set :scm, :git 
set :repo_url, '[email protected]:sergiotapia/testapp.git' 

set :user, "deploy" # The user on the VPS server. 
set :password, "hunter2$$" 
set :use_sudo, false 
set :deploy_to, "/home/deploy/www/testapp" 
set :deploy_via, :remote_cache 
set :pty, true 
set :format, :pretty 
set :keep_releases, 1 
set :rails_env, "production" 
set :migrate_target, :latest 

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') 
     execute :touch, release_path.join('tmp/restart.txt') 
     system "curl --silent #{fetch(:ping_url)}" 
    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 

Quando si esegue cap production deploy ottengo il seguente messaggio:

DEBUG [322bb1fd] Enter passphrase for key '/home/deploy/.ssh/id_rsa': 

Quando digito nel terminale, posso vedere i personaggi, di solito basta vedere gli spazi bianchi quando si digita le parole d'accesso, a destra ?

DEBUG [484154d4] Enter passphrase for key '/home/deploy/.ssh/id_rsa': 
qwef 

ewf 
qw 
ef 
qwef 
wqe 
f 
qwef 
wqe 
f 
^Ccap aborted! 
Interrupt: 

Digito la password e premo invio, e rimane solo senza nuovi sviluppi. Devo Ctrl + C per lasciare effettivamente il terminale.

Posso impostare la password SSH nel file deploy.rb?

+0

Devo usare un ssh-key senza password per distribuire i server? – sergserg

risposta

4

Ho avuto lo stesso problema.

Quello che ho fatto è stato modificare la mia configurazione. Al fine di evitare Capistrano chiedere la passphrase si deve set`

set :pty, false 

Poi è necessario generare le chiavi di distribuirli in qualsiasi computer che si utilizza per sparare il terminale (Si può trovare una guida molto bella qui https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git specialmente se si utilizza bitbucket) ed esegue cap production deploy

il fatto è che per impostazione predefinita, Capistrano imposterà il forward_agent come vero che utilizzerà le chiavi generate nel vostro computer per l'autenticazione nel repository di codice da remoto.

+0

per favore dimmi cosa 'passphrase' faccio a capistrano? – VKatz

+0

@Vinay rappresenta la passphrase della tua chiave – omrsin

Problemi correlati