Bug 1176632 - Unable to access rails console with rails 4 quickstart
Summary: Unable to access rails console with rails 4 quickstart
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Templates
Version: 1.x
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: ---
Assignee: Jakub Hadvig
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-22 16:01 UTC by Timothy Williams
Modified: 2020-08-26 08:27 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-15 19:45:26 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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)

Note You need to log in before you can comment on or make changes to this bug.