Bundler Error when attempting Capistrano Deployment - ruby-on-rails

I am attempting to deploy a ruby on rails web app to a staging server but continue to get the error: bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
I have attempted to install bundler on the server directly, and even after doing so it continues to fail with the same error. Full error log and deploy.rb below.
Full Log:
% cap staging deploy
[Deprecation Notice] Future versions of Capistrano will not load the Git SCM
plugin by default. To silence this deprecation warning, add the following to
your Capfile after `require "capistrano/deploy"`:
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
deploy#00.000.000.000's password:
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
ruby-2.7.0
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
00:00 git:wrapper
01 mkdir -p /home/deploy/tmp
✔ 01 deploy#00.000.000.000 0.313s
Uploading /home/deploy/tmp/git-ssh-Myapp-staging-marcuselmer.sh 100.0%
02 chmod 700 /home/deploy/tmp/git-ssh-Myapp-staging-marcuselmer.sh
✔ 02 deploy#00.000.000.000 0.276s
00:01 git:check
01 git ls-remote git#bitbucket.org:.../myApp.git HEAD
01 123abad2c0a3f9fa670259253608e11086661c6b HEAD
✔ 01 deploy#00.000.000.000 1.653s
00:02 deploy:check:directories
01 mkdir -p /home/deploy/apps/MYAPP/shared /home/deploy/apps/MYAPP/releases
✔ 01 deploy#00.000.000.000 0.278s
00:03 deploy:check:linked_dirs
01 mkdir -p /home/deploy/apps/MYAPP/shared/log /home/deploy/apps/MYAPP/shared/tmp/pids /home/deploy/apps/MYAPP/shared/tmp/cache /home/deploy/app…
✔ 01 deploy#00.000.000.000 0.319s
00:03 deploy:check:make_linked_dirs
01 mkdir -p /home/deploy/apps/MYAPP/shared/config
✔ 01 deploy#00.000.000.000 0.274s
00:04 git:clone
The repository mirror is at /home/deploy/apps/MYAPP/repo
00:05 git:update
01 git remote set-url origin git#bitbucket.org:.../myApp.git
✔ 01 deploy#00.000.000.000 0.314s
02 git remote update --prune
02 Fetching origin
02 From bitbucket.org:.../myApp
02 01e45c6b..123abad2 master -> master
✔ 02 deploy#00.000.000.000 1.901s
00:07 git:create_release
01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246
✔ 01 deploy#00.000.000.000 0.312s
02 git archive master | /usr/bin/env tar -x -f - -C /home/deploy/apps/MYAPP/releases/20201230174246
✔ 02 deploy#00.000.000.000 0.924s
00:09 deploy:set_current_revision
01 echo "123abad2c0a3f9fa670259253608e11086661c6b" >> REVISION
✔ 01 deploy#00.000.000.000 0.269s
00:09 deploy:symlink:linked_files
01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246/config
✔ 01 deploy#00.000.000.000 0.317s
02 ln -s /home/deploy/apps/MYAPP/shared/config/secrets.yml /home/deploy/apps/MYAPP/releases/20201230174246/config/secrets.yml
✔ 02 deploy#00.000.000.000 0.277s
00:11 deploy:symlink:linked_dirs
01 mkdir -p /home/deploy/apps/MYAPP/releases/20201230174246 /home/deploy/apps/MYAPP/releases/20201230174246/tmp /home/deploy/apps/MYAPP/releases…
✔ 01 deploy#00.000.000.000 0.307s
02 rm -rf /home/deploy/apps/MYAPP/releases/20201230174246/log
✔ 02 deploy#00.000.000.000 0.269s
03 ln -s /home/deploy/apps/MYAPP/shared/log /home/deploy/apps/MYAPP/releases/20201230174246/log
✔ 03 deploy#00.000.000.000 0.335s
04 ln -s /home/deploy/apps/MYAPP/shared/tmp/pids /home/deploy/apps/MYAPP/releases/20201230174246/tmp/pids
✔ 04 deploy#00.000.000.000 0.272s
05 rm -rf /home/deploy/apps/MYAPP/releases/20201230174246/tmp/cache
✔ 05 deploy#00.000.000.000 0.318s
06 ln -s /home/deploy/apps/MYAPP/shared/tmp/cache /home/deploy/apps/MYAPP/releases/20201230174246/tmp/cache
✔ 06 deploy#00.000.000.000 0.283s
07 ln -s /home/deploy/apps/MYAPP/shared/tmp/sockets /home/deploy/apps/MYAPP/releases/20201230174246/tmp/sockets
✔ 07 deploy#00.000.000.000 0.308s
08 ln -s /home/deploy/apps/MYAPP/shared/vendor/bundle /home/deploy/apps/MYAPP/releases/20201230174246/vendor/bundle
✔ 08 deploy#00.000.000.000 0.277s
09 ln -s /home/deploy/apps/MYAPP/shared/public/system /home/deploy/apps/MYAPP/releases/20201230174246/public/system
✔ 09 deploy#00.000.000.000 0.314s
10 ln -s /home/deploy/apps/MYAPP/shared/public/assets /home/deploy/apps/MYAPP/releases/20201230174246/public/assets
✔ 10 deploy#00.000.000.000 0.268s
00:19 bundler:install
01 ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet
01 /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by y…
01 To update to the latest version installed on your system, run `bundle update --bundler`.
01 To install the missing version, run `gem install bundler:1.16.1`
01 from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
01 from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
01 from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
01 from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy#00.000.000.000: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
Caused by:
SSHKit::Command::Failed: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy#00.000.000.000: bundle exit status: 1
bundle stdout: Nothing written
bundle stderr: /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
DEBUG [9486807a] Finished in 0.308 seconds with exit status 0 (successful).
DEBUG [5d323bc9] Running ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/MYAPP/shared/bundle as deploy#00.000.000.000
DEBUG [5d323bc9] Command: cd /home/deploy/apps/MYAPP/releases/20201230174246 && ~/.rvm/bin/rvm default do bundle check --path /home/deploy/apps/MYAPP/shared/bundle
DEBUG [5d323bc9] /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
DEBUG [5d323bc9] Finished in 0.648 seconds with exit status 1 (failed).
INFO [38f3d295] Running ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet as deploy#00.000.000.000
DEBUG [38f3d295] Command: cd /home/deploy/apps/MYAPP/releases/20201230174246 && ~/.rvm/bin/rvm default do bundle install --path /home/deploy/apps/MYAPP/shared/bundle --without development test --deployment --quiet
DEBUG [38f3d295] /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:275:in `find_spec_for_exe': Could not find 'bundler' (1.16.1) required by your /home/deploy/apps/MYAPP/releases/20201230174246/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:1.16.1`
from /home/deploy/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems.rb:294:in `activate_bin_path'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/bundle:30:in `<main>'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
from /home/deploy/.rvm/rubies/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
Deploy.rb
# config valid only for current version of Capistrano
lock "3.10.1"
set :application, "Myapp"
set :repo_url, 'git#bitbucket.org:…/myApp.git'
set :deploy_to, '/home/deploy/apps/myApp
set :linked_files, %w{config/secrets.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :tmp_dir, "/home/deploy/tmp"
set :branch, ENV['BRANCH'] if ENV['BRANCH']
set :user, "deploy"
# Default branch is :master
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
# Default deploy_to directory is /var/www/my_app_name
# set :deploy_to, "/var/www/my_app_name"
# Default value for :format is :airbrussh.
# set :format, :airbrussh
# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
# append :linked_files, "config/database.yml", "config/secrets.yml"
# Default value for linked_dirs is []
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config user.name`.chomp }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
task :start do
invoke 'bin/delayed_job:start'
end
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end
Server Info:
Ubuntu 20.04
Bundler is confirmed to be installed on the server.
Gem Info
Do I perhaps need to change the default version of bundler?
I can see the release folders get generated, but because of the failure no current sym_link is ever created and deployment fails. Is there a server setup step I'm missing for the initial cap deploy to a new staging server? Do I need to have bundler installed in a specific server location in order for cap to "find" it?

I was able to get past this blocker. The ultimate issue is that I had to log into the correct shell and run gem install bundler:1.16.1.
In order to log into the bash I used this command:
/bin/bash --login
Then run gem install:
gem install bundler:1.16.1

Related

Can't deploy with Capistrano - Issue with Capistrano rvm and bundler

Hi to everyone and thank you for coming to help, here is the issue, im trying to deploy a website with capistrano, the gems and dependencies where too updated so i had to update a lot of this website but no matter what i do i always get this error when trying to do a deploy with Bundle exec cap production deploy. Im using a AWS EC2 Ubuntu 16.04 server
I already did a reinstall of bundler, reinstall of ruby, restarted my terminal, capistrano/rvm and capistrano/bundler is added and required on Capfile
00:11 bundler:install
01 ~/.rvm/bin/rvm do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet
#<Thread:0x00000000017b12a8#/home/ubuntu/.rvm/gems/ruby-2.5.3#catalogIndustry/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /home/ubuntu/.rvm/gems/ruby-2.5.3#catalogIndustry/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/home/ubuntu/.rvm/gems/ruby-2.5.3#catalogIndustry/gems/sshkit-1.19.1/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as web#ec2-52-15-226-151.us-east-2.compute.amazonaws.com: bundle exit status: 1 (SSHKit::Runner::ExecuteError)
bundle stdout: `rvm do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` was removed, use `rvm 1.9.2,1.9.3 do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` or `rvm all do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` instead.
bundle stderr: Nothing written
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as web#ec2-52-15-226-151.us-east-2.compute.amazonaws.com: bundle exit status: 1
bundle stdout: `rvm do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` was removed, use `rvm 1.9.2,1.9.3 do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` or `rvm all do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` instead.
bundle stderr: Nothing written
Caused by:
SSHKit::Command::Failed: bundle exit status: 1
bundle stdout: `rvm do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` was removed, use `rvm 1.9.2,1.9.3 do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` or `rvm all do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` instead.
bundle stderr: Nothing written
Tasks: TOP => deploy:updated => bundler:install
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as web#ec2-52-15-226-151.us-east-2.compute.amazonaws.com: bundle exit status: 1
bundle stdout: `rvm do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` was removed, use `rvm 1.9.2,1.9.3 do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` or `rvm all do bundle install --path /home/web/apps/catalog/shared/bundle --jobs 4 --without development test --deployment --quiet` instead.
bundle stderr: Nothing written
** DEPLOY FAILED
** Refer to log/capistrano.log for details.
What else can i do to resolve this error and deploy the website?
Seems that Capistrano can't determine correct RVM ruby version. You can point it by hand
# deploy.rb
set :rvm_ruby_version, '2.5.3'
# or if you have single ruby version
set :rvm_ruby_version, 'default'

How to deploy an app with my fork of a package via Yarn and Capistrano?

I'm using Capistrano to deploy my Rails app.
assets:precompile fails because of using an old code. Why doesn't it use freshly installed yarn package?
I have forked #fancyapps/fancybox repo to solve this issue.
Touched one file.
Ran gulp task.
Pushed to my fork to the new branch called unquote-max-css-function
Now it's time to use it in my project.
Ran yarn upgrade git+ssh://git#github.com:light-flight/fancybox.git#unquote-max-css-function
Locally it works - all code bundles successfully. But in production it's using old assets during assets:precompile (see logs below).
I am sure Yarn bundled my repo because it had asked access rights before.
production error:
...
00:24 yarn:install
01 yarn install --production
01 yarn install v1.12.3
01 [1/4] Resolving packages...
01 [2/4] Fetching packages...
01 warning Pattern ["animate.css#latest"] is trying to unpack in the same destination "/home/deploy/.cache/yarn/v4/npm-animate-css-3.7.0-5de25d…
01 info fsevents#1.2.9: The platform "linux" is incompatible with this module.
01 info "fsevents#1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
01 [3/4] Linking dependencies...
01 warning "#rails/webpacker > pnp-webpack-plugin > ts-pnp#1.1.2" has unmet peer dependency "typescript#*".
01 warning " > webpack-dev-server#3.3.1" has unmet peer dependency "webpack#^4.0.0".
01 warning "webpack-dev-server > webpack-dev-middleware#3.6.2" has unmet peer dependency "webpack#^4.0.0".
01 [4/4] Building fresh packages...
01 Done in 15.13s.
00:41 deploy:assets:precompile
01 ~/.rvm/bin/rvm default do bundle exec rake assets:precompile
01 yarn install v1.12.3
01 [1/4] Resolving packages...
01 success Already up-to-date.
01 Done in 1.30s.
01 rake aborted!
01 SassC::SyntaxError: Error: "env(safe-area-inset-right)" is not a number for `max'
01 on line 11366 of stdin, in function `max`
01 from line 11366 of stdin
01 >> padding: 75px max(44px, env(safe-area-inset-right)) max(25px, env(safe-a
01 ------------------^
01 stdin:11366
01 /home/deploy/apps/app/shared/bundle/ruby/2.6.0/gems/sassc-2.0.1/lib/sassc/engine.rb:49:in `render'
01 /home/deploy/apps/app/shared/bundle/ruby/2.6.0/gems/sassc-rails-2.1.1/lib/sassc/rails/compressor.rb:29:in `call'
01 /home/deploy/apps/app/shared/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:28:in `call'
...
As you can see it tries to compile old code with unquoted max function.
Locally it compiles successfully:
$ rails assets:precompile
yarn install v1.15.2
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.42s.
I, [2019-05-05T13:02:34.620408 #10872] INFO -- : Writing /home/user/apps/app/public/assets/application-6f331dc14f50de04a8e7dd5d4c4882ffbf78cefc5ac4d73294ea48912d74a2a5.css
I, [2019-05-05T13:02:34.620871 #10872] INFO -- : Writing /home/user/apps/app/public/assets/application-6f331dc14f50de04a8e7dd5d4c4882ffbf78cefc5ac4d73294ea48912d74a2a5.css.gz
I've tried to yarn cache clean but nothing changed. How to force rails to use my fork?

Json -v 1.8.6 will not install as part of capistrano deploy

This question has been asked a couple of times on stackoverflow and other forums but I can't seem to get passed this error that I am getting. When I run capistrano production deploy, I get this error as part of the deploy process.
cap production bundler:install
00:00 bundler:install
01 bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployme…
01 An error occurred while installing json (1.8.6), and Bundler cannot continue.
01 Make sure that `gem install json -v '1.8.6'` succeeds before bundling.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as serv-deployer#oh-utility01.dc1.lan: bundle exit status: 5
bundle stdout: An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.
bundle stderr: Nothing written
Tasks: TOP => bundler:install
(See full trace by running task with --trace)
I've taken a look at my log/capistrano.log file and here are the relevant contents that I was looking at to trouble shoot.
# Logfile created on 2017-05-03 14:42:16 -0400 by logger.rb/54072
INFO ---------------------------------------------------------------------------
INFO START 2017-05-03 14:42:16 -0400 cap production bundler:install
INFO ---------------------------------------------------------------------------
DEBUG [ec1d281e] Running if test ! -d /var/local/blackduck_flock_rails/current; then echo "Directory does not exist '/var/local/blackduck_flock_rails/current'" 1>&2; false; fi as serv-deployer#oh-utility01.dc1.lan
DEBUG [ec1d281e] Command: if test ! -d /var/local/blackduck_flock_rails/current; then echo "Directory does not exist '/var/local/blackduck_flock_rails/current'" 1>&2; false; fi
DEBUG [ec1d281e] Finished in 0.328 seconds with exit status 0 (successful).
DEBUG [4f633904] Running /usr/bin/env bundle check --path /var/local/blackduck_flock_rails/shared/bundle as serv-deployer#oh-utility01.dc1.lan
DEBUG [4f633904] Command: cd /var/local/blackduck_flock_rails/current && /usr/bin/env bundle check --path /var/local/blackduck_flock_rails/shared/bundle
DEBUG [4f633904] Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
DEBUG [4f633904] The following gems are missing
* json (1.8.6)
* tzinfo (1.2.2)
* activesupport (4.2.6)
etc. etc..........
DEBUG [4f633904] * uglifier (3.0.4)
DEBUG [4f633904] Install missing gems with `bundle install`
DEBUG [4f633904] Finished in 0.179 seconds with exit status 1 (failed).
INFO [6c99e662] Running /usr/bin/env bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployment --quiet as serv-deployer#oh-utility01.dc1.lan
DEBUG [6c99e662] Command: cd /var/local/blackduck_flock_rails/current && /usr/bin/env bundle install --path /var/local/blackduck_flock_rails/shared/bundle --without development test --deployment --quiet
DEBUG [6c99e662] An error occurred while installing json (1.8.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.6'` succeeds before bundling.
So the first thing to note. The log is telling me that the running version of bundler is out of date and that I should install the newest one. Here is what I don't understand though. On my developing machine, I have Bundler version 1.14.6. On the targeting server that I am trying to deploy to, I also have Bundler version 1.14.6. I've confirmed it on both machines and they are indeed the same. Second, I have the same ruby versions for both developing machine and target machine. The ruby version is 2.2.5.
Second, when I run gem list on the target server, I can see that json 1.8.6 is installed.
json (1.8.3, 1.8.1)
What gives?
Finally, the problem has to be in this directory on the target machine /var/local/blackduck_flock_rails/shared/bundle. Inside the bundle directory, I have a ruby folder that has 1.9.1 and 2.2.0. Could this be the source of the problem. I'm stumped on this one and it seems that questions like these always relate to something specific on someone's machine that won't necessarily be applied. Help would be greatly appreciated.
The most probable cause is you're missing some system dependencies that capistrano cannot install.
Ssh to your server and try installing sudo apt-get install libgmp3-dev
If it doesn't fix the problem, ssh again and run the gem install json -v '1.8.6' as it tells you and post the error message you get from it here.

Ruby version error on deployment with capistrano

I am getting ' Your Ruby version is 2.3.3, but your Gemfile specified 2.0.0' when I am trying to deploy with Capistrano.
my gemfile specifying 2.3.3
ruby "2.3.3"
00:27 bundler:install
01 /usr/local/rvm/bin/rvm 2.3.3 do bundle install --path /var/www/mypath/shared/bundle --without development test --deployment --quiet
01 Warning, new version of rvm available '1.29.1', you are using older version '1.29.0'.
01 You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
01 You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
01 Your Ruby version is 2.3.3, but your Gemfile specified 2.0.0
Don't know what the problem is from looking at this, but here is how I would debug it.
Check your Gemfile and Gemfile.lock and verify it is showing 2.3.3. Also Capistrano pulls directly from the repository rather than uploading your local files so verify your Gemfile and Gemfile.lock on the remote machine have the right versions. If they don't, verify you have committed the latest Gemfile and Gemfile.lock and pushed them up to your repository. You can also try just running bundle on the remote machine to take Capistrano out of the equation.

Bundler requires different ruby version on deploying with Capistrano

I defined ruby version 2.0.0-p645 in .ruby_version file
cap production deploy stops with bundler error:
INFO [11dd01a8] Running /usr/local/rvm/bin/rvm default do bundle install --path /var/www/p4-site/shared/bundle --without development test --deployment --quiet on p4-ocean
DEBUG [11dd01a8] Command: cd /var/www/p4-site/releases/20160206090913 && /usr/local/rvm/bin/rvm default do bundle install --path /var/www/p4-site/shared/bundle --without development test --deployment --quiet
DEBUG [11dd01a8] ruby-2.0.0-p481 is not installed.
DEBUG [11dd01a8] To install do: 'rvm install ruby-2.0.0-p481'
DEBUG [11dd01a8] /usr/local/rvm/scripts/set: line 19: exec: bundle: not found
(Backtrace restricted to imported tasks)
Gemfile doesn't contain ruby command
.bundle/config file contains
---
BUNDLE_WITHOUT: production
Where does bundler store ruby version 2.0.0-p481 ?

Resources