Api key must be initialized (ArgumentError) - ruby-on-rails

So, I am currently contributing to open source (React on Rails app).
I am getting the following error when I run: foreman start -f Procfile.static
The output on the terminal is:
Rajs-MacBook-Pro:Empirical-Core raj$ foreman start -f Procfile.static
17:03:40 rails.1 | started with pid 8018
17:03:40 worker.1 | started with pid 8019
17:03:40 rails-client-assets.1 | started with pid 8020
17:03:40 rails-server-assets.1 | started with pid 8021
17:03:40 redis-sidekiq.1 | started with pid 8022
17:03:40 redis-testing.1 | started with pid 8023
17:03:40 redis-caching.1 | started with pid 8024
17:03:40 redis-sidekiq.1 | 8022:C 18 Mar 17:03:40.294 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
17:03:40 redis-testing.1 | 8023:C 18 Mar 17:03:40.294 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
17:03:40 redis-caching.1 | 8024:C 18 Mar 17:03:40.293 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
17:03:40 redis-sidekiq.1 | 8022:C 18 Mar 17:03:40.298 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=8022, just started
17:03:40 redis-testing.1 | 8023:C 18 Mar 17:03:40.297 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=8023, just started
17:03:40 redis-caching.1 | 8024:C 18 Mar 17:03:40.295 # Redis version=4.0.8, bits=64, commit=00000000, modified=0, pid=8024, just started
17:03:40 redis-sidekiq.1 | 8022:C 18 Mar 17:03:40.298 # Configuration loaded
17:03:40 redis-testing.1 | 8023:C 18 Mar 17:03:40.297 # Configuration loaded
17:03:40 redis-caching.1 | 8024:C 18 Mar 17:03:40.295 # Configuration loaded
17:03:40 redis-sidekiq.1 | 8022:M 18 Mar 17:03:40.300 * Increased maximum number of open files to 10032 (it was originally set to 256).
17:03:40 redis-testing.1 | 8023:M 18 Mar 17:03:40.298 * Increased maximum number of open files to 10032 (it was originally set to 256).
17:03:40 redis-caching.1 | 8024:M 18 Mar 17:03:40.296 * Increased maximum number of open files to 10032 (it was originally set to 256).
17:03:40 redis-testing.1 | 8023:M 18 Mar 17:03:40.355 * Running mode=standalone, port=6378.
17:03:40 redis-sidekiq.1 | 8022:M 18 Mar 17:03:40.355 * Running mode=standalone, port=6379.
17:03:40 redis-testing.1 | 8023:M 18 Mar 17:03:40.355 # Server initialized
17:03:40 redis-sidekiq.1 | 8022:M 18 Mar 17:03:40.355 # Server initialized
17:03:40 redis-sidekiq.1 | 8022:M 18 Mar 17:03:40.356 * Ready to accept connections
17:03:40 redis-caching.1 | 8024:M 18 Mar 17:03:40.356 * Running mode=standalone, port=7654.
17:03:40 redis-caching.1 | 8024:M 18 Mar 17:03:40.356 # Server initialized
17:03:40 redis-caching.1 | 8024:M 18 Mar 17:03:40.356 * Ready to accept connections
17:03:40 redis-testing.1 | 8023:M 18 Mar 17:03:40.356 * Ready to accept connections
17:03:40 rails-server-assets.1 |
17:03:40 rails-server-assets.1 | > # build:dev:server /Users/raj/Desktop/Empirical-Core
17:03:40 rails-server-assets.1 | > (cd client && npm run build:dev:server --silent)
17:03:40 rails-server-assets.1 |
17:03:40 rails-client-assets.1 |
17:03:40 rails-client-assets.1 | > # build:dev:client /Users/raj/Desktop/Empirical-Core
17:03:40 rails-client-assets.1 | > (cd client && npm run build:dev:client --silent)
17:03:40 rails-client-assets.1 |
17:03:41 rails-server-assets.1 |
17:03:41 rails-server-assets.1 | Webpack is watching the files…
17:03:41 rails-server-assets.1 |
17:03:42 rails-client-assets.1 | Webpack dev build for Rails
17:03:42 rails-client-assets.1 |
17:03:42 rails-client-assets.1 | Webpack is watching the files…
17:03:42 rails-client-assets.1 |
17:03:43 rails-server-assets.1 | Hash: 4e792d6ddf1ac233e502
17:03:43 rails-server-assets.1 | Version: webpack 3.11.0
17:03:43 rails-server-assets.1 | Time: 1283ms
17:03:43 rails-server-assets.1 | Asset Size Chunks Chunk Names
17:03:43 rails-server-assets.1 | server-bundle.js 264 kB 0 [emitted] [big] main
17:03:43 rails-server-assets.1 | [89] (webpack)/buildin/global.js 509 bytes {0} [built]
17:03:43 rails-server-assets.1 | [124] multi babel-polyfill 28 bytes {0} [built]
17:03:43 rails-server-assets.1 | + 325 hidden modules
17:03:44 rails-client-assets.1 | (node:8031) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
17:03:44 rails-client-assets.1 | parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
17:03:51 worker.1 | I, [2018-03-18T17:03:51.894987 #8019] INFO -- sentry: ** [Raven] Raven 2.7.1 configured not to capture errors: DSN not set
17:03:52 worker.1 | W, [2018-03-18T17:03:52.626113 #8019] WARN -- : [SKYLIGHT] [1.5.0] Running Skylight in development mode. No data will be reported until you deploy your app.
17:03:52 worker.1 | (To disable this message for all local apps, run `skylight disable_dev_warning`.)
17:03:52 rails.1 | W, [2018-03-18T17:03:52.626636 #8018] WARN -- : [SKYLIGHT] [1.5.0] Running Skylight in development mode. No data will be reported until you deploy your app.
17:03:52 rails.1 | (To disable this message for all local apps, run `skylight disable_dev_warning`.)
17:03:53 rails.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api/client.rb:196:in `check_api_key!': Api key must be initialized (ArgumentError)
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api/client.rb:28:in `initialize'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api.rb:15:in `new'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api.rb:15:in `initialize'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config/initializers/salesmachine.rb:5:in `new'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config/initializers/salesmachine.rb:5:in `<top (required)>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:166:in `instrument'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:651:in `load_config_initializer'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `each'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `call'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
17:03:53 rails.1 | from /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config/environment.rb:5:in `<top (required)>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/skylight-1.5.0/lib/skylight/probes.rb:81:in `require'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/skylight-1.5.0/lib/skylight/probes.rb:81:in `require'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config.ru:3:in `block in <main>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/builder.rb:55:in `instance_eval'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/builder.rb:55:in `initialize'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config.ru:in `new'
17:03:53 rails.1 | from /Users/raj/Desktop/Empirical-Core/config.ru:in `<main>'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/builder.rb:49:in `eval'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/builder.rb:49:in `new_from_string'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/builder.rb:40:in `parse_file'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/server.rb:300:in `build_app_and_options_from_config'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/server.rb:209:in `app'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/server.rb:61:in `app'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/rack-1.6.8/lib/rack/server.rb:337:in `wrapped_app'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/server.rb:139:in `log_to_stdout'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/server.rb:78:in `start'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in `server'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
17:03:53 rails.1 | from /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in `<top (required)>'
17:03:53 rails.1 | from bin/rails:4:in `require'
17:03:53 rails.1 | from bin/rails:4:in `<main>'
17:03:53 worker.1 | Api key must be initialized
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api/client.rb:196:in `check_api_key!'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api/client.rb:28:in `initialize'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api.rb:15:in `new'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/salesmachine-ruby-1.0.0/lib/salesmachine/api.rb:15:in `initialize'
17:03:53 worker.1 | /Users/raj/Desktop/Empirical-Core/config/initializers/salesmachine.rb:5:in `new'
17:03:53 worker.1 | /Users/raj/Desktop/Empirical-Core/config/initializers/salesmachine.rb:5:in `<top (required)>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `block in load'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:268:in `load'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:652:in `block in load_config_initializer'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/notifications.rb:166:in `instrument'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:651:in `load_config_initializer'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `each'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/engine.rb:615:in `block in <class:Engine>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `instance_exec'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:30:in `run'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:55:in `block in run_initializers'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `each'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:44:in `tsort_each_child'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `call'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
17:03:53 worker.1 | /Users/raj/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/initializable.rb:54:in `run_initializers'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/application.rb:352:in `initialize!'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `public_send'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/railties-4.2.7.1/lib/rails/railtie.rb:194:in `method_missing'
17:03:53 worker.1 | /Users/raj/Desktop/Empirical-Core/config/environment.rb:5:in `<top (required)>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/skylight-1.5.0/lib/skylight/probes.rb:81:in `require'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/skylight-1.5.0/lib/skylight/probes.rb:81:in `require'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `block in require'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:240:in `load_dependency'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/activesupport-4.2.7.1/lib/active_support/dependencies.rb:274:in `require'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/sidekiq-5.0.5/lib/sidekiq/cli.rb:254:in `boot_system'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/sidekiq-5.0.5/lib/sidekiq/cli.rb:54:in `run'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/gems/sidekiq-5.0.5/bin/sidekiq:12:in `<top (required)>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/bin/sidekiq:23:in `load'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/bin/sidekiq:23:in `<main>'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/bin/ruby_executable_hooks:15:in `eval'
17:03:53 worker.1 | /Users/raj/.rvm/gems/ruby-2.3.1#quill/bin/ruby_executable_hooks:15:in `<main>'
17:03:53 rails.1 | I, [2018-03-18T17:03:51.895036 #8018] INFO -- sentry: ** [Raven] Raven 2.7.1 configured not to capture errors: DSN not set
17:03:53 rails.1 | => Booting Puma
17:03:53 rails.1 | => Rails 4.2.7.1 application starting in development on http://0.0.0.0:3000
17:03:53 rails.1 | => Run `rails server -h` for more startup options
17:03:53 rails.1 | => Ctrl-C to shutdown server
17:03:53 rails.1 | Exiting
17:03:53 worker.1 | exited with code 1
17:03:53 system | sending SIGTERM to all processes
17:03:53 rails.1 | exited with code 1
17:03:53 redis-sidekiq.1 | 8022:signal-handler (1521372833) Received SIGTERM scheduling shutdown...
17:03:53 redis-testing.1 | 8023:signal-handler (1521372833) Received SIGTERM scheduling shutdown...
17:03:53 redis-caching.1 | 8024:signal-handler (1521372833) Received SIGTERM scheduling shutdown...
17:03:53 redis-caching.1 | 8024:M 18 Mar 17:03:53.469 # User requested shutdown...
17:03:53 redis-testing.1 | 8023:M 18 Mar 17:03:53.469 # User requested shutdown...
17:03:53 redis-caching.1 | 8024:M 18 Mar 17:03:53.469 # Redis is now ready to exit, bye bye...
17:03:53 redis-testing.1 | 8023:M 18 Mar 17:03:53.469 # Redis is now ready to exit, bye bye...
17:03:53 redis-sidekiq.1 | 8022:M 18 Mar 17:03:53.489 # User requested shutdown...
17:03:53 redis-sidekiq.1 | 8022:M 18 Mar 17:03:53.489 # Redis is now ready to exit, bye bye...
17:03:53 redis-caching.1 | exited with code 0
17:03:53 redis-testing.1 | exited with code 0
17:03:53 redis-sidekiq.1 | exited with code 0
17:03:53 rails-server-assets.1 | terminated by SIGTERM
17:03:53 rails-client-assets.1 | terminated by SIGTERM
Please help!

Related

cannot load such file -- exception_notification (LoadError)

I'm attempting to send exceptions to a slack channel. This was my set up:
Added the following to my Gemfile
gem 'exception_notification'
gem 'slack-notifier'
Created a new initializer config/initializers/errors.rb
# Works in development with or without this require
require 'exception_notification'
Rails.application.config.middleware.use(
ExceptionNotification::Rack,
:slack => {
:webhook_url => ENV["SLACK_ERROR_WEBHOOOK_URL"]
}
)
I have rebuilt my docker images and deleted the gem cache volumes.
This works properly in my development environment (errors get sent to slack), but isn't working on my production server. The only real difference that I can think of between the two is the RAILS_ENV value, at least configuration-wise. I'm fairly new to Rails however, as well as deploying to a production environment.
Immediately upon starting the app (docker-compose up) it exits with the following error:
/usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- exception_notification (LoadError)
app_1 | from /usr/local/bundle/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
app_1 | from /app/config/initializers/errors.rb:1:in `<main>'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:319:in `block in load'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:319:in `load'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:667:in `block in load_config_initializer'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/notifications.rb:182:in `instrument'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:666:in `load_config_initializer'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:624:in `block (2 levels) in <class:Engine>'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:623:in `each'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/engine.rb:623:in `block in <class:Engine>'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `instance_exec'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `run'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in `each'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:50:in `tsort_each_child'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:415:in `call'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `call'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
app_1 | from /usr/local/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in `run_initializers'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/application.rb:363:in `initialize!'
app_1 | from /app/config/environment.rb:5:in `<main>'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
app_1 | from /usr/local/bundle/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:49:in `require_relative'
app_1 | from config.ru:3:in `block in <main>'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/builder.rb:116:in `new_from_string'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/builder.rb:105:in `load_file'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/builder.rb:66:in `parse_file'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:349:in `build_app_and_options_from_config'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:249:in `app'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:422:in `wrapped_app'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:312:in `block in start'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:379:in `handle_profiling'
app_1 | from /usr/local/bundle/gems/rack-2.2.2/lib/rack/server.rb:311:in `start'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:39:in `start'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:147:in `block in perform'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `tap'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands/server/server_command.rb:138:in `perform'
app_1 | from /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
app_1 | from /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
app_1 | from /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in `perform'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/command.rb:46:in `invoke'
app_1 | from /usr/local/bundle/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<main>'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
app_1 | from /usr/local/bundle/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
app_1 | from /usr/local/bundle/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
app_1 | from bin/rails:4:in `<main>'
I've verified that the gem exception_notification is indeed installed by running docker exec -it <container-name> gem list, which includes exception_notification (4.4.3) in the output, and also running docker exec -it <container-name> gem which exception_notification which gives /usr/local/bundle/gems/exception_notification-4.4.3/lib/exception_notification.rb
Running Ruby on Rails v6.0.2 and Ruby v2.6.3
I had some similar problems when using Rails and Docker. Bootsnap cache may be stale.
Try removing the cache
rm tmp/cache/bootsnap-load-path-cache
You might also try restarting Spring
spring stop
It should restart automatically.
Try require 'exception_notification/rails'

Possible sprockets-rails gem issue?

I've just created a new Vagrant box to be able to develop my Rails app. The box is brand new and has Ruby, MySQL etc installed to be able to develop.
I've installed all gems etc but when I try to start the app I get the following:
vagrant#neiltongesite:/vagrant/source$ bundle exec foreman start
17:45:02 rails.1 | started with pid 5910
17:45:05 rails.1 | /home/vagrant/.gem/ruby/2.2.7/gems/sprockets-rails-3.2.0/lib/sprockets/railtie.rb:108:in `block in <class:Railtie>': undefined method `+' for false:FalseClass (NoMethodError)
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `instance_exec'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/initializable.rb:30:in `run'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/initializable.rb:55:in `block in run_initializers'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:345:in `each'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:345:in `call'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
17:45:05 rails.1 | from /opt/rubies/ruby-2.2.7/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/initializable.rb:54:in `run_initializers'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/application.rb:352:in `initialize!'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `public_send'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/railtie.rb:194:in `method_missing'
17:45:05 rails.1 | from /vagrant/source/config/environment.rb:5:in `<top (required)>'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `block in require'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in `load_dependency'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in `require'
17:45:05 rails.1 | from /vagrant/source/config.ru:3:in `block in <main>'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/builder.rb:55:in `instance_eval'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/builder.rb:55:in `initialize'
17:45:05 rails.1 | from /vagrant/source/config.ru:in `new'
17:45:05 rails.1 | from /vagrant/source/config.ru:in `<main>'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/builder.rb:49:in `eval'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/builder.rb:49:in `new_from_string'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/builder.rb:40:in `parse_file'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/server.rb:299:in `build_app_and_options_from_config'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/server.rb:208:in `app'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/server.rb:61:in `app'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/rack-1.6.5/lib/rack/server.rb:336:in `wrapped_app'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/server.rb:139:in `log_to_stdout'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/server.rb:78:in `start'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:75:in `server'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
17:45:05 rails.1 | from /home/vagrant/.gem/ruby/2.2.7/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>'
17:45:05 rails.1 | from bin/rails:4:in `require'
17:45:05 rails.1 | from bin/rails:4:in `<main>'
17:45:05 rails.1 | => Booting Puma
17:45:05 rails.1 | => Rails 4.2.5.1 application starting in development on http://0.0.0.0:3000
17:45:05 rails.1 | => Run `rails server -h` for more startup options
17:45:05 rails.1 | => Ctrl-C to shutdown server
17:45:05 rails.1 | Exiting
17:45:05 rails.1 | exited with code 1
17:45:05 system | sending SIGTERM to all processes
I've looked but can't seem to figure out what is causing it.
Anyone able to point me in the right direction?
The exception is thrown on this line, so I guess you have the following somewhere in your configuration files:
config.assets.precompile = false
This configuration setting should define an array of assets that you want to be precompiled, it should not be set to false. See the Rails guides for more info.
To test this hypothesis I configured a test Rails 5 project with the above line and got the same exception:
.../gems/sprockets-rails-3.2.0/lib/sprockets/railtie.rb:108:in `block in <class:Railtie>': undefined method `+' for false:FalseClass (NoMethodError)

Sidekiq: How to get a job to fire once on (re)deployment?

I have a few jobs that query some external APIs. I have two types of jobs.
One job to gather a large amount of data.
And another to keep the data updated every fifteen minutes.
I would like the bulk job to fire one time on deployment to collect that bulk data, then lay dormant while the update job executes on set intervals to keep the data topped off.
How does one set a job to fire one time on deployment?
Edit:
This is what I've tried so far.
With a rake task
# application.rb
config.after_initialize do
Rails.application.load_tasks # Load our Event collection task.
Rake::Task['initialize_event_collection:build_eventbrite'].invoke
Rake::Task['initialize_event_collection:build_meetup'].invoke
end
namespace :initialize_event_collection do
desc "This task fetches Meetup and Eventbrite events in bulk on startup."
task :build_eventbrite do
FetchEventbriteJob.perform_later
end
task :build_meetup do
FetchMeetupJob.perform_later
end
end
It looks like it starts but then it doesn't really go anywhere:
Redis and Puma stuff above...
sidekiq_1 | 2017-03-21T02:20:36.829Z 1 TID-gq6vufr4k INFO: Booting Sidekiq 4.2.3 with redis options {:url=>"redis://redis:6379/"}
sidekiq_1 | 2017-03-21T02:20:37.449Z 1 TID-gq6vufr4k INFO: Running in ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
sidekiq_1 | 2017-03-21T02:20:37.449Z 1 TID-gq6vufr4k INFO: See LICENSE and the LGPL-3.0 for licensing details.
sidekiq_1 | 2017-03-21T02:20:37.450Z 1 TID-gq6vufr4k INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
sidekiq_1 | 2017-03-21T02:20:37.456Z 1 TID-gq6vufr4k INFO: Loading Schedule
sidekiq_1 | 2017-03-21T02:20:37.456Z 1 TID-gq6vufr4k INFO: Schedule empty! Set Sidekiq.schedule
sidekiq_1 | 2017-03-21T02:20:37.457Z 1 TID-gq6vufr4k INFO: Schedules Loaded
sidekiq_1 | 2017-03-21T02:20:37.463Z 1 TID-gq6vufr4k INFO: Reloading Schedule
sidekiq_1 | 2017-03-21T02:20:37.464Z 1 TID-gq6vufr4k INFO: Loading Schedule
sidekiq_1 | 2017-03-21T02:20:37.464Z 1 TID-gq6vufr4k INFO: Scheduling UpdateEventbriteJob {"cron"=>"*/15 * * * *", "class"=>"UpdateEventbriteJob"}
sidekiq_1 | 2017-03-21T02:20:37.969Z 1 TID-gq6vufr4k INFO: Scheduling UpdateMeetupJob {"cron"=>"*/15 * * * *", "class"=>"UpdateMeetupJob"}
sidekiq_1 | 2017-03-21T02:20:38.353Z 1 TID-gq6vufr4k INFO: Scheduling UpdateStatusJob {"cron"=>"0 0 * * *", "class"=>"UpdateStatusJob"}
sidekiq_1 | 2017-03-21T02:20:38.383Z 1 TID-gq6vufr4k INFO: Schedules Loaded
sidekiq_1 | 2017-03-21T02:20:38.383Z 1 TID-gq6vufr4k INFO: Starting processing, hit Ctrl-C to stop
sidekiq_1 | 2017-03-21T02:20:38.610Z 1 TID-gq6wf5uic FetchEventbriteJob JID-6803f9b93ce89e02ccb73d1d INFO: start
sidekiq_1 | 2017-03-21T02:20:38.623Z 1 TID-gq6wf5vp4 FetchEventbriteJob JID-79b83c0d2be3c647d8c8b52e INFO: start
sidekiq_1 | 2017-03-21T02:20:38.652Z 1 TID-gq6wf5v68 FetchMeetupJob JID-5c65f2262582a1e278b9986d INFO: start
sidekiq_1 | 2017-03-21T02:20:38.752Z 1 TID-gq6wf5tx8 FetchMeetupJob JID-cedc08eb695de6c14e371259 INFO: start
sidekiq_1 | 2017-03-21T02:20:38.854Z 1 TID-gq6wf5uqo FetchEventbriteJob JID-227879792a37d35bb6815a5d INFO: start
web_1 | Puma starting in single mode...
web_1 | * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
web_1 | * Min threads: 5, max threads: 5
web_1 | * Environment: development
web_1 | * Listening on tcp://0.0.0.0:3000
web_1 | Use Ctrl-C to stop
I've tried to call a method that calls the same job:
# application.rb
config.after_initialize do
Event.build_eventbrite
Event.build_meetup
end
# event.rb
def build_eventbrite
FetchEventbriteJob.perform_later
end
def build_meetup
FetchMeetupJob.perform_later
end
It looks like Rails doesn't like this approach
sidekiq_1 | 2017-03-21T02:29:23.858Z 1 TID-gqzwqq0wc INFO: Booting Sidekiq 4.2.3 with redis options {:url=>"redis://redis:6379/"}
sidekiq_1 | undefined method `build_eventbrite' for Event (call 'Event.connection' to establish a connection):Class
sidekiq_1 | /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/dynamic_matchers.rb:21:in `method_missing'
sidekiq_1 | /work_project/config/application.rb:29:in `block in <class:Application>'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
sidekiq_1 | /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:65:in `block in <module:Finisher>'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `call'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
sidekiq_1 | /usr/local/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
sidekiq_1 | /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
sidekiq_1 | /work_project/config/environment.rb:5:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/cli.rb:242:in `require'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/cli.rb:242:in `boot_system'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/lib/sidekiq/cli.rb:50:in `run'
sidekiq_1 | /usr/local/bundle/gems/sidekiq-4.2.3/bin/sidekiq:12:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:17:in `load'
sidekiq_1 | /usr/local/bundle/bin/sidekiq:17:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
sidekiq_1 | /usr/local/bundle/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
sidekiq_1 | /usr/local/bundle/bin/bundle:22:in `load'
sidekiq_1 | /usr/local/bundle/bin/bundle:22:in `<main>'
work_project_sidekiq_1 exited with code 1
web_1 | Exiting
web_1 | /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/dynamic_matchers.rb:21:in `method_missing': undefined method `build_eventbrite' for Event (call 'Event.connection' to establish a connection):Class (NoMethodError)
web_1 | from /work_project/config/application.rb:29:in `block in <class:Application>'
web_1 | from /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
web_1 | from /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
web_1 | from /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
web_1 | from /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:65:in `block in <module:Finisher>'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `call'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
web_1 | from /usr/local/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
web_1 | from /work_project/config/environment.rb:5:in `<top (required)>'
web_1 | from /work_project/config.ru:3:in `require_relative'
web_1 | from /work_project/config.ru:3:in `block in <main>'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
web_1 | from /work_project/config.ru:in `new'
web_1 | from /work_project/config.ru:in `<main>'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:59:in `app'
web_1 | from /usr/local/bundle/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:124:in `log_to_stdout'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/server.rb:77:in `start'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
web_1 | from /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
web_1 | from bin/rails:4:in `require'
web_1 | from bin/rails:4:in `<main>'
work_project_web_1 exited with code 1
My docker-compose file:
version: '2'
services:
db:
image: postgres:9.6.0
redis:
image: redis:3.2.4
command: redis-server
ports:
- '6379:6379'
volumes:
- '.:/var/lib/redis/data'
# To run jobs in development, uncomment out this block
sidekiq:
build: .
command: bundle exec sidekiq -C config/sidekiq.yml
env_file: .env
links:
- db
- redis
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
env_file: .env
volumes:
- .:/work_project
ports:
- '3000:3000'
depends_on:
- db
- redis
Maybe a little overkill, but you could look at the Sidekiq Scheduler Gem. It offers a lot, like regular scheduling of jobs, but also includes an option to trigger on startup.

Ruby on Rails - Foreman cannot run

I have the problem that Foreman was running correctly until a few days ago. Yesterday I made a complete upgrade of the all system, so I don't know if this caused the problem.
Anyway I cannot trace the problem back.
To solve the problem I updated all my gems, uninstalled and re-installed the myslq2 gem, but nothing has changed.
I paste the Foreman output
luca#luca-X200MA:~/cmonrails/cmonrails$ foreman start
10:46:36 web.1 | started with pid 6863
10:46:36 memcached.1 | started with pid 6864
10:46:40 web.1 | warning: parser/current is loading parser/ruby21, which recognizes
10:46:40 web.1 | warning: 2.1.7-compliant syntax, but you are running 2.1.2.
10:46:40 web.1 | warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
10:46:42 web.1 | => Booting WEBrick
10:46:42 web.1 | => Rails 4.2.3 application starting in development on http://0.0.0.0:3000
10:46:42 web.1 | => Run `rails server -h` for more startup options
10:46:42 web.1 | => Ctrl-C to shutdown server
10:46:42 web.1 | Exiting
10:46:42 web.1 | /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:50:in `establish_connection'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `each'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/base.rb:315:in `<module:ActiveRecord>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/base.rb:26:in `<top (required)>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:73:in `block in <class:EnvironmentReport>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:99:in `call'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:99:in `block in initialize'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:97:in `each'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:97:in `inject'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/environment_report.rb:97:in `initialize'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:799:in `new'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:799:in `environment_for_connect'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:790:in `generate_environment_report'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:491:in `setup_and_start_agent'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:479:in `check_config_and_start_agent'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/agent/agent.rb:547:in `start'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/control/instance_methods.rb:112:in `start_agent'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/new_relic/control/instance_methods.rb:72:in `init_plugin'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/newrelic_rpm-3.14.0.305/lib/newrelic_rpm.rb:41:in `block in <class:Railtie>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:345:in `each'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:345:in `call'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
10:46:42 web.1 | from /usr/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
10:46:42 web.1 | from /home/luca/cmonrails/cmonrails/config/environment.rb:5:in `<top (required)>'
10:46:42 web.1 | from /home/luca/cmonrails/cmonrails/config.ru:3:in `require'
10:46:42 web.1 | from /home/luca/cmonrails/cmonrails/config.ru:3:in `block in <main>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
10:46:42 web.1 | from /home/luca/cmonrails/cmonrails/config.ru:in `new'
10:46:42 web.1 | from /home/luca/cmonrails/cmonrails/config.ru:in `<main>'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/server.rb:61:in `app'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/server.rb:139:in `log_to_stdout'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/server.rb:78:in `start'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:80:in `block in server'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
10:46:42 web.1 | from /var/lib/gems/2.1.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
10:46:42 web.1 | from bin/rails:8:in `require'
10:46:42 web.1 | from bin/rails:8:in `<main>'
10:46:42 web.1 | exited with code 1
10:46:42 system | sending SIGTERM to all processes
10:46:42 memcached.1 | terminated by SIGTERM
I've seen this often - it seems there is an issues with the latest mysql2 gem. You should try specifying a version that previously worked. I've personally found 0.3.20 fixes the problem. So just update your Gemfile with:
gem 'mysql2', '0.3.20'
Hopefully that should fix it.
My only assumption is that there are some changes in the main mysql2 gem to support Rails 5?

Error with delayed job. Couldn't Parse YAML

I'm passing a csv file to delayed job via the following code.
csv_text = IO.read(params[:emails_import].tempfile.to_path, :encoding => 'UTF-8').gsub(" ", "")
csv_text = csv_text.gsub("\n\n", "\n")
Delayed::Job.enqueue ImportContact.new(#list.id, csv_text), :queue => "import-list-#{#list.id}"
I am receiving the following error message via foreman. Any idea what could be causing this issue? I think the error might be in the csv file, but im not sure where / what is causing the problem.
[Worker(host:ubuntu pid:22678)] Starting job worker
16:50:22 worker.1 | SQL (129.4ms) UPDATE `delayed_jobs` SET locked_at = '2013-04-16 20:50:22', locked_by = 'host:ubuntu pid:22678' WHERE (id = 121 and (locked_at is null or locked_at < '2013-04-16 16:50:22') and (run_at <= '2013-04-16 20:50:22'))
16:50:22 worker.1 | SQL (96.4ms) UPDATE `delayed_jobs` SET locked_by = null, locked_at = null WHERE (locked_by = 'host:ubuntu pid:22678')
16:50:22 worker.1 | rake aborted!
16:50:22 worker.1 | couldn't parse YAML at line 6709 column 4
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:84:in `payload_object'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/backend/base.rb:71:in `name'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:230:in `handle_failed_job'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:191:in `block in run'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:191:in `rescue in run'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:181:in `run'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:238:in `block in reserve_and_run_one_job'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:238:in `reserve_and_run_one_job'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:166:in `block in work_off'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:165:in `times'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:165:in `work_off'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:133:in `block (4 levels) in start'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:132:in `block (3 levels) in start'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:129:in `block (2 levels) in start'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:128:in `loop'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:128:in `block in start'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:7:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:60:in `block in initialize'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:78:in `block in add'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `call'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:65:in `execute'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/lifecycle.rb:38:in `run_callbacks'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/worker.rb:127:in `start'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/gems/delayed_job-3.0.3/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/bin/ruby_noexec_wrapper:14:in `eval'
16:50:22 worker.1 | /home/cory/.rvm/gems/ruby-1.9.2-p320#postpourri/bin/ruby_noexec_wrapper:14:in `<main>'
16:50:22 worker.1 | Tasks: TOP => jobs:work
16:50:22 worker.1 | (See full trace by running task with --trace)
16:50:22 worker.1 | exited with code 1
16:50:22 system | sending SIGTERM to all processes
SIGTERM received
I just ran this code in a brand new Rails app with Delayed::Job installed (modified from what you provided):
class List
attr_accessor :id
end
#list = List.new
#list.id = 123
class ImportContact
def initialize(list_id, csv_text)
#list_id = list_id
#csv_text = csv_text
end
def perform
puts #list_id
puts #csv_text.length
end
end
csv_text = IO.read('test_2000_import_contacts.csv', :encoding => 'UTF-8').gsub(" ", "")
csv_text = csv_text.gsub("\n\n", "\n")
Delayed::Job.enqueue ImportContact.new(#list.id, csv_text), :queue => "import-list-#{#list.id}"
When I ran bundle exec rake jobs:work, everything went through correctly, which would lead me to believe that there is a problem with the way YAML is encoding or decoding the file you are importing.
In particular, I would run
yaml = Delayed::Job.find(121).handler
File.open('job-121.yml', 'w') { |f| f.write(yaml) }
And check through the file around line 6709 column 4.
However, this might be about the time to suggest that you store your files in something like S3 and pass a URL to the ImportContact worker rather than the entire CSV text. This will alleviate the current problem you are running into and help you avoid bloating your database with huge text columns.

Resources