没有从capistrano部署

时间:2017-05-16 11:37:01

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

我正在使用:

  • rails 4.2
  • 独角兽服务器
  • nginx web server
  • 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}

1 个答案:

答案 0 :(得分:0)

部署处于生产模式。

 RAILS_ENV=production bundle install