Make Nginx use the correct passenger gem - ruby

I am trying to setup an nginx + sinatra + ubuntu 10.04 + passenger + rvm stack. I followed the directions here: http://thekindofme.wordpress.com/2010/10/24/rails-3-on-ubuntu-10-10-with-rvm-passenger-and-nginx/
This is a follow up to this post: Sinatra Gem Won't Install. I also followed the directions given by another stack overflow that essential creates an .rvmrc in my app and I've added the passenger gem.
According to the previous post, I am spawning the wrong passenger.
In my nginx conf file I'm using: passenger_root /home/noahc/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9;
How do I find out which passenger I'm supposed to be spawning and how do I change it?
You can visit http://shiftfrog and see the stacktrace that generated this question and the previous one.
Any ideas? Am I doing this in the wrong order?
Should I setup RVM, then ruby, then follow the directions for setting up the gemset and rvmrc file in my project directory. Then run the rvmsudo passenger-install-nginx-module command from the gemset I created. Currently I ran it outside of the gemset I created according to the previous stackoverflow question I reference earlier.
Thank in advance for any help you could lend.

There is quite nice description on RVM site and Dercys blog:
https://rvm.io/integration/passenger/
http://blog.ninjahideout.com/posts/the-path-to-better-rvm-and-passenger-integration

Related

how to use rbenv to manage local gems

I've been using Middleman since a while, but very recently it is getting some issues in loading.
This is likely due to the coexistence of very old gems of the same type.
Have to say that I did follow some online suggestions, but haven't really got the full understanding. So ended up using rbenv for managing ruby then bundle to install the gems.
Now, have two project that for which I need to "reset" and install only the referenced gems into the local folder or somehow they don't conflict.
I can't figure out how to do it.
Using the rbenv -local I can change the local ruby version, but not sure how to move next.
Any help?
Thanks
I don't think you need rbenv or rvm for this, although their are good tools. To run a piece of code with just the gems you need, and the versions you specified in your Gemfile, run any command prefixed with bundle exec.
For example bundle exec middleman server.

Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update

