Bug 1176632

Summary: Unable to access rails console with rails 4 quickstart
Product: OpenShift Online Reporter: Timothy Williams <tiwillia>
Component: TemplatesAssignee: Jakub Hadvig <jhadvig>
Status: CLOSED DEFERRED QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.xCC: jdenemar, jokerman, lmeyer, mmccomas, tyron6397
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-15 19:45:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Timothy Williams 2014-12-22 16:01:33 UTC
Description of problem:
The rails console cannot be accessed by ssh'ing to a rails 4 gear, `cd`ing to the app-root/runtime/repo directory, and running 'bundle exec rails console production'.

Version-Release number of selected component (if applicable):
-

How reproducible:
Always

Steps to Reproduce:
1. Create a rails 4 application using the provided quickstart
2. Ssh to the application and `cd` to app-root/runtime/repo
3. Run `bundle exec rails console production` or `RAILS_ENV=production bundle exec rails console`

Actual results:
A gemfile syntax error is reported:

Gemfile syntax error:
/var/lib/openshift/5498395efcf9334565000153/app-root/runtime/repo/Gemfile:54: syntax error, unexpected ':', expecting
$end
gem 'sdoc', '~> 0.4.0',          group: :doc
                                       ^

Even after resolving the syntax issues (:group => :doc), an error is still seen:

bundler: command not found: rails
Install missing gem executables with `bundle install`

Expected results:
The rails console is loaded properly:

Loading production environment (Rails 4.x.x)
irb(main):001:0>

Comment 1 Luke Meyer 2015-01-05 18:56:45 UTC
This seems to be complaining about ruby 1.8 failing to process ruby 1.9+ syntax. It doesn't matter if you "fix" the syntax to get further, as the problem is that you're running ruby 1.8 and Rails 4 doesn't support ruby 1.8.

The question is why you're ending up with ruby 1.8. Under ruby-2.0 I would expect to see the ruby200 scl automatically used when you ssh in. ruby -v and "which gem" show the versions under the ruby200 SCL:

> which ruby
/opt/rh/ruby200/root/usr/bin/ruby
> which gem
/opt/rh/ruby200/root/usr/bin/gem

But bundle isn't:
> which bundle
/usr/bin/bundle

For that you're getting the system bundler from the system ruby which is 1.8, thus the error.

Not sure if this would be considered a bug. There's just no bundler installed for ruby200. You can do so yourself:

> gem install bundler
Fetching: bundler-1.7.11.gem (100%)
Successfully installed bundler-1.7.11
1 gem installed
> which bundle
/var/lib/openshift/54aadc1b57f5e1d00d000192/.gem/bin/bundle

... and then everything should work.

Should the ruby-2.0 cartridge imply a dependency on ruby200-rubygem-bundler?

Comment 2 Timothy Williams 2015-01-05 20:29:28 UTC
Thanks for the investigation, looks like a workaround is as follows:

  1) SSH to gear and run `gem install bundler`

  2) Add the marker file .openshift/markers/force_clean_build and git push

  3) Remove the marker file and do another git push

  4) SSH to the gear and log into the console as usual.

In my opinion, we should include a dependency on the ruby200 SCL bundler in the ruby-2.0 cartridge. The rails console functionality is pretty standard and often necessary.

Comment 3 tyron woodley 2020-08-26 07:24:52 UTC Comment hidden (spam)