sunlightlabs / opencongress

An open website for opening Congress.
http://www.opencongress.org
GNU General Public License v3.0
48 stars 16 forks source link

OpenCongress Rake db:init Failed #505

Closed Anyoks closed 9 years ago

Anyoks commented 9 years ago

Local installation of open congress worked well till I ran Rake db:init. I get a Raven warning then a rake halt with an error siting a problem with missing api_keys. Here is the full command line error output.

opencongress-master$ rake db:init

* [Raven] Unable to load raven/integrations/delayed_job: uninitialized constant Delayed::Plugin * [Raven] Event not sent due to excluded environment: default rake aborted! Missing setting 'texas_am_api_key' in /home/orinamokaya/Desktop/Linux/Rails/uwazi/opencongress-master/config/api_keys.yml /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/settingslogic-2.0.9/lib/settingslogic.rb:189:in missing_key' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/settingslogic-2.0.9/lib/settingslogic.rb:117:inmethod_missing' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/settingslogic-2.0.9/lib/settingslogic.rb:66:in method_missing' /home/orinamokaya/Desktop/Linux/Rails/uwazi/opencongress-master/config/initializers/geocoder.rb:17:in<top (required)>' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in load' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:inblock in load' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in block in load_dependency' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:innew_constants_in' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in load_dependency' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:inload' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/engine.rb:201:in block (2 levels) in <class:Engine>' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/engine.rb:200:ineach' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/engine.rb:200:in block in <class:Engine>' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/initializable.rb:25:ininstance_exec' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/initializable.rb:25:in run' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/initializable.rb:50:inblock in run_initializers' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/initializable.rb:49:in each' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/initializable.rb:49:inrun_initializers' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/application.rb:134:in initialize!' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/application.rb:77:inmethod_missing' /home/orinamokaya/Desktop/Linux/Rails/uwazi/opencongress-master/config/environment.rb:5:in <top (required)>' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:inrequire' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in block in require' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:inblock in load_dependency' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in new_constants_in' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:inload_dependency' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in require' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/application.rb:103:inrequire_environment!' /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/railties-3.0.20/lib/rails/application.rb:218:in `block in initialize_tasks' Tasks: TOP => db:init => environment (See full trace by running task with --trace)

opencongress-master$

crdunwel commented 9 years ago

Hey there. Please add a dummy entry for "texas_am_api_key" in your api_keys.yml file. I've added an entry to the example file so you can copy from there too. Let us know if you encounter any other issues.

Anyoks commented 9 years ago

Thank you so Much. that worked. I just ran the Server which started up okay. But the page at local host 3000 says; Secret should be something secure, like "a1c959a3289296b41fa432f41052fefe". The value you provided, "xxx", is shorter than the minimum length of 30 characters

and the command line error is:

ArgumentError (Secret should be something secure, like "a1c959a3289296b41fa432f41052fefe". The value you provided, "xxx", is shorter than the minimum length of 30 characters): lib/strip_empty_sessions.rb:27:in `call'

Rendered /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/actionpack-3.0.20/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms) Rendered /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/actionpack-3.0.20/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.3ms) Rendered /home/orinamokaya/.rvm/gems/ruby-1.9.3-p484@oc/gems/actionpack-3.0.20/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (9.8ms)

Anyoks commented 9 years ago

So I'm thinking that maybe (Thought I still don't know) the values with xx in the api_keys.yml file should be replaced right? But is there a criteria for replacement? will arbitrary characters suffice? And if I place arbitrary values, will they haunt me much later?

Thank you for your time.

Anyoks commented 9 years ago

after changing the 'xxx' in my api_keys.yml nothing happens. Could you please help me out?

timball commented 9 years ago

you need to pick a secret of sufficient length , at least 30 in this case .

that should do you for.

--timball

please pardom the two thumbed typist On Feb 25, 2015 6:37 AM, "Anyoks" notifications@github.com wrote:

after changing the 'xxx' in my api_keys.yml nothing happens. Could you please help me out?

— Reply to this email directly or view it on GitHub https://github.com/sunlightlabs/opencongress/issues/505#issuecomment-75946267 .

crdunwel commented 9 years ago

Due to the large size and scope of the project, it's difficult to provide a complete and working deployment out of the box. We utilize a number of services throughout the app that require an API key from the respective provider. Some functionality won't work without a specific key (such as the texas_am_api_key for geolocation). We obviously can't provide these keys to the public because they're registered for use at our organization. That being said, you can obtain your own keys or alter the code in your own fork to utilize a different service (or cut out the functionality altogether) as long as you comply with the GPLv3 license. Hopefully this clarifies the situation.

Anyoks commented 9 years ago

Thank you so Much! That really shed light on the issue. I totally understand what you mean. That being said, I'd like to know where I can obtain such a key and how to add it, because adding it to the api_key.yml file doesn't make a difference in the running of the app. Is there a procedure to doing it? or where I can read up on how to change it or understand it more? there's not much information around. I hope I'm not asking too much. Thank you very much.

timball commented 9 years ago

https://github.com/sunlightlabs/opencongress/blob/master/config/api_keys.yml.example

in your checkout of the code , you must rename the api_keys.yml.example file to api_keys.yml

$ cd config/
$ mv api_keys.yml.example api_keys.yml
$ vi api_keys.yml

AND then EDIT the api_keys.yml file with all the needed api credentials from all the required services . each service is mentioned very clearly in the api_keys.yml file . we use over 22 services each w/ unique authorization credentials, some services like bluestate digital you may not want or need , you will have to fork and adjust the code to your specific needs .

--timball

Anyoks commented 9 years ago

Awesome, quick clarification thought, Should I do this before I do a bundle install, before migrating the database and all right?

timball commented 9 years ago

i believe it would help , but is not strictly necessary .

Anyoks commented 9 years ago

Thank you very much. I'll get back to you tomorrow after a trial.

Anyoks commented 9 years ago

So I found what the issue was. the application needed a rails secret key, in the application_settings.yml. adding it fixed the issue. Thanks for your help.