2012-01-18 85 views
1

我嘗試在vds上運行我的第一個Rails 3應用程序。所以,我決定爲此使用capistrano。我也有Phusion乘客,Nginx,RVM和Ruby 1.9.3。無法通過Capistrano部署Rails應用程序

我使用這個鏈接作爲教程 - https://github.com/capistrano/capistrano/wiki/2.x-From-The-Beginning

所以,當我打印

cap deploy:check 

然後一切就OK了:

* executing `deploy:check' 
    * executing "test -d /vol/www/apps/ror_tutorial/releases" 
    servers: ["188.127.224.136"] 
Password: <my password> 
    [188.127.224.136] executing command 
    command finished in 87ms 
    * executing "test -w /vol/www/apps/ror_tutorial" 
    servers: ["188.127.224.136"] 
    [188.127.224.136] executing command 
    command finished in 63ms 
    * executing "test -w /vol/www/apps/ror_tutorial/releases" 
    servers: ["188.127.224.136"] 
    [188.127.224.136] executing command 
    command finished in 72ms 
    * executing "which git" 
    servers: ["188.127.224.136"] 
    [188.127.224.136] executing command 
    command finished in 65ms 
You appear to have all necessary dependencies installed 

但是,當我嘗試做下一步:

cap deploy:update 

我收到奇怪的錯誤:

* executing `deploy:update' 
** transaction: start 
    * executing `deploy:update_code' 
    executing locally: "git ls-remote [email protected]:Loremaster/sample_app.git master" 
    command finished in 4097ms 
    * executing "git clone -q [email protected]:Loremaster/sample_app.git /vol/www/apps/ror_tutorial/releases/20120118170908 && cd /vol/www/apps/ror_tutorial/releases/20120118170908 && git checkout -q -b deploy f0cf5d0141c80ab82d9191e72aabeddb8cf6e552 && (echo f0cf5d0141c80ab82d9191e72aabeddb8cf6e552 > /vol/www/apps/ror_tutorial/releases/20120118170908/REVISION)" 
    servers: ["188.127.224.136"] 
Password: <my password> 
    [188.127.224.136] executing command 
** [188.127.224.136 :: out] Permission denied (publickey). 
** fatal: The remote end hung up unexpectedly 
    command finished in 1573ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /vol/www/apps/ror_tutorial/releases/20120118170908; true" 
    servers: ["188.127.224.136"] 
    [188.127.224.136] executing command 
    command finished in 63ms 
failed: "sh -c 'git clone -q [email protected]:Loremaster/sample_app.git /vol/www/apps/ror_tutorial/releases/20120118170908 && cd /vol/www/apps/ror_tutorial/releases/20120118170908 && git checkout -q -b deploy f0cf5d0141c80ab82d9191e72aabeddb8cf6e552 && (echo f0cf5d0141c80ab82d9191e72aabeddb8cf6e552 > /vol/www/apps/ror_tutorial/releases/20120118170908/REVISION)'" on 188.127.224.136 

我該如何解決這個問題?

這裏是我的配置/ deploy.rb

set :user, "root" 

default_run_options[:pty] = true            
set :repository, "[email protected]:Loremaster/sample_app.git" 

set :application, "ror_tutorial" 
set :deploy_to, "/vol/www/apps/#{application}" 

set :scm, :git 
set :branch, "master" 


server "188.127.224.136", :app, 
          :web, 
          :db, :primary => true 

namespace :passenger do 
    desc "Restart Application" 
    task :restart do 
    run "touch #{current_path}/tmp/restart.txt" 
    end 
end 

after :deploy, "passenger:restart" 
+0

我遇到了這個問題,當我的私鑰不存在於做克隆的機器上時。 – 2012-01-18 17:32:44

回答

3

您需要使用公共倉庫地址(除非你想給你的GitHub的服務器的SSH密鑰,你不應該):

set :repository, "git://github.com/Loremaster/sample_app.git" 
+0

這有助於謝謝! – AnkitG 2013-03-05 12:45:03

相關問題