Passenger installation with nginx fails - ruby

I'm running an ubuntu 9.10 server on an amd-64 platform. Everything's pretty much standard, and I've got Sinatra 0.94 running on a ruby 1.8 installation. I want to install passenger in order to easily configure ssl.
The problem is, it fails to find the installer.
I run
sudo gem install passenger
or
sudo gem install -r passenger
and then the next line,
passenger-install-nginx-module
or
passenger-install-apache2-module
both fail because the path isn't found.
Is there something I'm forgetting here? Shouldn't it just work, straight up, once the gem is installed?

A bit late for an answer I guess, but actually, the correct way of running the Phusion Passenger installer for nginx, when using RVM, is to use rvmsudo as in:
rvmsudo passenger-install-nginx-module
Credits go to this blog post,

I got it working with
rvmsudo `which passenger-install-nginx-module`

according to this issue on github: https://github.com/wayneeseguin/rvm/issues/1307
seems like you have to do full path:
this worked for me:
which passenger-install-nginx-module
rvmsudo ~/.rvm/gems/ruby-1.9.3-p327-new/gems/passenger-3.0.18/bin/passenger-install-nginx-module

apparently, the gem is installed in a place that's off the path, according to
http://groups.google.com/group/phusion-passenger/browse_thread/thread/78ca12c4838034a6/b5a3c7a00a871283?lnk=gst&q=ubuntu+9.10#b5a3c7a00a871283
Frustrating error, which is why I leave this question rather than delete it (and, with the upvote, I think I'm not the only one with the problem).

I had a similar issue. You need to add gems to your system PATH, paste this into your shell:
export PATH=$PATH:$HOME/bin:/var/lib/gems/1.8/bin
or, to make it permanent add it to your bashrc, usually here: ~/.bashrc
You can also execute just passenger-install-nginx-module by going to the directory at: /var/lib/gems/1.8/bin
Good luck!

I know you already answered the question, but figured I'd chime in with a cent or two.
I recently did a similar nginx install, but chose to go with RVM for managing Ruby versions, which requires us to NOT use sudo.
I recommend this route because all versions of Ruby and all your gems are organized neatly in your home directory. Doing so will also require you to compile nginx manually, which certainly helps understand the pipes a little.
You can compile nginx manually using the "--add-module=/home/user/path_to_passenger_gem/ext," but you'll want to read up RVM's instructions very carefully...really, don't skip a line as they are very concise.
Here's a link to RVM's instructions:
http://rvm.beginrescueend.com/passenger/
and to the Nginx manual instructions (which you probably already skimmed).
http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_phusion_passenger_for_nginx_manually

I have got a bit of information on my blog regarding setting up nginx with passenger (and ssl in this case). Perhaps it is of use since it goes through the whole process of recompiling nginx with options.

Related

killproc command not found error in Ubuntu 12.04

I have a redmine script in /etc/init.d/ folder which was working fine before I broke the ruby and rails packages link. Then I played with ruby gems and finally fixed the broken links. Then I tried to restart redmine script, But strangely, I got the below error
sudo service redmine stop
Shutting down redmine: /etc/init.d/redmine: line 49: killproc: command not found
user#studio:~$ sudo service redmine start
Starting redmine: /etc/init.d/redmine: /usr/local/bin/bundle: /usr/local/bin/ruby: bad interpreter: No such file or directory
/etc/init.d/redmine: line 35: echo_failure: command not found
killproc is part of init.d, so there isn't a missing package at play here. If the process isn't found, it won't run, as well.
However, the next line is more of a red flag. It sounds like your redmine installation is looking for ruby in the incorrect location. This may also be the source of the killproc error as it looks like redmine is not starting up properly.
You can get some more information by running which ruby and comparing that to the path that redmine is looking in. Reinstalling redmine may also resolve the path issue automatically since it sounds like you did a reinstall of rails earlier. Good luck.
My question has two answers, telemark already given answer for my 2nd problem ( ie, I had broken ruby links ). I solved path issues by uninstalling all ruby, rails and gem packages and reinstalled using apt repository. using rvm, chruby, etc everything failed when I switch between users. So I thought of going with the system ruby installation, relying on apt. Fortunately brightbox comes to the rescue.
https://www.brightbox.com/blog/2015/01/05/ruby-2-2-0-packages-for-ubuntu/
Using brightbox and apt solved my path issues.
Then, /etc/init.d/functions, this was missing. It says, No such file or directory. I searched in google and found this link
http://www.linuxfromscratch.org/lfs/view/6.4/scripts/apds02.html
I just copy pasted to /etc/init/functions and given execute permission
sudo chmod a+x /etc/init.d/functions
Thats it!.
UPDATE:
I forgot to mention one important thing, some functions like log_end_message, log_progress_message, etc are not available in functions file. So it's better to include . /lib/lsb/init-functions file.

Cannot find rvm.sh in /etc/profile.d/

I am new to RVM and looking to use it as I deploy my Rails app to a Digital Ocean server. I am following this tutorial and trying to get my Mina script to run (similar to Capistrano). The script includes a set up section with these lines:
source /etc/profile.d/rvm.sh
rvm use || exit 1
Unfortunately, rvm.sh does not exist in /etc/profile.d (or anywhere else on my server). rvm seems to be installed just fine (I can set list rubies, set my Ruby default version, etc). I'm not even sure what rvm.sh would contain if it existed.
Thanks in advance for any help or suggestions you can provide.
#mpapis got me on the right path here. I had installed rvm under one user, but not for this user. I wound up uninstalling rvm and starting from scratch, installing rvm for multiple users.

zsh command not found: zeus, mailcatcher, etc?

I've been going over this for awhile now and can't seem to get it permanently resolved. Was hoping someone could clarify for me.
I'm pretty familiar with setting up my PATH and working with ZSH. I have a ton of custom helpers, plugins, etc. going on nicely.
But for some reason, when I do gem install gemname and attempt to use it globally, it occassionally says gem not found. I found this happening recently with zeus:
tmtm|master⚡ ⇒ gem which zeus
/Users/andrewmartin/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/zeus-0.13.3/lib/zeus.rb
tmtm|master⚡ ⇒ zeus
zsh: correct 'zeus' to '_zeus' [nyae]? n
zsh: command not found: zeus
I had the same problem recently with mailcatcher and was never really able to get it installed or working. I had a couple really good Rails buddies take a look, they were confused as well.
Here's my PATH:
tmtm|master⚡ ⇒ echo $PATH
/Users/andrewmartin/.rbenv/bin:/usr/local/share/npm/bin:/usr/local/bin/npm:/Users/andrewmartin/.rbenv/shims:/Users/andrewmartin/.rbenv/:/Users/andrewmartin/.rbenv/bin:/usr/local/bin:/usr/bin:/Users/andrewmartin/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/opt/ruby/bin:/Users/andrewmartin/Dropbox/Favorites/dotfiles/bin
Any idea why some of these common, global gems are simply not found in the zsh shell? Happy to share any other information that would make this helpful. I am using rbenv.
I figured it out!
Simple!
Whenever you install a new gem with rbenv, you have to use the rbenv rehash command. It said it found one, so I just deleted the one that existed, then typed it again. When I opened a new terminal, both mailcatcher and zeus were magically available to me.
Awesome! Thanks to this post by the way.

RVM causing path issues with installed gems on Ruby 1.9.2 - unable to annotate, etc, do I need to reinstall RVM?

I'm on Mac OSX Snow Leopard. I tried to post a similar question to the RVM Google group but it did not seem to get posted.
I'm worried that I've done something fundamentally wrong with my RVM install that's causing these errors, that seems to be related to paths, at each step of the way. Have any of you seen this behavior before?
I started to teach myself Rails programming as of about two months ago with a working environment of Ruby 1.9.1 and Rails 3.0.3, based on a hivelogic install tutorial that had me modify my ~/.profile file and install the relevant bits to ~/usr/local/src/. For reference, the line in my ~/.profile file was this when I installed RVM, if that makes any difference:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/src:$PATH"
In my terminal I installed RVM as a user using the standard user github bash script.
I tried to install Ruby 1.9.2, which kept running into a weird error about a libfile somewhere. After much Googling I found someone on Stack Overflow that recommended renaming the ~/usr/local directory while performing the Ruby install -- I did this, and the install complete.
Then I did gem install rails and tried to do bundle install in my app, which gave an error when trying to install the SQLite3 gem (even though I already had SQLite3 installed and working). Again, I spent a day Googling this and eventually found "Unable to install sqlite3-ruby gem" that said if I used Macports to sudo port install sqlite3 it would work.
I tried that from the base directory, and Macports did its thing but it didn't fix the problem. Then I did the same thing from my app directory and it fixed the SQLite3 error I was getting.
Now I am able to run rails server and rails generate again, which is great, but then I tried to "annotate" my new model, and I get this error: http://pastie.org/1481570
I have not yet solved this issue, and have looked at many threads of similar issues. This, for example, did not solve my problem: https://github.com/james2m/annotate_models/commit/5997da9692c9b222e8d1be22dfad6ed8638c16a1
I even tried copying my source code directly into the rvm/user/ directory in case that relative path was causing problems, but it doesn't seem to have fixed anything. Maybe I need to uninstall RVM and re-install it as root instead of a user-level thing?
What do you think is the best way to get annotate to work and hopefully get RVM to play nice with my gems going forward?
I'm unfortunately REALLY new to terminal, code, etc, so any help would be much appreciated.
On Snow Leopard you should modify either ~/.bashrc or ~/.bash_profile, preferably the later. Also, RVM will not need anything in ~/usr/local since it's entirely self-contained in ~/.rvm.
RVM uses a nice little shell function to sense the needed directories and desired default Ruby. I suspect either the instructions you followed were very out of date, or poor recommendations. The current RVM installation requests you add:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
to your ~/.bash_profile
The RVM site has lots of troubleshooting tips for things like MySQL. I'd strongly recommend backing out of the things those other tutorials had you do, and refer to the instructions on RVM's site. It is very easy to get things working right if you do it the RVM-way.
Download and install Apple's latest version of XCode from their Developer site if you haven't already. There have been some broken versions shipped on the DVDs.
Install. In particular follow the "Post Installation" section.
Following that, do whatever rvm notes says to do as far as libraries. Following that, you should be able to use rvm info to gather useful info about your installation. It is your best friend.
Database integration will point you to how to fix MySQL's wagon.
RVM development happens fast. Keep it updated, at least once a week using rvm get head.
At that point you should be in a good place to start reinstalling gems.

Local installation of ruby / rubygems with no root access

I have a machine at work from wich I'd like to run a script that gathers some information about other machines. I want to do it in Ruby, since it's what I know best, but I've ran into some problems, all apparently due to the same reason: I don't have root access in this machine.
So what I did was: Download ruby source, configure (with --prefix pointing to somewhere under my home dir), make, make install. Alright, ruby runs fine. Then I did the same with rubygems and installed it. Ok as well, untill I went to install my first gem.
I downloaded the gem package (sigh, lots of firewalls, can't just "gem install" something remote), net-ssh, and tried to install it locally. Got the infamous "no such file to load -- zlib". Clues about this led nowhere, so I tried the next approach: getting net-ssh's source. When it tries to require 'openssl' (or when I try it from irb), I get "no such file to load -- openssl".
All of these problems, apparently, could be solved by apt-getting or rpm installing, or whatever. Only problem is: I can't!
Any suggestions as to how I might proceed?
Thanks for the help,
Marcelo.
Closing this now.
I had to ask someone with root access to install zlib-devel and openssl-devel (I'm on RHEL). Couldn't make it otherwise.
I'm guessing there's probably a way of using the stuff inside said packages without installing them as root, but I couldn't do it.
Did you try Ruby RVM?
You can download, compile and install a full-featured Ruby version on your home environment.
I recently did the same. The trick that worked for me is NOT to use a --prefix flag when you install rubygems.

Resources