Well, I have to admit, that I'm down today. I've updated my Ubuntu and that rendered Redmine 2.1.2 completely dead. Any suggestions as of to what should I update or reconfigure? I'm trying not to use Ruby/Rails/Passenger blindly but it's tough as it's not my expertise. I'd like to USE Redmine instead.
Top of the Passenger error log is below, but feel free to check whole page at http://redmine.teacloud.net:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
Is this app supposed to be run as the nobody user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find rake-10.3.2 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/1.8/gems/bundler-1.3.4/lib/bundler/spec_set.rb:92:in `block in materialize'
• I have no idea, what user should this app supposed to be run as. Everything else uses www-data by default, however the redmine application folder in filesystem is owner by root.
• Everything was working for two years on ruby 1.8 that is not on my system now. I've managed to install lowest version 1.8.7, latest 2.1.2... and I have no idea where does the 1.9.1 get from.
• I don't understand how 'bundle install' and 'bundle update' is related to current ruby version switched to using rvm.
• I am not sure, at what point will my Redmine MySQL database be migrated or destroyed if I'll need to upgrade Redmine (so I have backup).
• bundle install didn't help, Apache runs ruby 1.9.1
Solution was simply as follows (whole failure path is documented here http://www.redmine.orgenter code here/boards/2/topics/43500?r=43514):
• Everything happens in the Redmine's installation folder:
• Went to GitHub (https://github.com/redmine/redmine/blob/master/Gemfile) and copied fresh database section to Redmine's Gemfile (ignoring the fact that I have Redmine 2.1.2 and Gemfile is far newer)
$ rvm use system
$ bundle install

deploying a specific git version of a gem into passenger via rvm global gemset

We've a deploy issue I'm having with passenger using a specific github
version of the handsoap gem, which is specified in the Gemfile.
bundle states:
Using handsoap (1.1.8) from git://github.com/unwire/handsoap.git (at e6f79ec)
[ rubyapp]$ bundle show handsoap
/usr/local/rvm/gems/ruby-1.9.3-p286#global/bundler/gems/handsoap-e6f79ec9d6a3
[ rubyapp]$ bundle show capybara
/usr/local/rvm/gems/ruby-1.9.3-p286#global/gems/capybara-1.1.3
(There's many other gems but I thought I'd add capybara to show where they are. There's no other specific github versioned gems)
Sadly we've not got root access to change to another gemset - i.e. not
global and it was installed before the project was setup, so we were not able to specify a custom gemset before, as you would in the local development environment. This version of the gem is needed unfortunately.
Passenger reports:
git://github.com/unwire/handsoap.git (at e6f79ec) is not checked out.
Please run bundle install (Bundler::GitError)
I've tried a gemset empty global , and a following bundle install
I've tried a gemset empty global , and a following bundle install
I've tried
rm /usr/local/rvm/gems/ruby-1.9.3-p286#global/bundler/gems/handsoap-e6f79ec9d6a3
and a bundle install
all which give the same passenger error as specified above.
Any help would be appreciated. The application has been working previously within the global gemset - but with a previous version of handsoap, but now it's time for a new deploy of the code.
Spent a couple of hours now trying out different options.
Cheers in advance,
Ian.

Why does my Rails app not see installed gems?

Running Ubuntu 10, RVM, Passenger and apache2. Trying to configure and get Redmine running.
First, I set my default Ruby binary to /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby. That's the output of which ruby. Output of which gem is /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/gem. I think that side of things is set up properly.
I know Passenger is running, because I'm getting an error screen, with this error:
Error message:
Missing the i18n 0.4.2 gem. Please gem install -v=0.4.2 i18n
Update The error that passenger is producing is coming from the boot.rb file. I went and made a gist of the application's boot.rb file.
When I do check to see if that gem is installed, here's the output.
# gem list
# ... list truncated ...
# i18n (0.4.2)
(full gist of installed gems here)
Really? Let's first make sure passenger.conf is going to the right Ruby installation...
passenger.conf
PassengerRuby /usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby
>:| So now, I go onto SSH into the application directory, and what have you, script/server starts normally. I'm a little more than confused. Clearly the Ruby installation that Passenger is configured to has the Gem it says is missing, installed, and additionally, the application doesn't falter on a start up. Which makes me think it's a Passenger problem.
Using RVM with Passenger is a bit complicated, maybe this link about using Ruby and Passenger will help.

fubar'd a ruby installation on ubuntu, need helping purging it for reinstall

i originally followed these steps to get a RoR environmentgoing: https://help.ubuntu.com/community/RubyOnRails
that worked. then i put 1.9.2 on here. then i decided i want the original setup, did a "whereis ruby" and deleted those directories manually.
that fubar'd my ruby installation. i can't use the repository to what i originally had. how can i purge ruby from completely and start fresh?
right now the specific error is this:
/usr/lib/ruby/1.8/rubygems.rb:11:in `require': no such file to load -- thread (LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:11
from /usr/bin/gem1.8:8:in `require'
from /usr/bin/gem1.8:8
tipu#tipu_ubuntu:~$
You're not giving enough real information to be specific, but this is what I'd try:
Use apt-search to locate Ruby 1.8.7 for your OS version.
Using apt-get, uninstall that version so you're back to what APT thinks is a clean slate.
Again using apt-get, reinstall that version so you're back to what APT thinks is a normal installation.
From that point, I would STOP messing with the system Ruby, and instead use RVM to manage and install any new Ruby and gems installations into RVM's ~/.rvm sandbox.
To follow up on the Tin Man's answer:
I wrote a guide to installing Ruby and Rails on Ubuntu which you may find useful for getting this all peachy again.
Hope it helps!
You need to reinstall libruby1.8. I'm pretty sure that will take care of it. I had exactly the same problem.

Resources