DevProgress / HillaryBNB

Home sharing app for Hillary Clinton supporters
Other
10 stars 13 forks source link

Missing Airbrake env variables required #23

Closed kmiyashiro closed 8 years ago

kmiyashiro commented 8 years ago

Not mentioned in the README what to do for these variables in development mode: https://github.com/DevProgress/HillaryBNB/commit/78a92a2c042d54e33538560a95cf95bf7aeacc7b#diff-33e8e74514712ce4597178028340798dR16

I've tried setting in my env vars and even hardcoding it into the airbrake initializer, I always get this error when trying to run export RAILS_ENV=development; docker-compose up -d web.

Stack ``` Building web Step 1 : FROM heroku/ruby # Executing 7 build triggers... Step 1 : COPY Gemfile Gemfile.lock /app/user/ ---> Using cache Step 1 : RUN bundle install --path /app/heroku/ruby/bundle --jobs 4 ---> Using cache Step 1 : ADD . /app/user Step 1 : ENV RAILS_ENV production ---> Running in 324658287fa8 Step 1 : ENV SECRET_KEY_BASE $(openssl rand -base64 32) ---> Running in 66f38f6ae100 Step 1 : RUN bundle exec rake assets:precompile ---> Running in 85e9fdda2aa3 warning: parser/current is loading parser/ruby22, which recognizes warning: 2.2.5-compliant syntax, but you are running 2.2.3. warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri. rake aborted! Airbrake::Error: both :project_id and :project_key are required /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-ruby-1.4.3/lib/airbrake-ruby/notifier.rb:34:in `initialize' /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-ruby-1.4.3/lib/airbrake-ruby.rb:105:in `new' /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-ruby-1.4.3/lib/airbrake-ruby.rb:105:in `configure' /app/user/config/initializers/airbrake.rb:11:in `' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:652:in `block in load_config_initializer' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:651:in `load_config_initializer' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:616:in `block (2 levels) in ' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `each' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `block in ' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!' /app/user/config/environment.rb:5:in `' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency' /app/heroku/ruby/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!' /app/heroku/ruby/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks' /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-5.4.1/lib/airbrake/rake/task_ext.rb:19:in `execute' /app/heroku/ruby/bundle/ruby/2.2.0/gems/sprockets-rails-3.0.4/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define' /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-5.4.1/lib/airbrake/rake/task_ext.rb:19:in `execute' /app/heroku/ruby/bundle/ruby/2.2.0/gems/rake-11.2.2/exe/rake:27:in `' Tasks: TOP => environment (See full trace by running task with --trace) ERROR: Service 'web' failed to build: The command '/bin/sh -c bundle exec rake assets:precompile' returned a non-zero code: 1 ```
mt0321 commented 8 years ago

I've got a similar issue, when running docker-compose build:

Airbrake::Error: both :project_id and :project_key are required /app/heroku/ruby/bundle/ruby/2.2.0/gems/airbrake-ruby-1.4.3/lib/airbrake-ruby/notifier.rb:34:in `initialize'

kmiyashiro commented 8 years ago

It seems that is always running the build step with RAILS_ENV=production, even when explicitly exporting or setting RAILS_ENV=development.

Hardcoding the values as strings in the initializer got me past the build step, but after bringing up the container with docker-compose up web it still does not serve anything on localhost:8080. Trying to attach to the container with docker attach just hangs.

mt0321 commented 8 years ago

Made a fix to avoid having to hard-code Airbrake values in order to get the build to work, and the clarified development environment setup instructions accordingly: https://github.com/DevProgress/HillaryBNB/commit/7c239b30cb7213615416cf7e85864d14b53b1ad2

Following those instructions I am able to get the site up and running and serving traffic on localhost:8080. (I sometimes have had to run docker-compose up -d web multiple times before the server will start; not sure why.) FWIW these are the docker versions I'm using:

% docker -v Docker version 1.11.2, build b9f10c9 % docker-compose -v docker-compose version 1.7.1, build 0a9ab35

Leaving this issue open, pending verification of fix.

kmiyashiro commented 8 years ago

Confirmed this is the fix. However, it doesn't work by going to localhost:8080 since I have to point it to the docker machine IP. This raises another issue with the docs since Google OAuth doesn't requires a hostname and disallows IPs, I'll open another issue.