【问题标题】:Gems are not being installed from capistrano deployment宝石没有从 capistrano 部署中安装
【发布时间】:2017-05-16 11:37:00
【问题描述】:

我正在使用:

  • 导轨 4.2
  • 独角兽服务器
  • nginx 网络服务器
  • capistrano 用于部署。

如果我向 gemfile 添加新的 gem,它不会反映在应用程序中。我尝试使用Gem.loaded_specs["koala"].full_gem_path 检查宝石,但它没有显示在任何地方。我可以看到 gem 被捆绑在日志中,并且部署成功完成。但介于两者之间,我可以在 Capistrano 日志中看到一个错误。

注意:Bundler 已安装。

cd /home/deploy/bloom/releases/20170516105043 && RAILS_ENV=dev bundle exec honeybadger deploy --environment dev --revision 08e4726 --repository git@bitbucket.org:appster/bloom-ruby.git --user arvindmehra
DEBUG[1450b9f0]     **bash: bundle: command not found**

这是我的capfile:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/honeybadger'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/rvm'
require 'whenever/capistrano'

Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

这是我来自 dev.rb 的部署环境脚本

set :branch, 'dev'
set :keep_releases, 3

server '66.128.61.239',
  user: 'deploy',
  roles: %w{web app db},
  ssh_options: {
    user: 'deploy', # overrides user setting above
    keys: %w(~/.ssh/id_rsa),
    forward_agent: false,
    #auth_methods: %w(publickey)
    password: 'password'
  }


 namespace :deploy do

  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command do
      on roles(:app), in: :sequence, wait: 1 do
         execute "/etc/init.d/bloom-ruby #{command}"
      end
    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

这是我的 deploy.rb

# config valid only for current version of Capistrano
lock '3.3.3'


set :application, 'bloom'
set :repo_url, 'git@bitbucket.org:appster/bloom-ruby.git'
set :deploy_to, '/home/deploy/bloom'
#set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')

# Define which type of RVM the server is using
set :rvm_type, :user
set :rvm_ruby_version, '2.2.2@bloom'

# Default value for :linked_files is []
set :linked_files, %w{config/database.yml config/secrets.yml config/settings.yml config/providers.yml config/stripe.yml}

# Default value for linked_dirs is []
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/identicons public/uploads public/images}

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 capistrano3


    【解决方案1】:

    部署处于生产模式。

     RAILS_ENV=production bundle install
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      • 2012-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多