简体   繁体   English

rails capistrano部署错误

[英]rails capistrano deployment error

I have installed capistrano with gem capistrano 我已经安装了capistrano和gem capistrano

And in my application directory i installed cap install 在我的应用程序目录中,我安装了cap install

This command includes deploy/production.rb and deploy/staging.rb and in config/deploy.rb 此命令包括deploy/production.rbdeploy/staging.rb config/deploy.rb以及config/deploy.rb

my production.rb file has following 我的production.rb文件有以下内容

set :stage, :production
role :all, %w{seting@mydomain.com}
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) }

And this is my deploy.rb 这是我的deploy.rb

set :application, 'admin'
set :repo_url, 'git@bitbucket.org: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

And finally when i run cap production deploy 最后当我运行cap production deploy

Getting errors as 得到错误

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)

Edit - 1 编辑 - 1

In addition i didn't do any special installations in my server to run rails application. 另外,我没有在我的服务器中进行任何特殊安装来运行rails应用程序。 I have decided to move my file to server first. 我已决定先将文件移到服务器上。 Is it right way? 这是对的吗?

You should set role name deploy instead of seting, or other way. 您应该设置角色名称deploy而不是seting或其他方式。

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

Here is the guide 这是指南

And you probably want to run 你可能想跑

cap production deploy:check

to check your config. 检查你的配置。

Also there is no deploy:setup in capistrano 3.0 在capistrano 3.0中也没有部署:设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM