Description of problem: Create one ruby-2.0 app, embed mysql-5.1/5.5 db, add related db access files and git push, try to access http://$appname-$domainname-dev.rhcloud.com/mysql, found 500 error. login the app via rhcsh and check app-root/logs/ruby.log, found `require': cannot load such file -- mysql (LoadError) [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] /opt/rh/ruby200/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:53:in `require': cannot load such file -- mysql (LoadError) [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:53:in `require' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /var/lib/openshift/53c8e9912afe6a471d000398/app-root/runtime/repo/mysql_factory.rb:2:in `<top (required)>' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:53:in `require' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:53:in `require' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from config.ru:18:in `block (3 levels) in <main>' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ror40/root/usr/share/gems/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ror40/root/usr/share/gems/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ror40/root/usr/share/gems/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ror40/root/usr/share/gems/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ror40/root/usr/share/gems/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop' [ 2014-07-18 05:34:43.5498 2400/7f2dfc7ed700 Pool2/Implementation.cpp:1274 ]: [App 2553 stderr] from /opt/rh/ruby200/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads' Version-Release number of selected component (if applicable): devenv-4978 How reproducible: always Steps to Reproduce: 1.create ruby-2.0 app and embed with mysql-5.5 db cartridge #rhc app create myruby20 ruby-2.0 mysql-5.5 2.add related db accessing file and git push add mysql_factory.rb and config.ru to local repo (pls refer to attachment) #git add .&& git commit -amp&&git push 3.try to access http://$appname-$domainname-dev.rhcloud.com/mysql Actual results: Failed to access mysql via db driver Expected results: Can access mysql via db driver Additional info: If login in the app via rhcsh, 'gem install mysql' and restart the app, can access mysql via db driver from website. [myruby20-hlhplw.dev.rhcloud.com 53c8e9912afe6a471d000398]\> gem install mysql Fetching: mysql-2.9.1.gem (100%) Building native extensions. This could take a while... Successfully installed mysql-2.9.1 1 gem installed [lijun@ray myruby20]$ curl -k https://myruby20-hlhplw.dev.rhcloud.com/mysql version 1
Created attachment 918975 [details] config.ru
Created attachment 918976 [details] mysql_factory.rb
Lei, try to use the 'mysql2' gem instead of 'mysql', but I'm going to reproduce it on devenv.
Hi Michal, I updated require 'mysql2'" into the mysql_factory.rb file and "gem install mysql2 in the app, when access mysql via curl after restart, failed to access it. [lijun@ray shcknafm]$ head -n 3 mysql_factory.rb #!/usr/bin/env ruby require 'mysql2' [lijun@ray shcknafm]$ rhc app ssh shcknafm "gem list mysql" mysql2 (0.3.16) [lijun@ray shcknafm]$ curl http://shcknafm-retokl.dev.rhcloud.com/mysql uninitialized constant MySQL::Mysql But, if I used require 'mysql'" in the mysql_factory.rb file and "gem install mysql in the app, when access mysql via curl after restart the app, can access it. [lijun@ray shcknafm]$ head -n 3 mysql_factory.rb #!/usr/bin/env ruby require 'mysql' [lijun@ray shcknafm]$ rhc app ssh shcknafm "gem list mysql" mysql (2.9.1) [lijun@ray shcknafm]$ curl http://shcknafm-retokl.dev.rhcloud.com/mysql version 1
Lei: OK I figured out now, that this is a missing RPM problem. We don't have mysql2/mysql rpms for the ruby20 so for that you have to install them manually. But we think that 99% of our users will use Bundler and put them into Gemfile (so they will install those manually, via bunder). I'm tempted to close this as a WONTFIX, but I contacted Troy to see how much effort it will be to add those RPMS.
Info provided offline. Removing needinfo.