XingFramework/xing-framework

Errors on Rake Develop

Closed this issue · 3 comments

Hi, I seem to be getting a few errors with rake develop:

  1. If redis isn't running, I have to open a separate terminal and run redis (I thought that the build script would do this, maybe I'm wrong).
  2. I'm also getting some 'pg' errors, but after rake develop finishes running, the app appears to be working properly. Below is the output:

There was an error while trying to load the gem 'pg'.
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in rescue in block (2 levels) in require' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:inblock (2 levels) in require'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in each' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:inblock in require'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in each' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:inrequire'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler.rb:99:in require' /Users/stevenmagelowitz/projects/xing/crowdfundr/backend/config/application.rb:7:in<top (required)>'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:241:in require' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:241:inboot_system'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:50:in run' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/bin/sidekiq:13:in<top (required)>'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/sidekiq:23:in load' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/sidekiq:23:in

'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:in eval' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:in'
=> 1
rake aborted!
Command 'bundle exec sidekiq' failed with exit status 1:
stdout:[empty]
stderr:
There was an error while trying to load the gem 'pg'.
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in rescue in block (2 levels) in require' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:inblock (2 levels) in require'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in each' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:inblock in require'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in each' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:inrequire'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler.rb:99:in require' /Users/stevenmagelowitz/projects/xing/crowdfundr/backend/config/application.rb:7:in<top (required)>'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:241:in require' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:241:inboot_system'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/lib/sidekiq/cli.rb:50:in run' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/sidekiq-3.5.4/bin/sidekiq:13:in<top (required)>'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/sidekiq:23:in load' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/sidekiq:23:in'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:in `eval'

/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/bin/ruby_executable_hooks:15:in `'

/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/caliph-0.3.1/lib/caliph/command-run-result.rb:74:in must_succeed!' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/xing-root-1.0.0.pre.beta/lib/xing/edicts/clean-run.rb:34:inblock (2 levels) in action'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/xing-root-1.0.0.pre.beta/lib/xing/edicts/clean-run.rb:25:in chdir' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/xing-root-1.0.0.pre.beta/lib/xing/edicts/clean-run.rb:25:inblock in action'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler.rb:219:in block in with_clean_env' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler.rb:199:inwith_original_env'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/bundler-1.11.2/lib/bundler.rb:205:in with_clean_env' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/xing-root-1.0.0.pre.beta/lib/xing/edicts/clean-run.rb:24:inaction'
/Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/edict-0.0.1/lib/edict/rule.rb:19:in enact' /Users/stevenmagelowitz/.rvm/gems/ruby-2.2.0-preview1/gems/xing-root-1.0.0.pre.beta/lib/xing/tasks/tasklib.rb:12:inblock in edict_task'
Tasks: TOP => develop:service:sidekiq
(See full trace by running task with --trace)
=> 0

@stevepm On issue #1: Yes at the moment having redis running is considered a dependency/prerequisite for Xing. (Because all the apps we've built with it use sidekiq heavily). However, since the current generation new application doesn't actually use it, we are looking at making it an optional config in the near future.

In the meantime, you can either work around it by going ahead and installing and running redis (it's very low impact, you can generally just leave it running), or by overwriting the rake tasks that depend on it. I haven't tested it yet, but the following should work:

A) in the backend Rakefile (or backend/lib/tasks), define a rake tasks dependencies:redis:running and dependencies:redis:installed, both of which do nothing.

(What you're trying to do here is disable the following code from xing-backend, which exists to check that your system is set up for development and alert you if it is not.)
https://github.com/XingFramework/xing-backend/blob/master/lib/xing/tasks/dependencies_common.rake#L39-L46

B) In the root Rakefile of your project, define a rake task develop:service:sidekiq that doesn't do anything.

(What you're trying to do here is override this code, which will execute but produce  errors if redis is not running:)
https://github.com/XingFramework/xing-root/blob/master/lib/xing/tasks/develop.rb#L117-L120

On Issue #2, I'm a bit confused. Though the error says it was trying to load pg, the stack traces indicate that the issue occurs when trying to start up sidekiq. Maybe solving the redis issue above will fix it at the same time?

@stevepm Ignore my previous suggestion -- i forgot that defining a new rake task would append behavior instead over override the old behavior.

If you'd like to run without redis, this quick fix should get you going. Drop these two lines at the bottom of backend/Rakefile:

Rake::Task['dependencies:redis:installed'].clear
Rake::Task['dependencies:redis:running'].clear

That will prevent rake develop from looking for redis before running. rake develop will still try to start sidekiq -- I can't find an easy workaround for that yet -- and so the sidekiq panel in your console will show errors, but you can safely ignore these - the rest of xing will keep working fine without it.

Hello, you can now disable sidekiq (or any other rake develop process) with the latest version of xing-root, 1.0.0-beta.2. Change the line for xing-root in the root directory Gemfile so it reads:

gem 'xing-root', '1.0.0-beta.2'

then bundle.

Now go in the Rakefile at the root of the project, and change the line that reads Xing::Tasks::Develop.new so it reads:

Xing::Tasks::Develop.new do |dev|
  dev.enabled_services.delete(:sidekiq)
end

We are working on providing a config file so you can select which services to run more easily, but for now this is a working solution. Going to go ahead and close this issue for the time being.