Unable to deploy rails application using capistrano, bundle not found

iit2011081

I am trying to deploy my rails application using capistrano but it is giving me "bundle stdout: /home/deploy/.rvm/scripts/set: line 19: exec: bundle: not found" error. I have installed bundler gem on the server still capistrano unable to find bundle.

Capfile content:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/rails/assets' # for asset handling add
require 'capistrano/rails/migrations' # for running migrations
require 'capistrano/puma'
require 'capistrano/rake'

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

Deploy.rb content :

lock '3.10.0'

set :application, 'app_name'
set :repo_url, 'my-repo-url' # Edit this to match your repository
set :branch, :branch_name
set :deploy_to, '/home/deploy/app_name'
set :pty, true
set :linked_files, %w{config/database.yml config/application.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/uploads}
set :keep_releases, 3
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.3.1' # Edit this if you are using MRI Ruby

set :puma_rackup, -> { File.join(current_path, 'config.ru') }
set :puma_state, "#{shared_path}/tmp/pids/puma.state"
set :puma_pid, "#{shared_path}/tmp/pids/puma.pid"
set :puma_bind, "unix://#{shared_path}/tmp/sockets/puma.sock"    #accept array for multi-bind
set :puma_conf, "#{shared_path}/puma.rb"
set :puma_access_log, "#{shared_path}/log/puma_error.log"
set :puma_error_log, "#{shared_path}/log/puma_access.log"
set :puma_role, :app
set :puma_threads, [0, 16]
set :puma_workers, 0
set :puma_worker_timeout, nil
set :puma_init_active_record, true
set :puma_preload_app, false
set :puma_prune_bundler, true

namespace :deploy do
    desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      invoke 'puma:restart'
    end
  end

  after  :finishing,    :compile_assets
  after  :finishing,    :cleanup
  after  :finishing,    :restart
end

Production.rb content :

server 'My-IP', user: 'deploy', roles: %w{web app db}
set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production'))
yeuem1vannam

When deploying a Rails app using capistrano with rvm, you have to be careful that capistrano will switch the ruby version, and it might not the same ruby version as you see.

You can ssh to the remote server and check yourself

ssh deploy@My-IP
ruby -v        # It's probably not 2.3.1
which bundle
rvm use 2.3.1  # This is the actual version that will be used by capistrano
which bundle

If you cannot see the bundle installed within ruby-2.3.1, you can manually install it by

rvm use 2.3.1
gem install bundler

After that, the capistrano deployment should work as expected.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

bundle error in deploying rails using capistrano

From Dev

deploy rails app using capistrano or aws opsworks?

From Dev

Capistrano deploy a rails app

From Dev

Copy Figaro's application.yml with Capistrano Deploy - Rails

From Dev

Copy Figaro's application.yml with Capistrano Deploy - Rails

From Dev

Unable to deploy API bundle on Apigee using Maven

From Dev

Unable to deploy the osgi bundle using auto-deploy profile(cqblueprints)

From Dev

Issue with bitbucket repository to deploy rails app using capistrano

From Dev

Issue with bitbucket repository to deploy rails app using capistrano

From Dev

Skip database migration while deploying Rails application using Capistrano 3

From Dev

Capistrano error while deploy (command not found: sneakersctl)

From Dev

Can I use latest Capistrano which requires ruby >2, to deploy Rails application that requires ruby 1.9.3?

From Dev

Using Carrierwave and Capistrano with Rails

From Dev

Unable to deploy through capistrano after ubuntu upgrade

From Dev

Rails - Bundle: command not found

From Dev

Deploy rails app with capistrano rbenv unicorn

From Dev

Capistrano / Rails 3.2.14 / Sprockets - not finalizing deploy in production

From Dev

Rails assets missing after Capistrano deploy

From Dev

Deploy rails appli with capistrano from mac with SVN

From Dev

Rails 4, Capistrano 3 and Dotenv - How to deploy using server-side .env file

From Dev

How to execute bundle command from Capistrano deploy script

From Dev

bundle install failed but still stop sidekiq when use capistrano deploy

From Dev

Bundle command not found while deploying rails app in aws using mina

From Dev

Unable to deploy HoloLens application

From Dev

Ruby deploy to localhost using Capistrano issue

From Dev

Errors during deploying rails application to server while using bundle install

From Dev

Unable to deploy using Windows Phone Application Deployment (8.1) tool

From Dev

Rails Capistrano - SSHKit::Command::Failed: bundle exit status: 16

From Dev

Rails 4, capistrano error: cannot load such file -- deploy/assets

Related Related

  1. 1

    bundle error in deploying rails using capistrano

  2. 2

    deploy rails app using capistrano or aws opsworks?

  3. 3

    Capistrano deploy a rails app

  4. 4

    Copy Figaro's application.yml with Capistrano Deploy - Rails

  5. 5

    Copy Figaro's application.yml with Capistrano Deploy - Rails

  6. 6

    Unable to deploy API bundle on Apigee using Maven

  7. 7

    Unable to deploy the osgi bundle using auto-deploy profile(cqblueprints)

  8. 8

    Issue with bitbucket repository to deploy rails app using capistrano

  9. 9

    Issue with bitbucket repository to deploy rails app using capistrano

  10. 10

    Skip database migration while deploying Rails application using Capistrano 3

  11. 11

    Capistrano error while deploy (command not found: sneakersctl)

  12. 12

    Can I use latest Capistrano which requires ruby >2, to deploy Rails application that requires ruby 1.9.3?

  13. 13

    Using Carrierwave and Capistrano with Rails

  14. 14

    Unable to deploy through capistrano after ubuntu upgrade

  15. 15

    Rails - Bundle: command not found

  16. 16

    Deploy rails app with capistrano rbenv unicorn

  17. 17

    Capistrano / Rails 3.2.14 / Sprockets - not finalizing deploy in production

  18. 18

    Rails assets missing after Capistrano deploy

  19. 19

    Deploy rails appli with capistrano from mac with SVN

  20. 20

    Rails 4, Capistrano 3 and Dotenv - How to deploy using server-side .env file

  21. 21

    How to execute bundle command from Capistrano deploy script

  22. 22

    bundle install failed but still stop sidekiq when use capistrano deploy

  23. 23

    Bundle command not found while deploying rails app in aws using mina

  24. 24

    Unable to deploy HoloLens application

  25. 25

    Ruby deploy to localhost using Capistrano issue

  26. 26

    Errors during deploying rails application to server while using bundle install

  27. 27

    Unable to deploy using Windows Phone Application Deployment (8.1) tool

  28. 28

    Rails Capistrano - SSHKit::Command::Failed: bundle exit status: 16

  29. 29

    Rails 4, capistrano error: cannot load such file -- deploy/assets

HotTag

Archive