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

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

Related

Ruby Gems getting out of hand

So I've recently been having a lot of trouble with my Ruby gems, such as: not being able to uninstall them because they're set to "default", my Bundler version showing as 2.2.9 even after I've uninstalled it, 2.2.9 being installed in the 2.2.7 directory, seeing "bundler" in 3 different directories on my machine, etc.
I would like to:
a) start from scratch by deleting ALL gems and gem folders on my machine (haven't found a way to do that)
b) prevent this from happening again (basically advice)
Some guidance on this would be VERY much appreciated.
If you're using rbenv you should find all versions in ~/.rbenv/versions by default (whatever $RBENV_ROOT refers to), and can delete them there.
Depending on OS you may also have a system Ruby installed, which you probably shouldn't mess with.
constant
RUBY_VERSION
"#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
or
RUBY_DESCRIPTION
or gem env

Changing Ruby version during deploy

I have a box with 3 Rails apps on it. I wan't to upgrade one of the apps so that it uses Ruby 2.0.0, while leaving the others running on 1.9.3-p394. I have both those Rubies installed via Rvm.
I'm trying to control the Ruby version that each app uses via it's Gemfile.
# Gemfile
ruby '2.0.0'
So, I changed the version number in the Gemfile locally, made sure it all worked, committed and now I'm trying to deploy the change to the server.
However, the cap deploy fails at this point
bundle install --gemfile [path to release Gemfile] --path [path to app bundle] --deployment --quiet --without development test
because
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
This is correct technically, my Gemfile does specify 2.0.0 and the app is currently running on 1.9.3. I'm trying to make it change versions before bundling though. How do I do that?
Your PATH is not set up correctly. You probably don't have bin: as the first entry in your path. That would lead to this error.
Even if you're not using Heroku it's worth reading this page on troubleshooting that issue: https://devcenter.heroku.com/articles/ruby-versions
Here is a link to an answer which will explain how to change your PATH on the server: Capistrano: Can I set an environment variable for the whole cap session?
If you have rvm maybe you can try to do
rvm use 2.0.0
before your bundler call.
If you're using rvm set the default to ruby 2.0.0 on your server
rvm --default use 2.0.0
Resolved the problem for me deploying to an AWS server from my mac - but I guess if I need to update my older sites I'll have to set the default back to 1.9.3 before deploying.

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.

after running bundle install with rubymine still gems are missing

I started a new rails application project with rubymine.
After that Rubymine ran a bundle install.
project did not succeed in running
on one project - with no mysql definition the error is
gemnotfound - could not find gem sqlite
on one project - with mysql definition the error is
gemnotfound - could not find gem mysql2
Does someone have an idea what are those ?
shouldnt bundle install brought me those?
How can I start a simple rails project using rubymine?
Is there a good tutorial with all these issues ?
Thanks you.
RubyMine may not be able to install these gems automatically as they depend on native libraries that may not be available on your system. You also need DevKit installed and working in order to install native extensions.
I suggest you to read related posts:
Cannot install mysql2 gem
Installing SQLite 3.6 On Windows 7
You can also use sqlite-ruby instead, as for the above gems you need sqlite3.dll and libmysql.dll in PATH.
Google is your friend, it's not that hard to find various installation guides.

Using RVM, how to ensure gems and non-gems see the same version of ruby?

I'm trying to install bdb on Ubuntu as a gem as follows,
gem install bdb
I'm not using sudo, since I am installing with rvm. The ruby version on my system is 1.9.1 but the version I'm using for this installation is 1.8.7 (I'm installing rbot, you see). The problem I've encountered is:
checking for db_version() in -ldb-4.something... no
I assume this means that rubygems is not finding ldb4.something in the places it is looking. Is this because I installed libdb-4.something (7, actually) using sudo, and my system's ruby version is different from the ruby version I'm using for bdb? Using rvm, how should I manage this sort of situation? Maybe I'm doing things wrong, but it seems to me that my problem is that not everything I'm using is a gem, and the stuff that isn't gems is seeing the wrong version of ruby.
(if it turns out that my problem is something completely unrelated: I am still interested in the question. How do things I've installed on my system with a particular version of ruby get along with gems installed using rvm under different versions of ruby?)
"How do things I've installed on my system with a particular version of ruby get along with gems installed using RVM under different versions of ruby?"
They don't, and that is the point. RVM is for managing different versions of Ruby so that they are isolated from each other.
This means that the Ruby versions that you use for system (when you do sudo gem install that would be installing to system) have nothing to do with the current environment (when properly set up.)
When you are in a RVM environment, each version of Ruby installed is an isolated environment.
What I would recommend is this:
Go to the RVM Website and check it out.
At the end of the page, continue with your reading about how to use gemsets.
go to your project directory
rvm use 1.8.7#your_project_environment
create your .rvrmc file so that you will automatically be using this environment in your project on the future visits to this project, this file can contain "rvm use 1.8.7#your_project_environment" which will achieve this.
install all required gems
If you have additional questions, feel free to visit Wayne E. Seguin and a ton of other users of RVM and we will be happy to help you out. Of course, the first search for answers is the documentation on the web site.

Resources