Capistrano部署错误可能';t激活jruby-openssl-0.9.5-java
我已经在JRuby(1.7.10)中开发了一个新的Rails(4.1.4)应用程序,我正在尝试将它与CapistranoV3一起部署到远程vps上。我收到的错误如下所示:Capistrano部署错误可能';t激活jruby-openssl-0.9.5-java,ruby,ruby-on-rails-4,jruby,capistrano3,Ruby,Ruby On Rails 4,Jruby,Capistrano3,我已经在JRuby(1.7.10)中开发了一个新的Rails(4.1.4)应用程序,我正在尝试将它与CapistranoV3一起部署到远程vps上。我收到的错误如下所示: INFO[551a80fb] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/deployer/apps/APPNAME/shared/bin --path /home/deployer/apps/APPNAME/shared/bundle -
INFO[551a80fb] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/deployer/apps/APPNAME/shared/bin --path /home/deployer/apps/APPNAME/shared/bundle --without development test on example.net
DEBUG[551a80fb] Command: cd /home/deployer/apps/APPNAME/releases/20140919052426 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/deployer/apps/APPNAME/shared/bin --path /home/deployer/apps/APPNAME/shared/bundle --without development test
DEBUG[551a80fb] Gem::LoadError: can't activate jruby-openssl-0.9.5-java, already activated jruby-openssl-0.9.3
DEBUG[551a80fb]
DEBUG[551a80fb] raise_if_conflicts at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb:1988
DEBUG[551a80fb]
DEBUG[551a80fb] activate at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb:1238
DEBUG[551a80fb]
DEBUG[551a80fb] gem at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_gem.rb:48
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:46
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/security.rb:11
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/package.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/package.rb:43
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/dependency_installer.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/dependency_installer.rb:4
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundl
DEBUG[551a80fb] er-1.7.3/lib/bundler/installer.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/installer.rb:2
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli/install.rb:1
DEBUG[551a80fb] run at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli/install.rb:78
DEBUG[551a80fb]
DEBUG[551a80fb] install at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli.rb:145
DEBUG[551a80fb]
DEBUG[551a80fb] run at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/command.rb:27
DEBUG[551a80fb]
DEBUG[551a80fb] invoke_command at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/invocation.rb:121
DEBUG[551a80fb]
DEBUG[551a80fb] dispatch at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor.rb:363
DEBUG[551a80fb]
DEBUG[551a80fb] start at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/base.rb:440
DEBUG[551a80fb]
DEBUG[551a80fb] load at org/jruby/RubyKernel.java:1099
DEBUG[551a80fb]
DEBUG[551a80fb] start at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli.rb:9
DEBUG[551a80fb]
DEBUG[551a80fb] eval at org/jruby/RubyKernel.java:1119
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/bin/jruby_executable_hooks:15
source 'https://rubygems.org'
ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.10'
gem 'bouncy-castle-java', '<= 1.50' # my attempt to fix the version of jruby-openssl
gem 'jruby-openssl', '0.9.5' # to 0.9.5. Tried with 0.9.3 but with no effect.
gem 'rails', '4.1.4'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'therubyrhino'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'activerecord-jdbcmysql-adapter'
gem 'devise'
gem 'devise_invitable', :github => 'scambra/devise_invitable'
gem "paperclip"
gem 'acts_as_list'
gem 'pry-rails', group: :development
gem 'rubyzip'
gem 'to_bool', '~> 1.0.1'
gem "jquery-fileupload-rails"
# Use Capistrano for deployment
gem 'capistrano', group: :development
gem 'capistrano-rvm', group: :development
gem 'capistrano-bundler', group: :development
gem 'capistrano-rails', group: :development
gem 'trinidad', require: false
gem 'trinidad_init_services', require: false
gem 'rvm1-capistrano3', require: false
这是Gemfile的外观:
INFO[551a80fb] Running ~/.rvm/bin/rvm default do bundle install --binstubs /home/deployer/apps/APPNAME/shared/bin --path /home/deployer/apps/APPNAME/shared/bundle --without development test on example.net
DEBUG[551a80fb] Command: cd /home/deployer/apps/APPNAME/releases/20140919052426 && ~/.rvm/bin/rvm default do bundle install --binstubs /home/deployer/apps/APPNAME/shared/bin --path /home/deployer/apps/APPNAME/shared/bundle --without development test
DEBUG[551a80fb] Gem::LoadError: can't activate jruby-openssl-0.9.5-java, already activated jruby-openssl-0.9.3
DEBUG[551a80fb]
DEBUG[551a80fb] raise_if_conflicts at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb:1988
DEBUG[551a80fb]
DEBUG[551a80fb] activate at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/specification.rb:1238
DEBUG[551a80fb]
DEBUG[551a80fb] gem at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_gem.rb:48
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:46
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/security.rb:11
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/package.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/package.rb:43
DEBUG[551a80fb]
DEBUG[551a80fb] require at org/jruby/RubyKernel.java:1083
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
DEBUG[551a80fb]
DEBUG[551a80fb] require at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:53
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/dependency_installer.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/rubies/jruby-1.7.10/lib/ruby/shared/rubygems/dependency_installer.rb:4
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundl
DEBUG[551a80fb] er-1.7.3/lib/bundler/installer.rb:1
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/installer.rb:2
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli/install.rb:1
DEBUG[551a80fb] run at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli/install.rb:78
DEBUG[551a80fb]
DEBUG[551a80fb] install at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli.rb:145
DEBUG[551a80fb]
DEBUG[551a80fb] run at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/command.rb:27
DEBUG[551a80fb]
DEBUG[551a80fb] invoke_command at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/invocation.rb:121
DEBUG[551a80fb]
DEBUG[551a80fb] dispatch at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor.rb:363
DEBUG[551a80fb]
DEBUG[551a80fb] start at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/vendor/thor/base.rb:440
DEBUG[551a80fb]
DEBUG[551a80fb] load at org/jruby/RubyKernel.java:1099
DEBUG[551a80fb]
DEBUG[551a80fb] start at /home/deployer/.rvm/gems/jruby-1.7.10@global/gems/bundler-1.7.3/lib/bundler/cli.rb:9
DEBUG[551a80fb]
DEBUG[551a80fb] eval at org/jruby/RubyKernel.java:1119
DEBUG[551a80fb]
DEBUG[551a80fb] (root) at /home/deployer/.rvm/gems/jruby-1.7.10@global/bin/jruby_executable_hooks:15
source 'https://rubygems.org'
ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.10'
gem 'bouncy-castle-java', '<= 1.50' # my attempt to fix the version of jruby-openssl
gem 'jruby-openssl', '0.9.5' # to 0.9.5. Tried with 0.9.3 but with no effect.
gem 'rails', '4.1.4'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'therubyrhino'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'activerecord-jdbcmysql-adapter'
gem 'devise'
gem 'devise_invitable', :github => 'scambra/devise_invitable'
gem "paperclip"
gem 'acts_as_list'
gem 'pry-rails', group: :development
gem 'rubyzip'
gem 'to_bool', '~> 1.0.1'
gem "jquery-fileupload-rails"
# Use Capistrano for deployment
gem 'capistrano', group: :development
gem 'capistrano-rvm', group: :development
gem 'capistrano-bundler', group: :development
gem 'capistrano-rails', group: :development
gem 'trinidad', require: false
gem 'trinidad_init_services', require: false
gem 'rvm1-capistrano3', require: false
deploy.rb:
# config valid only for Capistrano 3.1
lock '3.2.1'
set :bundle_flags, '--deployment' # tried removing switch deployment if installing as system gem helps
set :deploy_user, "deployer"
set :application, 'APPNAME'
set :repo_url, 'git@bitbucket.org:user/repo.git'
server "example.net", user: 'deployer', roles: [:web, :app, :db]
set :rvm_type, :user
set :rvm1_ruby_version, 'jruby-1.7.10'
set :scm, :git
set :pty, true
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:application)}"
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :keep_releases, 5
after "deploy", "deploy:cleanup"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
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
desc 'Delete shared bundle folder'
task :remove_shared_bundle do
on roles(:app), in: :sequence, wait: 5 do
execute :rm, "-fr", "#{shared_path}/bundle"
end
end
before :starting, :remove_shared_bundle
end
def template(from, to)
erb = File.read(File.expand_path("../config/recipes/templates/#{from}", File.dirname(__FILE__)))
# File.join(File.expand_path(File.dirname(__FILE__)), 'poi')
# put ERB.new(erb).result(binding), to
upload! StringIO.new(ERB.new(erb).result(binding)), to
end
namespace :deploy do
desc "Install everything onto the server"
task :install do
on roles(:all), in: :sequence, wait: 1 do
execute 'mkdir', '-p', fetch(:deploy_to)
execute :sudo, 'apt-get', '-y', "update"
execute :sudo, 'apt-get', '-y', "install", "build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev python-software-properties curl git-core openjdk-7-jdk jsvc"
end
end
end
看来错误的根源是雷神宝石。如果我删除共享目录中的bundle文件夹,那么它会安装所有gem。但下一次就失败了。使用“删除共享包”任务,我在每次部署之前都试图删除包文件夹,但每次部署都有效。但是,它每次都会重新安装,这需要时间
有解决这个问题的方法吗?我认为这个问题可能与JRuby的默认gems在1.7.10中不可更改有关 ... 它已经被修复了,所以立即要做的是尝试JRuby 1.7.15(或至少1.7.13)
我不想在Gemfile中声明
gem'jruby openssl','0.9.5'
(完全删除它)让jruby使用任何可用的东西-不知道是否有任何gem将其拉入,这也可以帮助(如果没有gem将其作为依赖项拉入捆绑包)在1.7.10下解决它。谢谢。升级到JRuby 1.7.15。这有助于消除这个错误。我也有同样的问题,但在jruby-1.7.15、1.7.16和1.7.18下也有同样的问题。