Can't deploy a basic Rails app on Heroku - ruby-on-rails

First of all I am a newbie with Ruby on Rails so sorry if the question seem stupid.
I am following a tutorial about Heroku for Rails app and when I run git push heroku master and go to check on the actual website, I get this message:
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
When I run heroku logs in my console, I get the following:
2018-05-20T03:33:23.748800+00:00 app[api]: Enable Logplex by user xxx.romain#gmail.com
2018-05-20T03:33:23.554110+00:00 app[api]: Release v1 created by user xxx.romain#gmail.com
2018-05-20T03:33:23.748800+00:00 app[api]: Release v2 created by user xxx.romain#gmail.com
2018-05-20T03:33:23.554110+00:00 app[api]: Initial release by user xxx.romain#gmail.com
2018-05-20T03:33:46.000000+00:00 app[api]: Build started by user xxx.romain#gmail.com
2018-05-20T03:34:29.457658+00:00 app[api]: Set LANG, RACK_ENV, RAILS_ENV, RAILS_LOG_TO_STDOUT, RAILS_SERVE_STATIC_FILES, SECRET_KEY_BASE config vars by user xxx.romain#gmail.com
2018-05-20T03:34:29.457658+00:00 app[api]: Release v3 created by user xxx.romain#gmail.com
2018-05-20T03:34:30.828730+00:00 app[api]: Release v4 created by user xxx.romain#gmail.com
2018-05-20T03:34:30.828730+00:00 app[api]: Attach DATABASE (#ref:postgresql-tapered-27211) by user xxx.romain#gmail.com
2018-05-20T03:34:31.131189+00:00 app[api]: Scaled to console#0:Free rake#0:Free web#1:Free worker#0:Free by user xxx.romain#gmail.com
2018-05-20T03:34:31.115804+00:00 app[api]: Release v5 created by user xxx.romain#gmail.com
2018-05-20T03:34:31.115804+00:00 app[api]: Deploy 0248e11a by user xxx.romain#gmail.com
2018-05-20T03:34:31.000000+00:00 app[api]: Build succeeded
2018-05-20T03:34:36.168184+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 57618 -e production`
2018-05-20T03:34:41.855283+00:00 app[web.1]: => Booting Puma
2018-05-20T03:34:41.855302+00:00 app[web.1]: => Rails 5.1.6 application starting in production
2018-05-20T03:34:41.855303+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-05-20T03:34:41.855305+00:00 app[web.1]: Puma starting in single mode...
2018-05-20T03:34:41.855313+00:00 app[web.1]: * Version 3.11.4 (ruby 2.3.4-p301), codename: Love Song
2018-05-20T03:34:41.855315+00:00 app[web.1]: * Min threads: 5, max threads: 5
2018-05-20T03:34:41.855316+00:00 app[web.1]: * Environment: production
2018-05-20T03:34:41.855503+00:00 app[web.1]: * Listening on tcp://0.0.0.0:57618
2018-05-20T03:34:41.855969+00:00 app[web.1]: Use Ctrl-C to stop
2018-05-20T03:34:42.411033+00:00 heroku[web.1]: State changed from starting to up
2018-05-20T03:34:43.450895+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Started GET "/" for 27.32.8.50 at 2018-05-20 03:34:43 +0000
2018-05-20T03:34:43.487004+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Rendering keywords/index.html.erb within layouts/application
2018-05-20T03:34:43.463124+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Processing by KeywordsController#index as HTML
2018-05-20T03:34:44.722888+00:00 heroku[router]: at=info method=GET path="/" host=tweetscoperm.herokuapp.com request_id=5a2cc1ab-9701-42e6-accc-2f372ff837f1 fwd="27.32.8.50" dyno=web.1 connect=1ms service=1278ms status=500 bytes=1827 protocol=https
2018-05-20T03:34:44.715829+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Keyword Load (2.3ms) SELECT "keywords".* FROM "keywords"
2018-05-20T03:34:44.717471+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Rendered keywords/index.html.erb within layouts/application (1230.3ms)
2018-05-20T03:34:44.717773+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] Completed 500 Internal Server Error in 1254ms (ActiveRecord: 33.5ms)
2018-05-20T03:34:44.719239+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1]
2018-05-20T03:34:44.720128+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "keywords" does not exist
2018-05-20T03:34:44.720132+00:00 app[web.1]: ^
2018-05-20T03:34:44.720130+00:00 app[web.1]: LINE 1: SELECT "keywords".* FROM "keywords"
2018-05-20T03:34:44.720134+00:00 app[web.1]: : SELECT "keywords".* FROM "keywords"):
2018-05-20T03:34:44.720461+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 11: </thead>
2018-05-20T03:34:44.720464+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 12:
2018-05-20T03:34:44.720466+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 13: <tbody>
2018-05-20T03:34:44.720468+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 14: <% #keywords.each do |keyword| %>
2018-05-20T03:34:44.720469+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 15: <tr>
2018-05-20T03:34:44.720471+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 16: <td><%= keyword.word %></td>
2018-05-20T03:34:44.720473+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] 17: <td><%= link_to 'Show', keyword %></td>
2018-05-20T03:34:44.720531+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1]
2018-05-20T03:34:44.720593+00:00 app[web.1]: [5a2cc1ab-9701-42e6-accc-2f372ff837f1] app/views/keywords/index.html.erb:14:in `_app_views_keywords_index_html_erb___2939922413078681924_23601960'
2018-05-20T03:34:45.523130+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=tweetscoperm.herokuapp.com request_id=ec46bf49-b91c-4bf2-b017-a15b4cef63a8 fwd="27.32.8.50" dyno=web.1 connect=1ms service=2ms status=200 bytes=143 protocol=https
Looking at that, I couldn't find any reason that would cause a problem.
So far, here is how my database.yml file looks like:
development:
adapter: postgresql
database: tscope_dev
pool: 5
timeout: 5000
test:
adapter: postgresql
database: tscope_test
pool: 5
timeout: 5000
production:
adapter: postgresql
database: tscope_production
pool: 5
timeout: 5000
And my gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.6'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Using PostgreSQL as DB
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'rails_12factor', group: :production
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
ruby '2.3.4'
I created the databse and did the migrations and also ran bundle install as well. It is the most basic application with just one controller generated with a scaffold.
Does anybody has any idea of what could be the problem? Even the smallest tip would help me since I really don't know what to look at right now.
If you need any futher information about my code, feel free to ask.
Thanks in advance :)
EDIT
Solved this issue by running heroku run rake db:migratein the console.
Turned out I haven't ran the migration on Heroku.

