Skip bundle:install in Capistrano deploy

Hi everyone! It’s my first time working with Bedrock and I’m using Capistrano to deploy my local website on a shared server (yeah I know… not the best scenario, but it’s my client only option). I can ask the server admin to add some components if needed, but even if I just made him add bundler, I still get an error at the bundler:install deploy task.

00:11 bundler:install
01 /home/xxxxxx/bin/bundle install --path /home/xxxxxx/xxxxxx/shared/bundle --without development test --deployment --quiet
01 stdin: is not a tty
01 /opt/cpanel/ea-ruby24/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or direct…

Does that last line only means that ruby is nowhere to be found on the server? Can I skip this step and have an alternative to install what bundler is supposed to install?

Thanks for your advice!

I do not believe it is installed on the Trellis server:

ruby --version
The program 'ruby' is currently not installed. You can install it by typing:
apt install ruby

I’m not using a Trellis, so that’s the center of my issue actually. Ruby for sure is not installed (as any “ruby” command returns a “Command not found”) and probably won’t be installed.

That is why I’m wondering if deploying is possible without ruby.

Okay so I just managed to have Ruby installed (checked with ruby -v) but I still get the “/opt/cpanel/ea-ruby24/root/usr/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or direct…”

Ruby is installed… but I don’t understand why Capistrano is looking for it in the /opt/cpanel/ea-ruby24/root/usr/bin/ruby. Where is that path coming from? Can I override it in the deploy.rb?

And you did add Capistrano to your project’s Gemfile:

group :development do
  gem "capistrano", "~> 3.10"
end

and bundle install and bundle exec cap install? What does your deploy.rb look like?

Meaning having bundle exec cap install where?

The composer:run task seems to successfully complete (the one right before bundler:install)

My Gemfile contains:

group :deployment do
  gem 'capistrano', '~> 3.4'
  gem 'capistrano-composer'
  gem 'capistrano-wpcli'
  gem 'capistrano-bundler', '~> 1.1.2'
  gem 'capistrano-gulp', "~> 0.0.2"
end

and my deploy.rb configuration:

if fetch(:stage) == 'production'
  set :application, 'prod.xxxx.com'
else
  set :application, 'staging.xxxx.com'
end

SSHKit.config.command_map[:composer] = "/opt/cpanel/composer/bin/composer"
SSHKit.config.command_map[:bundle] = "/home/xxxx/bin/bundle"

set :repo_url, 'git@github.com:kevfulford/xxxx.git'
set :deploy_via, :copy

set :branch, :master
set :log_level, :info
set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')
set :tmp_dir, '/home/xxxx/tmp'

Just to confirm, you don’t need Ruby on the remote server. Capistrano just executes commands over SSH.

The issue here is you’re using capistrano-bundler. Do you have a reason for that? You’d only use that if you were deploying a Ruby project on the remote server which doesn’t apply for WordPress obviously.

Remove that gem and SSHKit.config.command_map[:bundle] = "/home/xxxx/bin/bundle" and you should be fine.

1 Like

Omg thank you so much Scott! You’re right, everything’s fine. I’m totally shocked that it was so simple… I honestly taught I needed capistrano-bundler to replicate what was on the local side, but I guess not.

I can finally move on :sweat_smile: