capistrano / rails

Official Ruby on Rails specific tasks for Capistrano
http://www.capistranorb.com/
MIT License
867 stars 270 forks source link

Capistrano fail to deploy rails app due to incompatibility with OpenSSL 3.0 #256

Closed agordillo closed 2 years ago

agordillo commented 2 years ago

I have a rails application with Rails 7 and Ruby 3 support, which is working well in my development machine with Ubuntu 22.04, ruby 3.0.2p107 and Rails 7.0.2.3. Now I'm trying to set up Capistrano (version 3.17.0) in order to deploy the rails app to a server with Ubuntu 22.04. However, I'm unable to do so due to the following error: SSHKit::Runner::ExecuteError: Exception while executing as username@server: rsa#set_key= is incompatible with OpenSSL 3.0

It seems that Capistrano is no compatible with OpenSSL 3.0, which is the default OpenSSL library in Ubuntu 22.04. I guess it's a bug, but I did not find any information about it. I did not find any workaround either.


Steps to reproduce

In a machine with Ubuntu 22.04, Ruby 3 and OpenSSL 3.0, create a rails application with the following dependencies:

gem 'bundler', '2.3.12' gem 'rails', '= 7.0.2.3' group :development do gem 'capistrano', '3.17.0', require: false gem 'capistrano-rails', '1.6.2', require: false gem 'capistrano-passenger', '0.2.1', require: false gem 'capistrano-bundler', '2.0.1', require: false end

Capifythe application, set up the capistrano configuration files, set up the server and execute: bundle exec cap production deploy

Expected behavior

Successful deployment

Actual behavior

Successful failed due to the following error: SSHKit::Runner::ExecuteError: Exception while executing as username@server: rsa#set_key= is incompatible with OpenSSL 3.0

System configuration (app name, username, server name and repo URL have been replaced for generic names)

Environment Ruby ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu] Rubygems 3.3.5 Bundler 2.3.12 Command /usr/local/bin/cap production doctor

Gems capistrano 3.17.0 airbrussh 1.4.0 rake 13.0.6 sshkit 1.21.2 net-ssh 6.1.0 capistrano-bundler 2.0.1 capistrano-passenger 0.2.1 capistrano-rails 1.6.2

Variables :application "appname" :assets_manifests [#<Pathname:/u/apps/appname/current/public/assets/.sprockets-manifest>, #<Pathname:/u/apps/appname/current/public/assets/manifest.*>] :assets_prefix "assets" :assets_roles [:web] :branch "master" :bundle_bins ["gem", "rake", "rails"] :bundle_binstubs nil :bundle_check_before_install true :bundle_clean_options "" :bundle_config {:deployment=>true} :bundle_env_variables {} :bundle_flags "--quiet" :bundle_gemfile nil :bundle_jobs 4 :bundle_path #<Pathname:/u/apps/appname/shared/bundle> :bundle_roles :all :bundle_servers [#<Capistrano::Configuration::Server:0x00005627a1bd8610 @keys=[], @local=false, @user="username", @hostname="server", @port=nil, @properties=#<Capistrano::Configuration::Server::Properties:0x00005627a1c87e08 @properties={}, @roles=#<Set: {:app, :db, :web}>>>] :bundle_without "development:test" :conditionally_migrate false :default_env {} :deploy_to "/u/apps/appname" :format :airbrussh :git_environmental_variables {:git_askpass=>"/bin/echo", :git_ssh=>"/tmp/git-ssh-131be5aa76fa8900b50a.sh"} :git_max_concurrent_connections 10 :git_shallow_clone false :git_wait_interval 0 :git_wrapper_path "/tmp/git-ssh-131be5aa76fa8900b50a.sh" :keep_releases 3 :linked_dirs ["public/assets"] :local_user "username" :log_level :debug :migration_command "db:migrate" :migration_role :db :migration_servers #<Capistrano::Configuration::Server:0x00005627a1bd8610 @keys=[], @local=false, @user="username", @hostname="server", @port=nil, @properties=#<Capistrano::Configuration::Server::Properties:0x00005627a1c87e08 @properties={}, @roles=#<Set: {:app, :db, :web}>>> :passenger_environment_variables {} :passenger_restart_command "passenger-config restart-app" :passenger_restart_limit 2 :passenger_restart_options "/u/apps/appname --ignore-app-not-running" :passenger_restart_runner :sequence :passenger_restart_wait 5 :passenger_restart_with_sudo false :passenger_roles :app :passenger_rvm_ruby_version nil :pty true :rails_env :production :repo_url "git@github.com:..." :stage :production :tmp_dir "/tmp"

Servers (1) username@server [:app, :db, :web]

agordillo commented 2 years ago

The reported issue was due to the rails net-ssh gem not supporting OpenSSL 3.0. Fortnunately, a new version of the net-ssh gem (7.0.0.beta1) was released yesterday providing OpenSSL 3.0 support and hence fixing the issue. So, this issue can be closed.