This line:
ActionView::Template::Error (PG::UndefinedTable: ERROR: relation "keywords" does not exist
suggests you haven't run your migrations on heroku.
To do that, in your console do:
heroku run rake db:migrate

Related

My Heroku app will not retrieve pages that are associated with a database made in Rails. It works locally on the server, but not after deployment

The database is called "games". I have it being called in a partial that then is rendered in the primary view called "schedule".
Here is where it's breaking down
2022-03-04T13:54:59.252562+00:00 app[web.1]: F, [2022-03-04T13:54:59.252477 #4] FATAL -- : [8695d016-d4be-4ece-b9ae-a31c6546608d]
2022-03-04T13:54:59.252564+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] ActionView::Template::Error (undefined method `[]' for nil:NilClass):
2022-03-04T13:54:59.252564+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 1: <a href="games/game0">
2022-03-04T13:54:59.252565+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 2: <div id= "match">
2022-03-04T13:54:59.252566+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 3: <div id= "team">
2022-03-04T13:54:59.252566+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 4: <div id= "name"> <%= #games[0]["local_team"]%> </div>
2022-03-04T13:54:59.252567+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 5: <div id= "logos"> <%= image_tag #games[0]["local_logos"] %></div>
2022-03-04T13:54:59.252568+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 6: <div id= "scores"> <%= #games[0]["localteam_score"] %> </div>
2022-03-04T13:54:59.252569+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] 7: </div>
2022-03-04T13:54:59.252569+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d]
2022-03-04T13:54:59.252570+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] app/views/schedule/_match.html.erb:4
2022-03-04T13:54:59.252571+00:00 app[web.1]: [8695d016-d4be-4ece-b9ae-a31c6546608d] app/views/schedule/schedule.html.erb:4
2022-03-04T13:54:59.252783+00:00 heroku[router]: at=info method=GET path="/schedule" host=ratedapp.herokuapp.com request_id=8695d016-d4be-4ece-b9ae-a31c6546608d fwd="66.211.28.242" dyno=web.1 connect=4ms service=12ms status=500 bytes=1827 protocol=https
It seems as though it can't retrieve the information from my database on Heroku. I've run "heroku run rails db:migrate".
Here is how my database.yml looks
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
As well as my Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '6.1.4.1'
gem 'bcrypt', '3.1.13'
gem 'image_processing', '1.9.3'
gem 'mini_magick', '4.9.5'
gem 'active_storage_validations', '0.8.9'
gem 'faker', '2.11.0'
gem 'will_paginate', '3.3.0'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'bootstrap-sass', '3.4.1'
gem 'puma', '5.3.1'
gem 'sass-rails', '6.0.0'
gem 'webpacker', '5.4.0'
gem 'turbolinks', '5.2.1'
gem 'rest-client', '2.1'
gem 'sportmonks'
gem 'dotenv'
gem 'jbuilder', '2.10.0'
gem 'bootsnap', '1.7.2', require: false
group :development, :test do
gem 'sqlite3', '1.4.2'
gem 'byebug', '11.1.3', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '4.1.0'
gem 'rack-mini-profiler', '2.3.1'
gem 'listen', '3.4.1'
gem 'spring', '2.1.1'
end
group :test do
gem 'capybara', '3.35.3'
gem 'selenium-webdriver', '3.142.7'
gem 'webdrivers', '4.6.0'
gem 'rails-controller-testing', '1.0.5'
gem 'minitest', '5.11.3'
gem 'minitest-reporters', '1.3.8'
gem 'guard', '2.16.2'
gem 'guard-minitest', '2.4.6'
end
group :production do
gem 'pg', '1.2.3'
gem 'aws-sdk-s3', '1.87.0', require: false
end
I have been trying to get this to deploy all day, and finally narrowed it down to it being a database issue. I've only started working with DB's inside of Rails this week, so I'm having issues finding what my next step should be to troubleshoot.
I've tried migrating the database to Heroku and read through these links
https://devcenter.heroku.com/articles/sqlite3
https://devcenter.heroku.com/articles/getting-started-with-rails6
but I'm still running into a dead end and nothing has worked. All other parts of my app work except the pages that are tied to a database in anyway.

missing required flag heroku tail

I am working to deploy my rails app. Everything in running in local environment but I am having some issues making my first push to heroku. I am getting the standard app error, see pic:
when i run the command heroku logs --tail, i get the following error:
my gemfile is as so:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
gem 'sqlite3'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
group :production do
gem 'pg'
end
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
below are my heroku logs:
2
018-02-09T00:48:11.108425+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
2018-02-09T00:48:11.108427+00:00 app[web.1]: from /app/vendor/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
2018-02-09T00:48:11.108435+00:00 app[web.1]: from bin/rails:3:in `load'
2018-02-09T00:48:11.108437+00:00 app[web.1]: from bin/rails:3:in `<main>'
2018-02-09T00:48:11.120606+00:00 app[web.1]: => Booting WEBrick
2018-02-09T00:48:11.120615+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://0.0.0.0:52651
2018-02-09T00:48:11.120619+00:00 app[web.1]: => Ctrl-C to shutdown server
2018-02-09T00:48:11.120618+00:00 app[web.1]: => Run `rails server -h` for more startup options
2018-02-09T00:48:11.120621+00:00 app[web.1]: Exiting
2018-02-09T00:49:30.407211+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ec520950-df52-44ee-95aa-890d9ad76949 fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https
2018-02-09T00:49:32.372812+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=postcable.herokuapp.com request_id=ffdb944b-9293-4d96-8986-b0af2974704c fwd="67.20.250.6" dyno= connect= service= status=503 bytes= protocol=https
First of all, to get the log error to work correctly also pass a flag for your app name as well:
heroku logs --tail --app my_heroku_app_name
Also, it seems you have nested gem groups. I am assuming you are using postgresql as your database for production so I would recommend to move pg out of development>production group like so:
gem 'pg'
group :development do
gem 'sqlite3'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
Then run
bundle install
Lastly, try pushing to heroku again with
git push heroku master
I solved, needed to define the PG version in my gemfile:
gem 'pg', '~> 0.18.4'

Rails Heroku App Won't Load

My Rails App deployed on Heroku won't load. I setup the DB + migrate and I also have puma and procfile... I literally have no clue.
Here's my logs:
2016-06-27T02:12:40.565429+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 8592 -e production`
2016-06-27T02:12:43.410912+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-06-27T02:12:43.410821+00:00 app[web.1]: => Booting Puma
2016-06-27T02:12:43.410885+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://127.0.0.1:8592
2016-06-27T02:12:43.410896+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-06-27T02:12:44.269805+00:00 app[web.1]: [3] * Version 3.4.0 (ruby 2.2.4-p230), codename: Owl Bowl Brawl
2016-06-27T02:12:44.270470+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-06-27T02:12:44.269782+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-06-27T02:12:44.269807+00:00 app[web.1]: [3] * Environment: production
2016-06-27T02:12:44.269855+00:00 app[web.1]: [3] * Preloading application
2016-06-27T02:12:44.269806+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-06-27T02:12:44.269840+00:00 app[web.1]: [3] * Process workers: 2
2016-06-27T02:12:44.270026+00:00 app[web.1]: [3] * Listening on tcp://127.0.0.1:8592
2016-06-27T02:12:44.276018+00:00 app[web.1]: [3] - Worker 1 (pid: 9) booted, phase: 0
2016-06-27T02:12:44.275358+00:00 app[web.1]: [3] - Worker 0 (pid: 5) booted, phase: 0
2016-06-27T02:13:12.887521+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=salty-sierra-72006.herokuapp.com request_id=e96197b0-0946-4b58-a68c-b8a9a3c3fc15 fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
2016-06-27T02:13:41.028910+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-27T02:13:41.028910+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-27T02:13:41.783167+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-27T02:13:41.772079+00:00 heroku[web.1]: Process exited with status 137
2016-06-27T02:13:42.941344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=salty-sierra-72006.herokuapp.com request_id=0411e6f6-3dee-4d15-9bf2-8e069a20d9fb fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
2016-06-27T02:13:43.295246+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=salty-sierra-72006.herokuapp.com request_id=e1d9e2cd-086a-4d65-9100-dc4c407c9835 fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'pg'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'rake', '< 11'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'sass-rails', '>= 3.2'
gem 'simple_form'
gem 'twilio-ruby', '~> 4.11.1'
gem 'dotenv-rails'
gem 'puma'
gem "font-awesome-rails"
group :development, :test do
gem 'rspec-rails', '~> 3.1.0'
gem "factory_girl_rails", "~> 4.7.0"
gem "faker"
gem "shoulda-matchers", "~> 3.1.1"
gem "database_cleaner", "~> 1.4.0"
gem "rails_best_practices", "~> 1.16.0"
gem "rails-erd"
gem 'annotate'
gem 'pry-byebug'
gem 'awesome_print'
gem 'pry-stack_explorer'
gem 'pry-coolline'
gem 'pry-doc'
gem 'pry-rails'
gem 'pry'
gem 'pry-macro'
gem 'pry-state'
end
group :development do
gem 'better_errors'
gem "binding_of_caller"
gem 'spring'
end
Procfile
web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}
config/puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count
preload_app!
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end
I found the issue and it is quite simple.
1- heroku pg:reset DATABASE_URL
2- https://devcenter.heroku.com/articles/heroku-postgresql
3- Launch Heroku from your local, not your virtual box.
Working.

Error when pushing code to Heroku

I am running my app locally without issue. I created a heroku account and pushed my code up to heroku, however I am getting a general error saying "something went wrong" I pasted my heroku logs below...I am new to Heroku so I am not sure what the issue is here?
gemfile:
source 'https://rubygems.org'
ruby "2.1.5"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass'
gem "paperclip", "~> 4.3"
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
heroku logs:
Art West#ARTWESTIV /c/Sites
$ cd ~/desktop
Art West#ARTWESTIV ~/desktop
$ cd yahozzle
Art West#ARTWESTIV ~/desktop/yahozzle (master)
$ heroku logs
Your version of git is 1.9.4.. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
2015-12-18T21:29:15.599176+00:00 heroku[api]: Enable Logplex by art.westiv#gmail.com
2015-12-18T21:29:15.599176+00:00 heroku[api]: Release v2 created by art.westiv#gmail.com
2015-12-18T21:31:53.237831+00:00 heroku[api]: Set LANG, RAILS_ENV, RACK_ENV, SECRET_KEY_BASE config vars by art.westiv#gmail.com
2015-12-18T21:31:53.237888+00:00 heroku[api]: Release v3 created by art.westiv#gmail.com
2015-12-18T21:31:53.708634+00:00 heroku[api]: Release v4 created by art.westiv#gmail.com
2015-12-18T21:31:53.708634+00:00 heroku[api]: Attach DATABASE resource by art.westiv#gmail.com
2015-12-18T21:31:54.021633+00:00 heroku[api]: Scale to web=1 by art.westiv#gmail.com
2015-12-18T21:31:54.098158+00:00 heroku[api]: Deploy fa5366d by art.westiv#gmail.com
2015-12-18T21:31:54.098248+00:00 heroku[api]: Release v5 created by art.westiv#gmail.com
2015-12-18T21:31:54.415009+00:00 heroku[slug-compiler]: Slug compilation started
2015-12-18T21:31:54.415020+00:00 heroku[slug-compiler]: Slug compilation finished
2015-12-18T21:31:56.834536+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 26611 -e production`
2015-12-18T21:31:59.899640+00:00 app[web.1]: [2015-12-18 21:31:59] INFO WEBrick 1.3.1
2015-12-18T21:31:59.899656+00:00 app[web.1]: [2015-12-18 21:31:59] INFO ruby 2.1.5 (2014-11-13) [x86_64-linux]
2015-12-18T21:31:59.899909+00:00 app[web.1]: [2015-12-18 21:31:59] INFO WEBrick::HTTPServer#start: pid=3 port=26611
2015-12-18T21:32:00.158746+00:00 heroku[web.1]: State changed from starting to up
2015-12-18T21:33:25.989345+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by art.westiv#gmail.com
2015-12-18T21:33:28.792631+00:00 heroku[run.5244]: Awaiting client
2015-12-18T21:33:28.809492+00:00 heroku[run.5244]: Starting process with command `bundle exec rake db:migrate`
2015-12-18T21:33:32.849960+00:00 heroku[run.5244]: Process exited with status 0
2015-12-18T21:33:29.135341+00:00 heroku[run.5244]: State changed from starting to up
2015-12-18T21:34:04.260094+00:00 heroku[router]: at=info method=GET path="/" host=yahozzle.herokuapp.com request_id=8f3e052b-5e55-4822-ac3f-be728a04aacd fwd="206.123.254.90" dyno=web.1 connect=2ms service=62ms status=500 bytes=1754
2015-12-18T21:34:04.183773+00:00 app[web.1]: => Booting WEBrick
2015-12-18T21:34:04.183780+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-12-18T21:34:04.183778+00:00 app[web.1]: => Rails 4.1.8 application starting in production on http://0.0.0.0:26611
2015-12-18T21:34:04.183781+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2015-12-18T21:34:04.183782+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-12-18T21:34:04.183782+00:00 app[web.1]: Started GET "/" for 206.123.254.90 at 2015-12-18 21:34:04 +0000
2015-12-18T21:34:04.225082+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-12-18T21:34:04.238797+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2015-12-18T21:34:04.236903+00:00 app[web.1]: Rendered listings/index.html.erb within layouts/application (3.6ms)
2015-12-18T21:34:04.240033+00:00 app[web.1]: * "/app/app/views"
2015-12-18T21:34:04.240029+00:00 app[web.1]:
2015-12-18T21:34:04.240032+00:00 app[web.1]: ActionView::Template::Error (Missing partial Layouts/_header with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
2015-12-18T21:34:04.240034+00:00 app[web.1]: ):
2015-12-18T21:34:04.240034+00:00 app[web.1]: 8: </head>
2015-12-18T21:34:04.240035+00:00 app[web.1]: 9:
2015-12-18T21:34:04.240035+00:00 app[web.1]: 10: <body>
2015-12-18T21:34:04.240036+00:00 app[web.1]: 11: <%= render 'Layouts/header' %>
2015-12-18T21:34:04.240036+00:00 app[web.1]: 12: <div class="container">
2015-12-18T21:34:04.240037+00:00 app[web.1]: 13: <%= yield %>
2015-12-18T21:34:04.240038+00:00 app[web.1]: app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb__2488562101803348584_70335066715400'
2015-12-18T21:34:04.240037+00:00 app[web.1]: 14: <%= render 'Layouts/footer' %>
2015-12-18T21:34:04.240039+00:00 app[web.1]:
2015-12-18T21:34:04.240039+00:00 app[web.1]:
2015-12-18T21:34:04.722117+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=yahozzle.herokuapp.com request_id=f61364ff-7a3e-41c2-865c-51229d244cd1 fwd="206.123.254.90" dyno=web.1 connect=0ms service=3ms status=200 bytes=228
2015-12-18T21:35:06.875160+00:00 app[web.1]: Started GET "/" for 206.123.254.90 at 2015-12-18 21:35:06 +0000
2015-12-18T21:35:06.880338+00:00 app[web.1]: Rendered listings/index.html.erb within layouts/application (2.0ms)
2015-12-18T21:35:06.883137+00:00 app[web.1]:
2015-12-18T21:35:06.883142+00:00 app[web.1]: * "/app/app/views"
2015-12-18T21:35:06.883141+00:00 app[web.1]: ActionView::Template::Error (Missing partial Layouts/_header with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
2015-12-18T21:35:06.883143+00:00 app[web.1]: ):
2015-12-18T21:35:06.883144+00:00 app[web.1]: 9:
2015-12-18T21:35:06.883143+00:00 app[web.1]: 8: </head>
2015-12-18T21:35:06.883145+00:00 app[web.1]: 11: <%= render 'Layouts/header' %>
2015-12-18T21:35:06.883145+00:00 app[web.1]: 10: <body>
2015-12-18T21:35:06.883146+00:00 app[web.1]: 12: <div class="container">
2015-12-18T21:35:06.883147+00:00 app[web.1]: 14: <%= render 'Layouts/footer' %>
2015-12-18T21:35:06.883147+00:00 app[web.1]: 13: <%= yield %>
2015-12-18T21:35:06.883149+00:00 app[web.1]:
2015-12-18T21:35:06.883148+00:00 app[web.1]: app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb__2488562101803348584_70335066715400'
2015-12-18T21:35:06.883150+00:00 app[web.1]:
2015-12-18T21:35:06.877226+00:00 app[web.1]: Processing by ListingsController#index as HTML
2015-12-18T21:35:06.881799+00:00 app[web.1]: Completed 500 Internal Server Error in 4ms
2015-12-18T21:35:06.863666+00:00 heroku[router]: at=info method=GET path="/" host=yahozzle.herokuapp.com request_id=efaaeab9-ce24-4513-9e1d-7ebe584ef31a fwd="206.123.254.90" dyno=web.1 connect=1ms service=16ms status=500 bytes=1754
2015-12-18T21:35:07.337234+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=yahozzle.herokuapp.com request_id=0bb618cf-9bbe-402e-81bb-973771eca373 fwd="206.123.254.90" dyno=web.1 connect=1ms service=4ms status=200 bytes=228
Your logs show the error - the application tries to render partials it cannot find. Pay attention to file name's case - Heroku's filesystem is case sensitive, and my guess is that you have a directory app/views/layouts but in your erb files you refer to it as Layouts.
The last error it logged is:
ActionView::Template::Error (Missing partial Layouts/_header with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
* "/app/app/views"
app/views/layouts/application.html.erb:11:in `_app_views_layouts_application_html_erb
I suggest checking to see if you committed the _header partial so that it pushes to Heroku, or checking to see if the partial is named correctly and not a typo. You can ssh into the Heroku server to check if the file exists:
heroku run bash
Then, just cd into the views directory and ls to list its contents to find the file, make sure it's in the spot you expected.
The other issue is given here:
Your version of git is 1.9.4.. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
You can read about that at the given url: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x

Errors when deploying Rails App to Heroku

Hello I am just starting to learn Ruby on Rails and am watching the Railstutoprials screen casts. However When I do my git push to heroku and try to load my rails app I get an error and my logs look like this.
2013-06-26T22:41:06.427464+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 55907 -e $RAILS_ENV`
2013-06-26T22:41:07.770202+00:00 app[web.1]:
2013-06-26T22:41:07.770515+00:00 app[web.1]: Options:
2013-06-26T22:41:07.770114+00:00 app[web.1]: rails new APP_PATH [options]
2013-06-26T22:41:07.771778+00:00 app[web.1]: -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
2013-06-26T22:41:07.771778+00:00 app[web.1]: -r, [--ruby=PATH] # Path to the Ruby binary of your choice
2013-06-26T22:41:07.771778+00:00 app[web.1]: -B, [--skip-bundle] # Don't run bundle install
2013-06-26T22:41:07.770029+00:00 app[web.1]: Usage:
2013-06-26T22:41:07.771962+00:00 app[web.1]: # Default: sqlite3
2013-06-26T22:41:07.771778+00:00 app[web.1]: -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
2013-06-26T22:41:07.771962+00:00 app[web.1]: -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
2013-06-26T22:41:07.771778+00:00 app[web.1]: # Default: /app/vendor/ruby-2.0.0/bin/ruby
2013-06-26T22:41:07.771778+00:00 app[web.1]: [--skip-gemfile] # Don't create a Gemfile
2013-06-26T22:41:07.771778+00:00 app[web.1]: -O, [--skip-active-record] # Skip Active Record files
2013-06-26T22:41:07.771778+00:00 app[web.1]: -G, [--skip-git] # Skip .gitignore file
2013-06-26T22:41:07.771962+00:00 app[web.1]: -J, [--skip-javascript] # Skip JavaScript files
2013-06-26T22:41:07.771778+00:00 app[web.1]: [--skip-keeps] # Skip source control .keep files
2013-06-26T22:41:07.771778+00:00 app[web.1]: -S, [--skip-sprockets] # Skip Sprockets files
2013-06-26T22:41:07.771962+00:00 app[web.1]: # Default: jquery
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--edge] # Setup the application with Gemfile pointing to Rails repository
2013-06-26T22:41:07.771962+00:00 app[web.1]: -T, [--skip-test-unit] # Skip Test::Unit files
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--rc=RC] # Path to file containing extra configuration options for rails command
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--dev] # Setup the application with Gemfile pointing to your Rails checkout
2013-06-26T22:41:07.771962+00:00 app[web.1]: [--no-rc] # Skip loading of extra configuration options from .railsrc file
2013-06-26T22:41:07.771962+00:00 app[web.1]:
2013-06-26T22:41:07.772167+00:00 app[web.1]: Runtime options:
2013-06-26T22:41:07.772167+00:00 app[web.1]: -f, [--force] # Overwrite files that already exist
2013-06-26T22:41:07.772167+00:00 app[web.1]: -p, [--pretend] # Run but do not make any changes
2013-06-26T22:41:07.773137+00:00 app[web.1]: Rails options:
2013-06-26T22:41:07.772167+00:00 app[web.1]: -s, [--skip] # Skip files that already exist
2013-06-26T22:41:07.772167+00:00 app[web.1]: -q, [--quiet] # Suppress status output
2013-06-26T22:41:07.772167+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: Description:
2013-06-26T22:41:07.773217+00:00 app[web.1]: -v, [--version] # Show Rails version number and quit
2013-06-26T22:41:07.773756+00:00 app[web.1]: The 'rails new' command creates a new Rails application with a default
2013-06-26T22:41:07.773217+00:00 app[web.1]: -h, [--help] # Show this help message and quit
2013-06-26T22:41:07.773756+00:00 app[web.1]: directory structure and configuration at the path you specify.
2013-06-26T22:41:07.773756+00:00 app[web.1]: 'rails new' runs in the .railsrc configuration file in your home directory.
2013-06-26T22:41:07.773217+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: defaults values shown above in this help message.
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]: You can specify extra command-line arguments to be used every time
2013-06-26T22:41:07.773756+00:00 app[web.1]: Note that the arguments specified in the .railsrc file don't affect the
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773756+00:00 app[web.1]:
2013-06-26T22:41:07.773989+00:00 app[web.1]: Example:
2013-06-26T22:41:07.773989+00:00 app[web.1]:
2013-06-26T22:41:07.773989+00:00 app[web.1]: See the README in the newly created application to get going.
2013-06-26T22:41:07.773989+00:00 app[web.1]: rails new ~/Code/Ruby/weblog
2013-06-26T22:41:07.773989+00:00 app[web.1]: This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
2013-06-26T22:41:09.160872+00:00 heroku[web.1]: Process exited with status 0
2013-06-26T22:41:09.172961+00:00 heroku[web.1]: State changed from starting to crashed
My Gemfile looks like:
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use postgresql as the database for Active Record
gem 'pg', group: :production
gem 'sqlite3', group: [:test, :development]
# Use V8 JavaScript engine
gem 'therubyracer'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'rails_12factor'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
and finally my database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
database: social_pantry
pool: 5
timeout: 5000
looks like its trying to execute rails server command on a directory that is not a rails project. Set the correct app path in your configuration.

Resources