Operation not permitted when trying to run god on RHEL5 - delayed-job

When i am trying to start god on RHEL5 box, am getting the following error. I have also installed libevent and libevent-devel packages, but the error persists. Does any one have any idea?
I patched the ruby file https://github.com/mojombo/god/blob/master/lib/god/event_handler.rb to include puts $!.message and puts $!.backtrace in the rescue Exception block of the self.load method to get the following backtrace.
Operation not permitted
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `load'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:54:in `default_run'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:100:in `block in run_daemonized'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:91:in `fork'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:91:in `run_daemonized'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:21:in `dispatch'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:8:in `initialize'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/bin/god:122:in `new'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/bin/god:122:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/bin/god:19:in `load'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/bin/god:19:in `<main>'
I also see the following lines in the god log file
***********************************************************************
*
* Event conditions are not available for your installation of god.
* You may still use and write custom conditions using the poll system
*
***********************************************************************
Also, below is the output from IRB
[rails#x-rws1 current]$ RAILS_ENV=staging script/console
Loading staging environment (Rails 2.3.11)
irb: warn: can't alias exit from irb_exit.
ruby-1.9.2-p180 :001 > God::EventHandler.load
Operation not permitted
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `load'
(irb):1:in `irb_binding'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:70:in `block in start'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `catch'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `start'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
=> false

I realized that god can only be started from a root user because of the netlink_handler_ext dependency. So even if you install the god gem as a non sudo user, you still have to use sudo to start god. So, I finally had to assign root privileges to the rails user and use rvmsudo to startup god.

Related

Deprecation error for rails stopping me from launching rails server

I am doing some open source stuff for the rails app https://github.com/publiclab/mapknitter but when I try to launch the rails server using rails s I get the following error message:
DEPRECATION WARNING: Support for Rails versions before 4.2 is deprecated and will be removed from skylight 2.0. (called from require at /Users/bena/.rvm/rubies/ruby-2.4.6/lib/ruby/site_ruby/2.4.0/bundler/runtime.rb:81)
=> Booting WEBrick
=> Rails 3.2.22.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[SKYLIGHT] [1.7.2] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
Exiting
/Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/application/configuration.rb:115:in `read': No such file or directory # rb_sysopen - /Users/bena/Documents/repos/ben-repos/mapknitter/config/database.yml (Errno::ENOENT)
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/application/configuration.rb:115:in `database_configuration'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activerecord-3.2.22.5/lib/active_record/railtie.rb:84:in `block (2 levels) in <class:Railtie>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activerecord-3.2.22.5/lib/active_record/base.rb:720:in `<top (required)>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/skylight-1.7.2/lib/skylight/probes.rb:119:in `require'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/skylight-1.7.2/lib/skylight/probes.rb:119:in `require'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config/initializers/column_definition.rb:19:in `<class:ColumnDefinition>'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config/initializers/column_definition.rb:17:in `<top (required)>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:245:in `load'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/engine.rb:592:in `each'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `run'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `each'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/application.rb:136:in `initialize!'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config/environment.rb:5:in `<top (required)>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/skylight-1.7.2/lib/skylight/probes.rb:119:in `require'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/skylight-1.7.2/lib/skylight/probes.rb:119:in `require'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config.ru:3:in `block in <main>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config.ru:in `new'
from /Users/bena/Documents/repos/ben-repos/mapknitter/config.ru:in `<main>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/commands/server.rb:46:in `app'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/commands/server.rb:70:in `start'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
from /Users/bena/.rvm/gems/ruby-2.4.6/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Is the problem caused by the the version of rails I am using or the version of skylight or something else entirely?
I am using ruby 2.4.6p354 and rails 3.2.22.5
I have installed and tried to switch to rails 4.2.0 but that doesn't seem to be working, I think because in the gemfile there is a pessimistic version constraint of gem "rails" ,"~>3.2" but I could be completely wrong. I have been told not to change the gemfile.
Check first line in error backtrace. You dont have /config/database.yml in your project
No such file or directory # rb_sysopen -
/Users/bena/Documents/repos/ben-repos/mapknitter/config/database.yml
(Errno::ENOENT)
Make sure you install everything from Prerequisites and simply follow Installation guide

Rails Console Error Output

