Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – 导轨capistrano部署错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经安装了宝石capistrano的capistrano

而在我的应用目录我安装了帽子安装

此命令包括deploy / production.rb和deploy / staging.rb以及config / deploy.rb

我的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) }

这是我的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

最后当我运行cap生产部署

获取错误

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应用程序.我决定先将文件移动到服务器.是正确的方法吗?

解决方法

您应该设置角色名称部署而不是设置,或其他方式.
set :stage,:production
set :branch,'master'
set :deploy_to,'/srv/www/server.com/'
role :all,%w{deploy@server.com}
server 'server.com',my_property: :my_value
fetch(:default_env).merge!(rails_env: :production)

这是guide

你可能想跑

cap production deploy:check

检查你的配置.

也没有部署:安装在capistrano 3.0

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails – 导轨capistrano部署错误全部内容,希望文章能够帮你解决ruby-on-rails – 导轨capistrano部署错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。