2013-10-11 150 views
14

我已經安裝了Capistrano的我安裝cap install軌Capistrano的部署錯誤

此命令包含deploy/production.rbdeploy/staging.rbconfig/deploy.rb

production.rb文件有以下

set :stage, :production 
role :all, %w{[email protected]} 
server 'sub.mydomain.com', user: 'deploy', roles: %w{web app}, my_property: :my_value 
set :ssh_options, { :forward_agent => true, :port => 1754, :keys => %w(/home/seting/.ssh/id_rsa) } 

這是我deploy.rb

set :application, 'admin' 
set :repo_url, '[email protected]:username/myadmin.git' 
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 :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 

    after :finishing, 'deploy:cleanup' 

end 

最後當我運行cap production deploy

四處錯誤,

cap aborted! 
seting 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.7.0/lib/net/ssh.rb:215:in `start' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:156:in `ssh' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:68:in `upload!' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.0.0/lib/capistrano/tasks/git.rake:11:in `block (3 levels) in <top (required)>' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/backends/netssh.rb:42:in `run' 
/home/seting/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.0.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute' 
Tasks: TOP => git:check => git:wrapper 
(See full trace by running task with --trace) 

編輯 - 1

除了我沒有在我的服務器上執行任何特殊安裝以運行rails應用程序。我決定先把我的文件移到服務器上。這是對的嗎?

+0

您是否運行'cap production deploy:setup'?這是否工作或給你同樣的錯誤? – CDub

+0

因'不知道如何構建任務'部署:setup'' – overflow

+0

是否需要在我的服務器或git中配置其他任何東西 – overflow

回答

12

您應該設置角色名稱部署而不是seting或其他方式。

set :stage, :production 
set :branch, 'master' 
set :deploy_to, '/srv/www/server.com/' 
role :all, %w{[email protected]} 
server 'server.com', user: 'deploy', roles: %w{web app}, my_property: :my_value 
fetch(:default_env).merge!(rails_env: :production) 

這裏是guide

而且你可能要運行

cap production deploy:check 

來檢查你的配置。

也沒有部署:安裝在capistrano 3.0

+2

出色的一點。我錯過了他正在使用3.0。非常棒。 – CDub

+1

我嘗試了上面給出的鏈接,但面臨同樣的問題。你能幫我麼。 – overflow

+0

如何完成服務器上的設置?手動?沒有任何任務可以爲所需的文件夾結構執行mkdir? –