I just recently updated Ruby(2.3.1) and Rails(5.0.0.1). Now, when I get an error ( any type of error) on the rails console, it's followed by about 15-20 lines starting with 'from/Users....../.rvm/..etc'. Any idea why I am getting so many lines of this error output and if it's normal? How could I fix it? Everything else regarding Ruby/Rails works perfectly fine for me otherwise, so maybe it's just normal output. However, it is a bit of an annoyance.
The commonality in each path seems to be '.rvm'.
For example:
2.3.1 :031 > test
ArgumentError: wrong number of arguments (given 0, expected 2..3)
from (irb):31:in `test'
from (irb):31
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/AlfonsoGiron/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1#global/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/AlfonsoGiron/.rvm/gems/ruby-2.3.1/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/AlfonsoGiron/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
2.3.1 :032 >
Thanks for any help.
Rails console uses IRB under the covers, so you're going to have to edit your IRB configuration file, usually located at ~/irbrc, and change the BACK_TRACE_LIMIT value:
IRB.conf[:BACK_TRACE_LIMIT]=0
During a Rails console session, you can also run:
conf.back_trace_limit = 0
There are many more configuration options for IRB (and by extension, Rails console). Check them out at ruby-doc.org.

Error installing rails api with postgresql

I am trying to build a skeleton rails-api to use for future use but keep coming across an error. So i am in a folder call Rails_API_Skeleton and i run..
gem install rails-api
Which runs fine.
I then run...
rails-api new Skeleton_App -d postgresql -T
Which also runs without any issues. So i...
cd Skeleton_App/
then run...
bin/rake db:create
And get the following error, which after much googling i cant figure out how to resolve.
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:89:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rails-api'.
Gem Load Error is: uninitialized constant ActionController::API::RackDelegation
Backtrace for gem load error is:
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:131:in `<class:API>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:85:in `<module:ActionController>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api/action_controller/api.rb:5:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api.rb:3:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/rails-api-0.4.0/lib/rails-api.rb:3:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
/Users/username/Desktop/Apple_tv_movies_and_stuff/skeletons/Rails_API_Skeleton/Skeleton_App/config/application.rb:17:in `<top (required)>'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
/Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
/Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
-e:1:in `<main>'
Bundler Error Backtrace:
(Bundler::GemRequireError)
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:85:in `block (2 levels) in require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
from /Users/username/Desktop/Apple_tv_movies_and_stuff/skeletons/Rails_API_Skeleton/Skeleton_App/config/application.rb:17:in `<top (required)>'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `require'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:82:in `preload'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:143:in `serve'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/username/.rvm/gems/ruby-2.2.2/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/username/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
Thanks for any help in advance
I suspect something changed with the gem in response to Rails 5.
Maybe its use is deprecated now?
Anyway, the new Rails API way seems to be
http://edgeguides.rubyonrails.org/api_app.html
rails new skeleton_api --api

How to Update Ruby, Rails, and Spree: Some Pointers Please?

I'm looking into updating this enormous web site. Its huge. It uses Ruby 1.9.3-p448, Rails 3.2.17, and Spree 2.0.0. I'd love to push it to Ruby 2.1.1, Rails 4.1-stable, and Spree 2.1.0.
First things first:
I went to the gemfile and on line 2 wrote ruby '2.1.1'. This is to do number 1: upgrade the language itself. In the terminal I did the usual bundle and got an error. Discovered the debugger gem doesn't work in 2.x territory. Highlighted it. Pushed delete. Chuckled. Ran bundle. Smiled of delight as it was so nice to see everything work with such a complex system.
Then I ran bundle exec rake db:test:prepare...
First error:
rake aborted!
cannot load such file -- iconv
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/csv_builder-2.1.0/lib/csv_builder.rb:14:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
/Users/benamorgan/Sites/not_getting_name_of_site/config/application.rb:7:in `<top (required)>'
/Users/benamorgan/Sites/not_getting_name_of_site/Rakefile:5:in `require'
/Users/benamorgan/Sites/not_getting_name_of_site/Rakefile:5:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
OK... In the gemfile...
gem 'iconv'
run bundle exec rake db:test:prepare again after a bundle:
Digest::Digest is deprecated; use Digest
rake aborted!
no implicit conversion of nil into String
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `connect'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `initialize'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/model_schema.rb:224:in `table_exists?'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/attribute_methods.rb:122:in `attribute_method?'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:40:in `block in delegate_belongs_to'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:39:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:39:in `delegate_belongs_to'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:3:in `<class:Gateway>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:2:in `<module:Spree>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:1:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:469:in `block in load_file'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:639:in `new_constants_in'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:468:in `load_file'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:353:in `require_or_load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:502:in `load_missing_constant'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:192:in `block in const_missing'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:190:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:190:in `const_missing'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/engine.rb:59:in `block in <class:Engine>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:30:in `instance_exec'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:30:in `run'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:54:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:54:in `run_initializers'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:136:in `initialize!'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/benamorgan/Sites/not_getting_name_of_site/config/environment.rb:5:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:103:in `require_environment!'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:test:prepare => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
My question here really isn't how do I fix this or why is it all breaking, but do you have any pointers? How do I find out where Digest::Digest is coming from? We aren't using it in the site, therefore its a gem problem. I'm probably going to have to deal with more of those "deprecation" warnings, so before I blow hours and hours on it, I just need to know if anyone else has had to go through anything of what I'm attempting right now.
Horror stories much appreciated.
I don't think Digest is the cause of your problems. It seems that MySQL can't connect to your database correctly. Are you sure that your config/database.yml settings are correct for your current environment?
I don't know for certain, but if the error is pointing directly at this line then it's my best guess that you've got your database mis-configured within config/database.yml.
I've found that I get the same error message whenever my installed version of csv_builder is out of sync with my installed version of MRI.
I see you're using MRI 2.1.1 and csv_builder 2.1.0. You can possibly fix this issue by removing the iconv gem, and bumping your version of csv_builder so that it matches the version of MRI:
# Gemfile
gem 'csv_builder', '2.1.1'
> bundle update csv_builder
> bundle exec rake tes
Worked for me... YMMV etc

Exception encountered: #<RuntimeError: Application has been already initialized.> backtrace:

I am working my way through the Ruby on Rails Tutorial. In chapter 5, I've hit another bump in the road that I can't figure out nor find a solution for.
For one, my home page has dissapeared and I don't know why. That is, for some reason the access to it is gone.
And when I run the test. I get the following response:
Exception encountered: RuntimeError: Application has been already initialized.
backtrace:
Can someone help?
Here is the backtrace (with some helpful formatting for easier viewing):
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/application.rb:135:in `initialize!'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/tomgalpin/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/Users/tomgalpin/rails_projects/sample_app/spec/spec_helper.rb:3:in `<top (required)>'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `block in load'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:11:in `block in run'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/forker.rb:21:in `block in initialize'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/forker.rb:18:in `fork'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/forker.rb:18:in `initialize'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/tomgalpin/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/spork-0.9.2/lib/spork/server.rb:48:in `run'
/Users/tomgalpin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/Users/tomgalpin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/Users/tomgalpin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/Users/tomgalpin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/Users/tomgalpin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
This fixed the issue for me:
bundle exec spork --bootstrap

Resources