Capistrano 3 deploys a wrong ruby version - ruby-on-rails

On my production machine
rbenv versions
system
* 2.2.2 (set by /Users/smi/.rbenv/version)
which unicorn
/Users/smi/.rbenv/shims/unicorn
ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin12.0]
On my server (I can not understand why unicorn gets ruby version 2.2.0 after a deploy and where from, because is not installed on any of my machines):
rbenv versions
* 2.2.2 (set by /home/deployuser/.rbenv/version)
bundle exec which unicorn
/var/www/foreignernetwork/shared/bundle/ruby/2.2.0/bin/unicorn
.rbenv/version
2.2.2

It is not getting a different version of Ruby. You're running 2.2.2, but Bundler just uses a 2.2.0 directory for storing the bundled gems, bins, etc.

Related

Conflict between ruby version in gemfile and local ruby

I'm having trouble running running an app because of its ruby version. But from everything I can tell, I have the right version of ruby running. What am I doing wrong?
user#computer project % rails s
Your Ruby version is 2.6.3, but your Gemfile specified 2.7.1
user#computer project % rbenv local
2.7.1
user#computer project % ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
user#computer project % which ruby
/Users/user/.rbenv/shims/ruby
(I've also tried switching the ruby version in the gemfile from 2.7.1 to 2.6.3, but when I do, it gives me the opposite message (that I have 2.6.3 specified but I'm running 2.7.1).
Update: Turns out this problem is specific to running in zsh. Using bash works fine.
rails invokes the global binary. You can try:
bundle exec rails instead, or
gem install rails in your Ruby 2.7.1 environment.

Capistrano 3: incompatible ruby version

I am deploying a rails app to Ubuntu 14.04 using Capistrano.
In remote Ubuntu server it shows I am using Ruby 2.3.0
I tried these commands to install Ruby
rbenv install 2.3.0
rbenv global 2.3.0
rbenv rehash
deploy#ubuntu:~$ rbenv versions
system
* 2.3.0 (set by /home/deploy/.rbenv/version)
deploy#ubuntu:~$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
But when I try cap production deploy, error happens and shows a different Ruby is working, instead of 2.3.0
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is
incompatible with
the current version, ruby 1.9.3p484
How can I fix this?

After installing ruby 2.2.3 with rbenv it has a different version

I'm trying to use Rails 5, which requires Ruby version >= 2.2.2.
I installed 2.2.3 with rbenv install 2.2.3 and set it global. When I check with ruby -v I get ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15].
However when I run bundle exec railties/exe/rails new /parent-folder/api --api --edge I get the error:
Rails 5 requires Ruby 2.2.2 or newer.
You're running
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin14.0]
If I explicitly set the local version to the exact version number 2.2.3p173 or 2.2.3 then it says rbenv: version '2.2.3' is not installed (or 2.2.3p173 accordingly).
When I perform rbenv install -l to check available versions only 2.2.3 is listed, not the 2.2.3p173.
Don't understand how to get this to work.
Side notes: I have updated ruby build, my $PATH has rbenv setup correctly, I don't have rvm installed.
Instead of bundle exec railties/exe/rails new /parent-folder/api --api --edge try ./rails/railties/exe/rails new myapp --edge --dev where 'rails' is the rails git repo.

rbenv-capistrano install ruby version 1.9.3p392 instead of 1.9.3p448

myproject#ubuntu:~/Desktop/myproject$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [i686-linux]
However when I run cap deploy:setup install in my production server ruby version 1.9.3p392
My .ruby-version file:
1.9.3-p448
my capistrano-rbenv version is (1.0.5)
I don't think capistrano-rbenv installs a new ruby version itself, instead it uses the selected ruby version or in your case a similar version if the required version doesn't exist.
Also, you may still have configured another version in config/deploy.rb:
set :rbenv_ruby, '1.9.3-p392' # somewhere perhaps

Ruby on rails app deploy to apache without passenger

I am running the following versions of ruby, gem, rails on ubuntu 13.10 :
==> ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
==> gem --version
1.8.23
==> rails --version
Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run gem pristine --all for better startup performance.
Rails 4.1.0
Is there a good way to deploy a ruby on rails app to an apache2 server without using phusion passenger?
Then your only option is to choose some other application server
Puma
Unicorn
Thin
This link might help
Unicorn is a solid solution for running Rails app.
checkout this tutorial to set up Unicorn + Apache

Resources