Bundler error when trying to deploy with Capistrano - ruby-on-rails

I am trying to deploy to a remote VPS via Capistrano 3. The VPS tuns on Ubuntu 12.04, Apache, and rvm. When I use cap production deploy on my local computer, it begins to deploy, but then throws a bundler error and quits:
An error occurred while installing minitest (4.7.5), and Bundler cannot continue.
See here for documentation: https://gist.github.com/atkolkma/9551199
gem install minitest -v 4.7.5
Executes successfully. But if I run
gem -v minitest
It says I have version 2.2.2 ! This happens on BOTH machines. Could it be rvm that is doing this? A bundler issue? I have no idea.
UPDATE: I installed RVM, Ruby and Rails as root on the VPS. I am pretty sure this was causing permissions or path problems for Capistrano when trying to bundle my project. I will try to rebuild the VPS with a deployer or rails user. I'll update when I solve this problem.

UPDATE: I installed RVM, Ruby and Rails as root on the VPS. I am pretty sure this was causing permissions or path problems for Capistrano when trying to bundle my project. I will try to rebuild the VPS with a deployer or rails user. I'll update when I solve this problem.

Related

Ruby missing psych for YAML ouput

I created a Rails/React app with Webpacker on my Mac running Ruby 2.5.3 and it runs without issue. However when I clone it to my Ubuntu 18.04 machine, I get the below error :
/usr/lib/ruby/2.5.0/yaml.rb:5: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
My Ubuntu machine is also running Ruby 2.5.3, so I'm confused why it references 2.5.0 in the error.
I am able to launch the Rails server with rails s, but when I try to launch the full app with foreman start -f Procfile.dev, I get the error. I've tried reinstalling libyaml and all the Ruby versions on my machine with RVM with no impact on the error. I've also changed my local Ruby version to 2.5.0, and I get a different error message about how my machine is running Ruby 2.5.0 but the project is running 2.5.3.
Procfile.dev file:
rails: bundle exec rails s
webpack: ./bin/webpack-dev-serer
It says the project is running 2.5.0 based on a directive like ruby '~> 2.5' in the Gemfile. Try changing that to the actual version you're running, run bundle to setup Gemfile.lock again, and retry the command.
I had Ruby 2.5.1 installed from ‘sudo apt install Ruby’ and 2.5.3 installed from RVM. I wiped all installed Rubies and RVM, reinstalled 2.5.3 via RVM on the root directory and was good to go.

Openshift ssh incorrect ruby version on bundle install?

I have a Ruby 2.0 rails 4 app on openshift.
When I ssh into my application and run bundle install I get a message saying: 'Your Ruby version is 1.8.7, but your Gemfile specified 2.0.0'.
When running ruby -v, I get : "ruby 2.0.0p353..."
Running gem environment it also says Ruby 2.0.
Also on my local machine everything is working fine.
Why does my bundle install think I'm using ruby 1.8.7 on the openshift server?
I think your bundler was installed before Ruby upgrade to 2. Try to install your bundler again using gem install bundler and then run bundle install
Let me know if it works

bcrypt error while deploying rails app to ubuntu server

am getting the following error while deploying my rails app to my ubuntu server
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue
I have tried gem install bcrypt -v '3.1.7' but that doest seem to work at all
any solution will be highly appreciated
Log files were never created, so there was nothing to show.
Anyway, I restarted my Ubuntu server and suddenly everything worked. Successfully deployed my rails app after restarting Ubuntu server

Rails installation on hostmonster bundle install fails

So I had a rails app up and working on my hostmonster account just fine. I then updated a few things in my dev environment / pushed them up to github / pulled them back down on my production environment. Now its giving me the error Could not find pg-0.17.1 in any of the sources (Bundler::GemNotFound).
This is a new gem i installed in my dev because i was attempting to move to postgresql for dev and live....for now im using postgresql in dev and mysql2 in production. I know this isn't optimal but im working on it.
I tried running bundle install to get the pg gem installed and it fails with the error
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.2.2.gem] in /home4/muscorei/workspace/vollapp
An error occurred while installing rake (10.2.2), and Bundler cannot continue.
Make sure that gem install rake -v '10.2.2' succeeds before bundling.
I try installing rake and it works fine...try again..same error. I have found one question on here that seems to fix this for others but it requires running of gem update --system which you cannot do for hostmonster. Any ideas?
So here is another "related" issue. When i type in gem list --local I see that rails is installed at version 4.1.0....however when i do rails -v it shows the systemwide version of 3.2.13. I don't EVER have any of these annoying issues on my dev environment.

Rails 3.2 not using bundled gems, Capistrano needs sudo gem install and rbenv not finding rails

I have 2 Rails 3.2.11 apps running on an Ubuntu 12.04 server with Nginx, Unicorn and Postgresql. Deployment is by git and capistrano.
After I installed the second app I found that Capistrano would fail during cap deploy because it "could not find a gem source" and I needed to install each missing gem using sudo. After this, cap deploy worked fine and so did the apps. Running bundle install from the current dir in either app reported using all the correct gems.
I am perplexed that Capistrano needs to find the gems before updating my app as my past experience (I think) was that I could run bundle install from the current dir to install any new or updated gems after cap deploy.
Today, I decided to update my Ruby version using rbenv on my dev laptop. I needed to run git pull from .rbenv/plugins/ruby-build and then rbenv rehash then I could install the new Ruby version. All good, ruby-v reports the new version 19.3-p374.
Now, when I run rails server (rails s) from my app dev dir I get rbenv: rails: command not found. The rails' command exists in these Ruby versions: 1.9.3-p327. rbenv version reports
1.9.3-p374. Rbenv which rails and bundle install both report "command not found: with rbenv error "Therails' command exists in these Ruby versions: 1.9.3-p327".
So, two issues which I believe are related:-
How to make each app on my server independently run its own gems using bundle install? I don't want to freeze the gems and am quite happy to keep both apps up to date simultaneously. Should I just keep installing the required gems using sudo?
How to fix the rbenv issue of not finding rails in the new version?
I needed to reinstall all gems again. Gem install bundler and then bundle update from each application directory.

Resources