meumobi / yahooStocksService

0 stars 0 forks source link

% bundle exec cap integration deploy failed #9

Open vdias38 opened 2 years ago

vdias38 commented 2 years ago
vdias38@MacBook-Pro-de-Victor yahooStocksService % bundle install --path vendor/bundle                        (master)yahooStocksService
Fetching gem metadata from http://rubygems.org/.....
Fetching rake 10.3.2
Installing rake 10.3.2
Using bundler 1.17.2
Fetching i18n 0.6.11
Installing i18n 0.6.11
Fetching colorize 0.7.3
Installing colorize 0.7.3
Fetching net-ssh 2.9.1
Installing net-ssh 2.9.1
Fetching net-scp 1.2.1
Installing net-scp 1.2.1
Fetching sshkit 1.5.1
Installing sshkit 1.5.1
Fetching capistrano 3.2.1
Installing capistrano 3.2.1
Bundle complete! 1 Gemfile dependency, 8 gems now installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from capistrano:
Capistrano 3.1 has some breaking changes, like `deploy:restart` callback should be added manually to your deploy.rb. Please, check the CHANGELOG: http://goo.gl/SxB0lr

If you're upgrading Capistrano from 2.x, we recommend to read the upgrade guide: http://goo.gl/4536kB
vdias38@MacBook-Pro-de-Victor yahooStocksService % bundle exec cap integration deploy                         (master)yahooStocksService
INFO[4ad119ad] Running /usr/bin/env mkdir -p /tmp/services-meumobi/ on vps-4316bebe.vps.ovh.net
DEBUG[4ad119ad] Command: /usr/bin/env mkdir -p /tmp/services-meumobi/
/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:67: warning: Object#timeout is deprecated, use Timeout.timeout instead.
/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:84: warning: Object#timeout is deprecated, use Timeout.timeout instead.
/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/cipher_factory.rb:101: warning: constant OpenSSL::Cipher::Cipher is deprecated
#<Thread:0x00007f8eb5ad02c8@/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    26: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
    25: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
    24: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
    23: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
    22: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
    21: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
    20: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
...
     2: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/algorithms.rb:357:in `new'
     1: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb:51:in `initialize'
/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb:118:in `generate_key': undefined method `p=' for #<OpenSSL::PKey::DH:0x00007f8eb5a12430> (NoMethodError)
Did you mean?  p
    26: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
    25: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
    24: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
...
     3: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/algorithms.rb:357:in `exchange_keys'
     2: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/algorithms.rb:357:in `new'
     1: from /Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb:51:in `initialize'
/Users/vdias38/Dvpt/PROJECTS/yahooStocksService/vendor/bundle/ruby/2.6.0/gems/net-ssh-2.9.1/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb:118:in `generate_key': Exception while executing on host vps-4316bebe.vps.ovh.net: undefined method `p=' for #<OpenSSL::PKey::DH:0x00007f8eb5a12430> (SSHKit::Runner::ExecuteError)
Did you mean?  p
cap aborted!
...
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing on host vps-4316bebe.vps.ovh.net: undefined method `p=' for #<OpenSSL::PKey::DH:0x00007f8eb5a12430>
Did you mean?  p>
vdias38 commented 2 years ago

https://rubygems.org/gems/bundler/versions On deploy we use gem v1.17 released on October 25, 2018, latest version is 2.3.11 - April 07, 2022

debian@vps-4316bebe:~$ gem list
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).

*** LOCAL GEMS ***

bigdecimal (1.1.0)
bundler (1.17.0, default: 1.16.6)
bundler-unload (1.0.2)
executable-hooks (1.6.1)
gem-wrappers (1.4.0)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
passenger (6.0.13, 6.0.2)
rack (1.6.11)
rake (0.9.2.2)
rdoc (3.9.5)
rubygems-bundler (1.4.5)
rvm (1.11.3.9)
debian@vps-4316bebe:~$ ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
meumobi@vps-4316bebe:/home/debian$ ssh -T git@github.com
Hi vdias38! You've successfully authenticated, but GitHub does not provide shell access
vdias38 commented 2 years ago

Setting up SSH Keys

We’ll be using SSH Keys for authorization. First shake hands with GitHub, the Git Remote where the codebase is hosted.

deploy$ ssh -T git@github.com
Hi vdias38! You've successfully authenticated, but GitHub does not provide shell access.

Don’t worry if you get a Permission denied (publickey) message. Check if you have a SSH key (a Public/Private Key Pair) for your server, should be saved as ~/.ssh/id_rsa (private key) and ~/.ssh/id_rsa.pub (public key). I you don't have a SSH key generate one:

deploy$ ssh-keygen -t rsa 

Add the public key (~/.ssh/id_rsa.pub) to your repository’s deployment keys:

Instructions for Github

If all the steps were completed correctly, you should now be able to clone your git repository (over the SSH Protocol, not HTTP) without entering your password:

deploy$ git clone git@github.com:meumobi/yahooStocksService.git

The git clone command will create a directory with the same name as your app.

We are cloning only to check if our deployment keys are working, we don’t need to clone or pull our repository every time we push new changes. We’ll let Capistrano handle all that for us. You can now delete this cloned directory if you want to.

Open a terminal on your local machine. If you don’t have a SSH Key for your local computer, create one for it as well, and add your local SSH Key to your server Authorized Keys file:

local$ scp ~/.ssh/id_rsa.pub deploy@vps-4316bebe.vps.ovh.net:~/.ssh/authorized_keys

Adding Deployment Configurations

On your local machine, create configuration for Capistrano. Start by adding these lines to the Gemfile on root App:

source 'https://rubygems.org'

group :development do
    gem 'capistrano',         require: false
    gem 'capistrano-rvm',     require: false
    gem 'capistrano-bundler', require: false
end

Use bundler to install the gems you just specified in your Gemfile. Enter the following command to bundle your App:

local$ bundle install --path vendor/bundle
Using rake 13.0.6
Using net-ssh 6.1.0
Using net-scp 3.0.0
Using sshkit 1.21.2
Using airbrussh 1.4.0
Using bundler 1.17.2
Using concurrent-ruby 1.1.10
Using i18n 1.10.0
Using capistrano 3.17.0
Using capistrano-bundler 2.0.1
Using capistrano-rvm 0.1.2
Bundle complete! 3 Gemfile dependencies, 11 gems now installed.
Bundled gems are installed into `./vendor/bundle`

After bundling, run the following command to configure Capistrano:

local$ bundle exec cap install

This will create:

Replace the contents of your Capfile with the following:

# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

require 'capistrano/bundler'
require 'capistrano/rvm'
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

This Capfile loads some pre-defined tasks in to your Capistrano configuration files to make your deployments hassle-free, such as automatically:

You can list available tasks:

local$ bundle exec cap -T 
cap bundler:clean                  # Remove unused gems installed by bundler
cap bundler:config                 # Configure the Bundler environment for the release so that subequent
cap bundler:install                # Install the current Bundler environment
cap bundler:map_bins               # Maps all binaries to use `bundle exec` by default
cap deploy                         # Deploy a new release
cap deploy:check                   # Check required files and directories exist
...
cap doctor                         # Display a Capistrano troubleshooting report (all doctor: tasks)
cap doctor:environment             # Display Ruby environment details
cap doctor:gems                    # Display Capistrano gem versions
cap doctor:servers                 # Display the effective servers configuration
cap doctor:variables               # Display the values of all Capistrano variables
cap git:check                      # Check that the repository is reachable
cap git:clone                      # Clone the repo to the cache
cap git:create_release             # Copy repo to releases
cap git:set_current_revision       # Determine the revision that will be deployed
cap git:update                     # Update the repo mirror to reflect the origin state
cap git:wrapper                    # Upload the git wrapper script, this script guarantees that we can script git without getting an...
cap install                        # Install Capistrano, cap install STAGES=staging,production
cap rvm:check                      # Prints the RVM and Ruby version on the target host

Replace the contents of config/deploy.rb with the following:

# config valid for current version and patch releases of Capistrano
lock "~> 3.17.0"

set :application, "yahooStocksService"
set :repo_url, 'git@github.com:meumobi/yahooStocksService.git'

# Default branch is :master, else `bundle exec cap meumobi-03 deploy BRANCH=chore/upgrade-cap `
set :branch, ENV['BRANCH'] || 'master'

And create a custom config for each stage you need, for example config/deploy/production.rb:

role :app, %w{vps-4316bebe.vps.ovh.net}
set :deploy_to, '/home/meumobi/PROJECTS/services.meumobi.com'

set :ssh_options, {
  user: 'meumobi'
}

You can set any configuration variable like in config/deploy.rb. These variables are then only loaded and set in this stage.

Furthermore