You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to deploy a project with jruby-9.0.5.0 via capistrano 3 to a server, but had no luck so far. I have already deployed two standard Rails applications to the server, where both use Ruby 2.3.0. And I can run the Rails app locally using JRuby. But for some reason the deployment does not work with JRuby.
If a execute the following command:
bundle exec cap production deploy:check --trace
I get the following result:
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke rvm:hook (first_time)
** Execute rvm:hook
** Invoke rvm:check (first_time)
** Execute rvm:check
DEBUG [96921958] Running ~/.rvm/bin/rvm version as <username>@<ip-address>
DEBUG [8915a631] Running ~/.rvm/bin/rvm version on autolook.co
DEBUG [8915a631] Command: ~/.rvm/bin/rvm version
DEBUG [96921958] Command: ~/.rvm/bin/rvm version
DEBUG [96921958] rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
DEBUG [96921958] Finished in 4.735 seconds with exit status 0 (successful).
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
DEBUG [fd405365] Running ~/.rvm/bin/rvm current as <username>@<ip-address>
DEBUG [fd405365] Command: ~/.rvm/bin/rvm current
DEBUG [fd405365] ruby-2.3.0
DEBUG [fd405365] Finished in 0.154 seconds with exit status 0 (successful).
ruby-2.3.0
DEBUG [7e894efa] Running ~/.rvm/bin/rvm jruby-9.0.5.0 do ruby --version as <username>@<ip-address>
DEBUG [7e894efa] Command: ~/.rvm/bin/rvm jruby-9.0.5.0 do ruby --version
DEBUG [7e894efa] jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d OpenJDK 64-Bit Server VM 25.66-b17 on 1.8.0_66-internal-b17 +jit [linux-amd64]
DEBUG [7e894efa] Finished in 0.317 seconds with exit status 0 (successful).
jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d OpenJDK 64-Bit Server VM 25.66-b17 on 1.8.0_66-internal-b17 +jit [linux-amd64]
cap aborted!
Errno::EBADF: Bad file descriptor - No message available
org/jruby/RubyIO.java:1953:in `close'
~/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/socket.rb:68:in `connect_internal'
~/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/socket.rb:140:in `connect'
~/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/socket.rb:336:in `block in tcp'
org/jruby/RubyArray.java:1560:in `each'
~/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/socket.rb:232:in `foreach'
~/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/socket.rb:328:in `tcp'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/net-ssh-3.0.2/lib/net/ssh/transport/session.rb:70:in `initialize'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/net-ssh-3.0.2/lib/net/ssh.rb:225:in `start'
org/jruby/RubyProc.java:318:in `call'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/connection_pool.rb:95:in `create_new_entry'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/connection_pool.rb:38:in `checkout'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/netssh.rb:134:in `with_ssh'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/netssh.rb:87:in `execute_command'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/abstract.rb:121:in `block in create_command_and_execute'
org/jruby/RubyKernel.java:1754:in `tap'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/abstract.rb:121:in `create_command_and_execute'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/abstract.rb:39:in `capture'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:9:in `block in (root)'
org/jruby/RubyBasicObject.java:1670:in `instance_exec'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/backends/abstract.rb:15:in `run'
~/.rvm/gems/jruby-9.0.5.0@rails425/gems/sshkit-1.8.1/lib/sshkit/runners/parallel.rb:13:in `block in execute'
Tasks: TOP => rvm:check
There seems to be a problem with ssh, but I am not sure what to do, because the following error is not saying that much about the root of the problem:
Errno::EBADF: Bad file descriptor - No message available
This is my Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use jdbcsqlite3 as the database for Active Record
gem 'activerecord-jdbcsqlite3-adapter'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyrhino'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails-i18n', '~> 4.0', '>= 4.0.8'
gem 'haml-rails', '~> 0.9.0'
gem 'font-awesome-rails', '~> 4.5'
gem "recaptcha", '~> 1.0', require: "recaptcha/rails"
# You only need this RC version constraint during the development of `3.0.0`, once stable version is released you can remove `rc11` suffix
# `3.0.0.rc11` is the latest version of released RC version when this entry is changed, you might want to change it later
gem "i18n-js", ">= 3.0.0.rc11"
gem 'highline', '~> 1.7', '>= 1.7.8'
platform :jruby do
gem 'puma', '~> 2.16'
gem 'jruby-openssl', '~> 0.9.4'
end
group :development, :test do
gem 'capistrano', require: false
gem 'capistrano-rvm', require: false
gem 'capistrano-rails', require: false
gem 'capistrano-bundler', require: false
gem 'capistrano3-puma', require: false
end
group :development do
# # Access an IRB console on exception pages or by using <%= console %> in views
# gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
This is my Capfile:
# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
require 'capistrano/puma'
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
And here is my deploy.rb:
# config valid only for current version of Capistrano
lock '3.4.0'
# Change these
# server 'your_server_ip', port: your_port_num, roles: [:web, :app, :db], primary: true
hl = HighLine.new
set :password, hl.ask('Please type server password (will not be shown):'){ |q| q.echo = false }
server "<my server IP address>",
user: "<server username>",
roles: %w{web app db},
password: fetch(:password),
ssh_options: {
forward_agent: true,
paranoid: true,
keys: [File.join(ENV["HOME"], ".ssh", "id_rsa")]
}
set :repo_url, 'git@bitbucket.org:<my username>/<my project name>.git'
set :application, '<my project name>'
set :domain, '<my project name>.com'
set :user, '<server username>'
set :puma_threads, [4, 16]
set :puma_workers, 0
# Don't change these unless you know what you're doing
set :pty, true
set :use_sudo, false
set :stage, :production
set :deploy_via, :remote_cache
set :deploy_to, "/home/<server username>/www/#{fetch(:application)}"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_access_log, "#{release_path}/log/puma.error.log"
set :puma_error_log, "#{release_path}/log/puma.access.log"
set :ssh_options, { forward_agent: true, user: fetch(:user), keys: %w(~/.ssh/id_rsa.pub) }
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, true # Change to false when not using ActiveRecord
# SCM
set :scm, :git
set :branch, :master
set :format, :pretty
set :log_level, :debug
set :keep_releases, 10
# deploy.rb or stage file (staging.rb, production.rb or else)
set :rvm_type, :user # Defaults to: :auto
set :rvm_ruby_version, 'jruby-9.0.5.0' # Defaults to: 'default'
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
set :bundle_roles, :user
role :web, fetch(:domain) # Your HTTP server, Apache/etc
role :app, fetch(:domain) # This may be the same as your `Web` server
role :db, fetch(:domain), :primary => true # This is where Rails migrations will run
namespace :puma do
desc 'Create Directories for Puma Pids and Socket'
task :make_dirs do
on roles(:app) do
execute "mkdir #{shared_path}/tmp/sockets -p"
execute "mkdir #{shared_path}/tmp/pids -p"
end
end
before :start, :make_dirs
end
namespace :deploy do
desc "Make sure local git is in sync with remote."
task :check_revision do
on roles(:app) do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
end
desc 'Initial Deploy'
task :initial do
on roles(:app) do
before 'deploy:restart', 'puma:start'
invoke 'deploy'
end
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
invoke 'puma:restart'
end
end
before :starting, :check_revision
after :finishing, :compile_assets
after :finishing, :cleanup
after :finishing, :restart
end
I appreciate any help.
Thx!
The text was updated successfully, but these errors were encountered:
Hi,
I am trying to deploy a project with jruby-9.0.5.0 via capistrano 3 to a server, but had no luck so far. I have already deployed two standard Rails applications to the server, where both use Ruby 2.3.0. And I can run the Rails app locally using JRuby. But for some reason the deployment does not work with JRuby.
If a execute the following command:
bundle exec cap production deploy:check --trace
I get the following result:
There seems to be a problem with ssh, but I am not sure what to do, because the following error is not saying that much about the root of the problem:
Errno::EBADF: Bad file descriptor - No message available
This is my Gemfile:
This is my Capfile:
And here is my deploy.rb:
I appreciate any help.
Thx!
The text was updated successfully, but these errors were encountered: