Error when deploying rails via Capistrano

36 Views Asked by At

I'm trying to deploy rails on a new server(Redhat 7.9). I'm getting error when running cap production deploy

errors

#<Thread:0x00007faacbcd7f58 /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
        23: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
        22: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/abstract.rb:31:in `run'
        21: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
        20: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/capistrano-3.18.0/lib/capistrano/scm/tasks/git.rake:9:in `block (3 levels) in eval_rakefile'
        19: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/netssh.rb:67:in `upload!'
        18: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/netssh.rb:177:in `with_ssh'
        17: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/connection_pool.rb:65:in `with'
        16: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/backends/netssh.rb:68:in `block in upload!'
        15: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-scp-4.0.0/lib/net/scp.rb:284:in `upload!'
        14: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/channel.rb:272:in `wait'
        13: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:179:in `loop'
        12: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:179:in `loop'
        11: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:179:in `block in loop'
        10: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:226:in `process'
         9: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/event_loop.rb:28:in `process'
         8: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/event_loop.rb:104:in `ev_preprocess'
         7: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/event_loop.rb:104:in `each'
         6: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:250:in `ev_preprocess'
         5: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:540:in `each_channel'
         4: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:540:in `each'
         3: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/session.rb:250:in `block in ev_preprocess'
         2: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-ssh-7.2.1/lib/net/ssh/connection/channel.rb:325:in `process'
         1: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-scp-4.0.0/lib/net/scp.rb:369:in `block (3 levels) in start_command'
/Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/net-scp-4.0.0/lib/net/scp.rb:398:in `await_response_state': Agent pid 48565 (Net::SCP::Error)
        1: from /Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/antarr/.rbenv/versions/2.7.7/lib/ruby/gems/2.7.0/gems/sshkit-1.21.7/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: Agent pid 48565 (SSHKit::Runner::ExecuteError)
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: Agent pid 48565


Caused by:
Net::SCP::Error: Agent pid 48565

Tasks: TOP => deploy:check => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as [email protected]: Agent pid 48565

logs/capistrano.log

  INFO ---------------------------------------------------------------------------
  INFO START 2024-01-03 12:52:27 -0600 cap production deploy
  INFO ---------------------------------------------------------------------------
 DEBUG [35d8b3c6] Running ~/.rvm/bin/rvm version as [email protected]
 DEBUG [35d8b3c6] Command: ~/.rvm/bin/rvm version
 DEBUG [35d8b3c6]   Agent pid 47067
 DEBUG [35d8b3c6]   Identity added: /home/deploy/.ssh/id_rsa (/home/deploy/.ssh/id_rsa)
 DEBUG [35d8b3c6]   Identity added: /home/deploy/.ssh/id_ed25519 (deploy@redhat1)
 DEBUG [35d8b3c6]   rvm 1.29.9-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
 DEBUG [35d8b3c6] Finished in 0.828 seconds with exit status 0 (successful).
 DEBUG [95839017] Running ~/.rvm/bin/rvm current as [email protected]
 DEBUG [95839017] Command: ~/.rvm/bin/rvm current
 DEBUG [95839017]   Agent pid 47225
 DEBUG [95839017]   Identity added: /home/deploy/.ssh/id_rsa (/home/deploy/.ssh/id_rsa)
 DEBUG [95839017]   Identity added: /home/deploy/.ssh/id_ed25519 (deploy@redhat1)
 DEBUG [95839017]   ruby-2.3.4
 DEBUG [95839017] Finished in 0.366 seconds with exit status 0 (successful).
 DEBUG [7bcae1b0] Running ~/.rvm/bin/rvm 2.7.7 do ruby --version as [email protected]
 DEBUG [7bcae1b0] Command: ~/.rvm/bin/rvm 2.7.7 do ruby --version
 DEBUG [7bcae1b0]   Agent pid 47377
 DEBUG [7bcae1b0]   Identity added: /home/deploy/.ssh/id_rsa (/home/deploy/.ssh/id_rsa)
 DEBUG [7bcae1b0]   Identity added: /home/deploy/.ssh/id_ed25519 (deploy@redhat1)
 DEBUG [7bcae1b0]   ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [x86_64-linux]
 DEBUG [7bcae1b0] Finished in 0.478 seconds with exit status 0 (successful).
  INFO [c5916c6b] Running /usr/bin/env mkdir -p /tmp as [email protected]
 DEBUG [c5916c6b] Command: /usr/bin/env mkdir -p /tmp
 DEBUG [c5916c6b]   Agent pid 47637
 DEBUG [c5916c6b]   Identity added: /home/deploy/.ssh/id_rsa (/home/deploy/.ssh/id_rsa)
 DEBUG [c5916c6b]   Identity added: /home/deploy/.ssh/id_ed25519 (deploy@redhat1)
  INFO [c5916c6b] Finished in 0.172 seconds with exit status 0 (successful).

config/deploy.rb

server '10.0.0.25', roles: %i[web app db], primary: true, user: 'deploy'

set :repo_url, '[email protected]:xxxxx/xxxxx.git'
set :application,     'rails application'
set :user,            'deploy'
set :puma_threads,    [4, 16]
set :puma_workers,    0
set :precompile_only_if_changed, true
set :conditionally_migrate, true
set :pty,             false
set :use_sudo,        false
set :stage,           :production
set :deploy_via,      :remote_cache
set :deploy_to,       "/home/#{fetch(:user)}/apps/#{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, {
  keys: %w(~/.ssh/id_ed25519),
  forward_agent: true,
  auth_methods: %w(publickey),
  user: "deploy"
}
set :puma_preload_app, true
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_enable_socket_service, true
set :puma_phased_restart, true
set :keep_assets, 5
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :rvm_type, :user
set :rvm_ruby_version, '2.7.7'
set :rvm_roles, [:app, :web, :db]

set :migration_role, :app
set :default_run_options, { pty: true }
set :linked_files, %w{.env.production config/database.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
0

There are 0 best solutions below