Passenger stand alone uses wrong ruby version? - ruby-on-rails

Hello im using rails 4 with rvm - ruby verison 2.0.
But when i try to start passenger (stand alone) im getting syntax-errors.
It tells me:
Ruby interpreter command
/usr/bin/ruby1.8
How can i change it to the rvm 2.0 version?

I had the same problem: passenger standalone uses nginx, and after upgrading my app to use ruby 2.1.1 (specified in the .ruby-version), I saw similar errors.
On my production server, I know where the nginx configuration lives, so I could fix the path to the ruby interpreter.
However on the standalone setup I couldn't find it in less a minute, so I did a gem uninstall passenger followed by gem install passenger to have it recompile nginx.
Now it works, at least until the next ruby interpreter bump.

you need to use ruby first:
rvm use ruby
it might display additional instructions - make sure to read them

Related

Getting Rails 1.1.2 server running on Mac script/server

So I'm a rails developer familiar with Rails 3 and 4. I'm taking on a Rails 1.1.2 project, and the first problem I'm having is getting the server running.
I'd really love some help figuring out what I'm missing setting up the environment. When I run script/server, I get:
-bash: script/server: /Users/michael/.rvm/gems/ruby-1.9.3-p545: bad interpreter: Permission denied
This is after noting that at the top of the script/server file, there's an opportunity to define the location of the ruby install with a ruby comment:
#!/Users/michael/.rvm/gems/ruby-1.9.3-p545
At least, this is how I understand it. What should this comment point to? Does this look correct? I've installed ruby 1.9.3 using rvm and installed rails V 1.1.2 through sudo gem install rails. Everything seemed to work fine.
Is this some kind of bash permissions issue? I really don't understand what's going on. Any help would be appreciated!
I believe a rails project that old will require Ruby 1.8.7, so you should start with an older version of Ruby just to be sure. Once you get it running with the older ruby version, you can try 1.9 again, but trying it with 1.8.7 should help you out a bit. Your shebang should be able to do this though:
#!/usr/bin/env ruby
It needs the path of the ruby interpreter, which can be obtained dynamically via the above line.

How can I deploy Ruby On Rails Application in Apache in LAMP on ubuntu without installing Ruby and rails

Please provide me the guidance for deploying the ruby on rails application in apache in lamp without installing Ruby or rails?
You need it. Install ruby with all dependencies and install Phusion Passanger. The way I read your question was like this, lets go ride the bicycle with no wheels, let me check my email with no browser - it does not make sense.
you may use Phusion Passenger with Apache for deploying the ruby on rails application.
If it is Ubuntu, all the dependencies are just an apt-get line of code away, so it is well worth install it someway

manually compiling ruby 1.8.7 on ubuntu hardy

running two rails 2.3.8 apps on two virtual servers in ubuntu 8.04 with apache and passenger. the ruby version is 1.8.6
we are upgrading one of the apps to rails 3.0.4. my understanding is that we need ruby 1.8.7 to run the app. with this version of ubuntu we will need to compile ruby 1.8.7 manually.
never compiled manually before. if you know of any resources i should check out that would be great.
i have not been able to determine the version of passenger and am trying to make sure it will be compatible with rails 3.0.4. any suggestions?
the application we are leaving in 2.3.8 is our core business application and i need to make sure i don't mess it up.
Thanks!
Just use RVM. Almost everybody use it now.
Early Passenger versions for Apache had some bugs so my suggestion is to simply upgrade Passenger to the newest version.

RVM, Passenger, NGINX on top of existing Passenger/NGINX

I previously had Passenger 2.2.13 install with NGINX 0.7.65 - I want to install rails 3 so I figured I'd go the RVM route. I followed instructions from http://blog.ninjahideout.com/posts/a-guide-to-a-nginx-passenger-and-rvm-server and am having issues because my previous install is in a different location and I think that is the one being used. When I make the changes to my nginx.conf file I get a 502 Bad Gateway on all of my apps..
Can anyone help me out with remove NGINX, Passenger, RVM, and re-installing fresh?
I am running OS X 10.6.
If the previous version was running ruby 1.8, I would do the following to have both apps running:
Install rvm
Replicate current ruby (ruby version, gems, etc) server configuration for rvm.
This is step should include re-installing passenger gem for the new ruby.
Install ruby 1.9 using rvm and then follow this guide: http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
I've done this using apache, and now everything is working ok.
This has to do with using RVM and Passenger, passenger by default only has one path for ruby,once updated this worked fine. I've moved away from Passenger locally to avoid dealing with multiple environments.

Passenger with Nginx cannot find rails 2.3.8 gem

I have been trying to setup nginx with passenger for a few days now and keep running into problems. When I go to my Rails application with my browser it says: Missing the Rails 2.3.8 gem. Please gem install -v=2.3.8 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
If I type gem list in my terminal it shows: rails (3.0.0, 2.3.8, 2.3.5)
What is funny is that passenger will find my ruby gems just fine when I use it with Apache on the same machine! But I would like to experiment with nginx because Apache is not doing what I want.
The machine is Ubuntu 10.04 Server
which ruby Shows: /usr/local/bin/ruby (REE)
These are the passenger directives in the nginx.conf:
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15;
passenger_ruby /usr/local/bin/ruby;
#Nik Rishav is correct in that you have to be careful when installing Ruby Enterprise Edition (REE) along side the system Ruby. Installing REE incorrectly can cause some very strange things to happen.
While Rails 3.0 could be the cause of your issues, my gut tells me your real issue is one missed step when installing REE. But, just-in-case this doesn't work, a quick Google search will show you any number of good tutorials showing you how to host a Rails app with Phusion Passenger for Nginx. Well, let's give it a go, shall we!
REE runs fine alongside system Ruby, but you have to install it into its own directory. For example:
/opt/ruby-enterprise-X.X.X/bin/ruby
Your other option is to only install REE, but this might not be an option for you. I suspect that when Nginx runs, it does find REE as you have specified it. Did you install Passenger for Nginx from the REE stack?
/opt/ruby-enterprise-X.X.X/bin/passenger-install-apache2-module
If you haven't, you might want to look into that. I'll assume you did.
From your description, it doesn't look like you have told REE where to find your gems. To do this, you need to set REE as the default Ruby Interpreter. To do this, add an entry to the file /etc/environment. On Ubuntu, the directory is /etc/environment. Add REE's bin directory to the PATH environment variable, like this:
PATH="/opt/ruby-enterprise-x.x.x/bin:/usr/local/sbin:/usr/local/bin"
Placing REE first in the PATH will set it as the default Ruby interpreter.
Then restart Nginx, like so:
sudo /etc/init.d/nginx restart
Hopefully this helps. I've had my share of deployment issues and it truly can be frustrating. Wouldn't wish it on anyone...Good luck!
As a check, are you sure your passenger is installed in the correct version of ruby. basically
Both the rubies have separate gems meaning you have to install the other in one..
Check in the /usr/local/lib/ruby/gems/1.8/gems Directory to see if rails 2.3.8 is present. You need to install it in the this ruby.
Both rubies will have separate gem bin files for installation..
possibly /usr/bin/gem is for the system ruby
and /usr/local/bin/gem is for your installation of REE

Resources