Hi i was pushing my code to heroku and i got "internal server error", along with a message "You must set config.secret_key_base in your app's config."
attached is my heroku logs:
2014-08-24T09:59:08.327640+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=morning-shore-7679.herokuapp.com request_id=
41ececcc-6a0d-4af1-832c-c0123335836a fwd="10.168.82.110 ,220.255.1.160" dyno=web.1 connect=1ms service=6ms status=500 bytes=562
2014-08-24T09:59:08.326020+00:00 app[web.1]: [2014-08-24 09:59:08] ERROR RuntimeError: You must set config.secret_key_base in your app's
config.
2014-08-24T09:59:08.326025+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:145:in `env_co
nfig'
2014-08-24T09:59:08.326027+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/engine.rb:507:in `call'
2014-08-24T09:59:08.326028+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.8/lib/rails/application.rb:97:in `call'
2014-08-24T09:59:08.326032+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-08-24T09:59:08.326030+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-08-24T09:59:08.326034+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-08-24T09:59:08.326035+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-08-24T09:59:08.326038+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-08-24T09:59:08.326037+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
Can anyone shed some light on this?
I think the easiest way to get ride of this issue is to generate secrets and push into your git repo.
# on terminal from project root
rake secret
Put this generated secret in config/initializers/secret_token.rb file:
# Be sure to restart your server when you modify this file.
Yourapp::Application.config.secret_token = 'YOUR_GENERATED_SECRET'
Commit & push code to heroku.
Related
I'm extremely new to coding in general - so be gentle.
I'm on Chapter 3, 3.1, in the very end after creating the static_pages, home and help, by entering $ rails generate controller StaticPages home help, I cannot then navigate to the page without getting a corresponding 500 Runtime Error, which in turn Killed the running server.
The "hello" app works just fine and I've had no issues up until now.
Notes: I am following the tutorial on a Windows 7 x64, but I'm taking Hartl's recommendation to use the Cloud IDE with Git, Bitbucket, and Heroku. I did have to run Rails 4.2.1 instead of Rails 4.2.2 however due to an issue when first starting out.
What could I be doing wrong? Please let me know if I need to include any more information, this is all very new to me.
EDIT:
I checked my files again what #Rich Peck stated and theyre all the same except the Routes.rb file which only has this (which was generated by the system, I'm also omitting all # comments):
Rails.application.routes.draw do
get 'static_pages/home'
get 'static_pages/help'
root 'application#hello'
end
Ive also pulled my logs as stated by a few comments, and this is the result of the last 100 lines:
2015-10-11T21:25:49.589384+00:00 app[web.1]: => Runrails server -hfor more startup options
2015-10-11T21:25:49.589385+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-10-11T21:25:49.589386+00:00 app[web.1]: Started GET "/" for 208.115.151.20 at 2015-10-11 21:25:49 +0000
2015-10-11T21:25:49.646987+00:00 app[web.1]: Processing by ApplicationController#hello as HTML
2015-10-11T21:25:49.656139+00:00 app[web.1]: Completed 200 OK in 9ms (Views: 0.8ms | ActiveRecord: 0.0ms)
2015-10-11T21:25:49.655832+00:00 app[web.1]: Rendered text template (0.0ms)
2015-10-11T21:25:49.786454+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-journey-1439.herokuapp.com request_id=2474855b-e5c5-4db8-8b2a-83f0d6095d2d fwd="208.115.151.20" dyno=web.1 connect=0ms service=3ms status=200 bytes=228
2015-10-11T21:25:49.658965+00:00 heroku[router]: at=info method=GET path="/" host=mysterious-journey-1439.herokuapp.com request_id=e85687fc-6820-42c1-b389-4a6d8e0e2ffa fwd="208.115.151.20" dyno=web.1 connect=0ms service=73ms status=304 bytes=397
2015-10-11T21:59:04.638018+00:00 heroku[web.1]: Idling
2015-10-11T21:59:04.638730+00:00 heroku[web.1]: State changed from up to down
2015-10-11T21:59:04.639573+00:00 heroku[web.1]: State changed from down to starting
2015-10-11T21:59:06.575098+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-10-11T21:59:06.991420+00:00 app[web.1]: [2015-10-11 21:59:06] FATAL SignalException: SIGTERM
2015-10-11T21:59:06.991427+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:inselect'
2015-10-11T21:59:06.991429+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in block in start'
2015-10-11T21:59:06.991431+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:instart'
2015-10-11T21:59:06.991432+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in start'
2015-10-11T21:59:06.991433+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:inrun'
2015-10-11T21:59:06.991434+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:286:in start'
2015-10-11T21:59:06.991436+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:80:instart'
2015-10-11T21:59:06.991438+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in block in server'
2015-10-11T21:59:06.991440+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:intap'
2015-10-11T21:59:06.991441+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in server'
2015-10-11T21:59:06.991442+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
2015-10-11T21:59:06.991443+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>'
2015-10-11T21:59:06.991445+00:00 app[web.1]: bin/rails:8:inrequire'
2015-10-11T21:59:06.991446+00:00 app[web.1]: bin/rails:8:in <main>'
2015-10-11T21:59:06.991478+00:00 app[web.1]: [2015-10-11 21:59:06] INFO WEBrick::HTTPServer#start done.
2015-10-11T21:59:06.991452+00:00 app[web.1]: [2015-10-11 21:59:06] INFO going to shutdown ...
2015-10-11T21:59:06.991498+00:00 app[web.1]: Exiting
2015-10-11T21:59:07.767999+00:00 heroku[web.1]: Process exited with status 143
2015-10-11T21:59:08.554265+00:00 heroku[web.1]: Starting process with commandbin/rails server -p 21794 -e production
2015-10-11T21:59:12.579369+00:00 app[web.1]: [2015-10-11 21:59:12] INFO WEBrick 1.3.1
2015-10-11T21:59:12.579406+00:00 app[web.1]: [2015-10-11 21:59:12] INFO ruby 2.0.0 (2015-04-13) [x86_64-linux]
2015-10-11T21:59:12.579784+00:00 app[web.1]: [2015-10-11 21:59:12] INFO WEBrick::HTTPServer#start: pid=3 port=21794
2015-10-11T21:59:13.087410+00:00 heroku[web.1]: State changed from starting to up
2015-10-11T22:34:07.204262+00:00 heroku[web.1]: Idling
2015-10-11T22:34:07.204981+00:00 heroku[web.1]: State changed from up to down
2015-10-11T22:34:10.871115+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-10-11T22:34:11.813473+00:00 app[web.1]: [2015-10-11 22:34:11] FATAL SignalException: SIGTERM
2015-10-11T22:34:11.813479+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:inselect'
2015-10-11T22:34:11.813483+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in block in start'
2015-10-11T22:34:11.813484+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:instart'
2015-10-11T22:34:11.813486+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in start'
2015-10-11T22:34:11.813487+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:inrun'
2015-10-11T22:34:11.813489+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:286:in start'
2015-10-11T22:34:11.813490+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:80:instart'
2015-10-11T22:34:11.813492+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in block in server'
2015-10-11T22:34:11.813493+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:intap'
2015-10-11T22:34:11.813495+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in server'
2015-10-11T22:34:11.813497+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!'
2015-10-11T22:34:11.813498+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>'
2015-10-11T22:34:11.813500+00:00 app[web.1]: bin/rails:8:inrequire'
2015-10-11T22:34:11.813501+00:00 app[web.1]: bin/rails:8:in <main>'
2015-10-11T22:34:11.813508+00:00 app[web.1]: [2015-10-11 22:34:11] INFO going to shutdown ...
2015-10-11T22:34:11.813551+00:00 app[web.1]: [2015-10-11 22:34:11] INFO WEBrick::HTTPServer#start done.
2015-10-11T22:34:11.813591+00:00 app[web.1]: => Booting WEBrick
2015-10-11T22:34:11.813594+00:00 app[web.1]: => Runrails server -hfor more startup options
2015-10-11T22:34:11.813593+00:00 app[web.1]: => Rails 4.2.1 application starting in production on http://0.0.0.0:21794
2015-10-11T22:34:11.813598+00:00 app[web.1]: Exiting
2015-10-11T22:34:11.813596+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-10-11T22:34:12.863144+00:00 heroku[web.1]: Process exited with status 143
2015-10-11T22:59:27.859347+00:00 heroku[web.1]: Unidling
2015-10-11T22:59:27.859754+00:00 heroku[web.1]: State changed from down to starting
2015-10-11T22:59:31.767799+00:00 heroku[web.1]: Starting process with commandbin/rails server -p 43789 -e production
2015-10-11T22:59:35.850425+00:00 app[web.1]: [2015-10-11 22:59:35] INFO WEBrick 1.3.1
2015-10-11T22:59:35.850445+00:00 app[web.1]: [2015-10-11 22:59:35] INFO ruby 2.0.0 (2015-04-13) [x86_64-linux]
2015-10-11T22:59:35.850845+00:00 app[web.1]: [2015-10-11 22:59:35] INFO WEBrick::HTTPServer#start: pid=3 port=43789
2015-10-11T22:59:36.187808+00:00 heroku[web.1]: State changed from starting to up
2015-10-11T22:59:36.930155+00:00 app[web.1]: => Booting WEBrick
2015-10-11T22:59:36.930162+00:00 app[web.1]: => Rails 4.2.1 application starting in production on http://0.0.0.0:43789
2015-10-11T22:59:36.930163+00:00 app[web.1]: => Runrails server -hfor more startup options
2015-10-11T22:59:36.930165+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-10-11T22:59:36.963421+00:00 app[web.1]: Processing by ApplicationController#hello as HTML
2015-10-11T22:59:36.930166+00:00 app[web.1]: Started GET "/" for 208.115.151.20 at 2015-10-11 22:59:36 +0000
2015-10-11T22:59:36.971478+00:00 app[web.1]: Completed 200 OK in 8ms (Views: 0.6ms | ActiveRecord: 0.0ms)
2015-10-11T22:59:36.974594+00:00 heroku[router]: at=info method=GET path="/" host=mysterious-journey-1439.herokuapp.com request_id=b8fe0c84-e45c-4997-be06-9742f276fb98 fwd="208.115.151.20" dyno=web.1 connect=1ms service=47ms status=304 bytes=397
2015-10-11T22:59:36.971195+00:00 app[web.1]: Rendered text template (0.0ms)
2015-10-11T22:59:37.155800+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=mysterious-journey-1439.herokuapp.com request_id=ce175e20-0e6c-40e1-9e4e-ec842143c159 fwd="208.115.151.20" dyno=web.1 connect=16ms service=4ms status=200 bytes=228
2015-10-11T23:35:06.014571+00:00 heroku[web.1]: Idling
2015-10-11T23:35:06.015165+00:00 heroku[web.1]: State changed from up to down
2015-10-11T23:35:08.748838+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-10-11T23:35:09.396823+00:00 app[web.1]: [2015-10-11 23:35:09] FATAL SignalException: SIGTERM
2015-10-11T23:35:09.396829+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:inselect'
2015-10-11T23:35:09.396831+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in block in start'
2015-10-11T23:35:09.396833+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:instart'
2015-10-11T23:35:09.396834+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in start'
2015-10-11T23:35:09.396835+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:34:inrun'
2015-10-11T23:35:09.396838+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in start'
2015-10-11T23:35:09.396836+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.4/lib/rack/server.rb:286:instart'
2015-10-11T23:35:09.396843+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in run_command!'
2015-10-11T23:35:09.396840+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:inblock in server'
2015-10-11T23:35:09.396846+00:00 app[web.1]: bin/rails:8:in require'
2015-10-11T23:35:09.396847+00:00 app[web.1]: bin/rails:8:in'
2015-10-11T23:35:09.396842+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in server'
2015-10-11T23:35:09.396841+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:intap'
2015-10-11T23:35:09.396844+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>'
2015-10-11T23:35:09.396853+00:00 app[web.1]: [2015-10-11 23:35:09] INFO going to shutdown ...
2015-10-11T23:35:09.396894+00:00 app[web.1]: Exiting
2015-10-11T23:35:09.396870+00:00 app[web.1]: [2015-10-11 23:35:09] INFO WEBrick::HTTPServer#start done.
2015-10-11T23:35:10.254851+00:00 heroku[web.1]: Process exited with status 143
WARNING: Toolbelt v3.42.17 update available.
I'm extremely new to coding
Because you're new, I'll give you a breakdown of how I'd debug this. It may not be an answer in itself, but it should at least help you out.
Firstly, you need to make sure you have the right controller and views set up.
The main problem for many new coders is they will blindly follow a tutorial and then be unable to understand what is being done. I know what it's like because I do it all the time (when learning something new)..
Thus, you need to understand what is being added to your app, and how it should behave:
1. Controller
Your first port of call is the controller.
You can read more about this here.
Rails will have created:
#app/controllers/static_pages_controller.rb
class StaticPagesController < ApplicationController
def hello
end
def help
end
end
This, although not strictly adhering to the CRUD setup you'll use later in Rails, should give you at least the ability to call these two actions.
You must first check if you have the above file.
2. Views
Secondly, you need to look at the views you've had generated.
These will be located at:
#app/views/static_pages/hello.html.erb
#app/views/static_pages/help.html.erb
Both of these will provide functionality to allow you to view your controller action outputs. They're not critical to the debug process at this time.
They should really have nothing inside them.
3. Routes
Finally, you want to look at your routes.
#config/routes.rb
resources :static_pages, only: [], path: "" do
collection do
get :hello #-> url.com/hello
get :help #-> url.com/help
end
end
This will give you the ability to access the controller actions, and by virtue, the views that you have just generated.
All of these should work together, without any data, to provide access to url.com/hello and url.com/help.
(source: asciicasts.com)
500 Errors are basically saying your server has an error.
What errors on the server might cause the 500 issue?
Mostly, it's due to calling variables which don't exist...
#app/views/static_pages/hello.html.erb
<%= #hello %>
If you're using Heroku, the best way to debug - as with standard Rails - is to look at the console. In standard rails, the console is visible on your screen (most of the time); with Heroku, it's slightly different.
Heroku logs are strange because they don't format very well in Windows. We tend to use LogEntries with the "live" functionality to see what's going on, and correct it:
Browsing through these logs will show you what the error is, and thus give you some perspective on how to fix it.
--
Finally, you may wish to use a gem such as better_errors or exception_handler
My app runs fine locally, but when I push to Heroku, in Firefox it says "The page isn't redirecting properly" (i.e. a 302 error).
Running heroku logs results in a bunch of requests like this:
2015-06-02T21:30:26.556750+00:00 heroku[router]: at=info method=GET path="/" host=www.mydomainname.com request_id=a0cb3aa2-af7c-431a-9cc4-a237e551ae0a fwd="173.27.229.45" dyno=web.1 connect=2ms service=13ms status=302 bytes=499
2015-06-02T21:30:27.761039+00:00 heroku[router]: at=info method=GET path="/" host=www.mydomainname.com request_id=32026d7d-2167-4058-8ef6-8ebd15af7460 fwd="173.27.229.45" dyno=web.1 connect=2ms service=12ms status=302 bytes=499
2015-06-02T21:30:27.914344+00:00 heroku[router]: at=info method=GET path="/" host=www.mydomainname.com request_id=2087a90c-fd56-4d14-b630-9c92fda30c80 fwd="173.27.229.45" dyno=web.1 connect=1ms service=15ms status=302 bytes=499
When I run the "Network" option under Firefox's Developer section, it continuously shows that it is alternating between the domain with and without www. For example:
www.domain.com
domain.com
www.domain.com
domain.com
etc.
I am using a custom domain name but have it set up exactly how my other apps that are working are set up, so I don't think it is a DNS issue as far as how the setup goes. Also, when I visit the "myappname.herokuapp.com" URL, it immediately redirects to heroku.com for some reason. Not sure why. I ran the "Production Check" and it passes the "DNS configuration" section.
I realize that I have not provided a bunch of information here (not sure what else to provide), but any ideas on what I could look into next?
EDIT: Today it is saying this prior to the redirect code posted earlier:
2015-06-03T14:38:14.651296+00:00 heroku[web.2]: State changed from up to down
2015-06-03T14:38:17.135688+00:00 heroku[web.2]: Stopping all processes with SIGTERM
2015-06-03T14:38:17.774095+00:00 app[web.2]: [2015-06-03 14:38:17] FATAL SignalException: SIGTERM
2015-06-03T14:38:17.774101+00:00 app[web.2]: /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:170:in `select'
2015-06-03T14:38:17.774103+00:00 app[web.2]: /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:170:in `block in start'
2015-06-03T14:38:17.774104+00:00 app[web.2]: /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:32:in `start'
2015-06-03T14:38:17.774105+00:00 app[web.2]: /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:160:in `start'
2015-06-03T14:38:17.774106+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/handler/webrick.rb:35:in `run'
2015-06-03T14:38:17.774108+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/server.rb:286:in `start'
2015-06-03T14:38:17.774109+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start'
2015-06-03T14:38:17.774110+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
2015-06-03T14:38:17.774111+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
2015-06-03T14:38:17.774113+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
2015-06-03T14:38:17.774114+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
2015-06-03T14:38:17.774115+00:00 app[web.2]: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
2015-06-03T14:38:17.774117+00:00 app[web.2]: bin/rails:4:in `require'
2015-06-03T14:38:17.774118+00:00 app[web.2]: bin/rails:4:in `<main>'
2015-06-03T14:38:17.774147+00:00 app[web.2]: [2015-06-03 14:38:17] INFO WEBrick::HTTPServer#start done.
2015-06-03T14:38:17.774124+00:00 app[web.2]: [2015-06-03 14:38:17] INFO going to shutdown ...
2015-06-03T14:38:17.828035+00:00 app[web.2]: => Booting WEBrick
2015-06-03T14:38:17.828041+00:00 app[web.2]: => Rails 4.2.0 application starting in production on http://0.0.0.0:4223
2015-06-03T14:38:17.828043+00:00 app[web.2]: => Run `rails server -h` for more startup options
2015-06-03T14:38:17.828045+00:00 app[web.2]: => Ctrl-C to shutdown server
2015-06-03T14:38:17.828046+00:00 app[web.2]: Exiting
2015-06-03T14:38:18.624457+00:00 heroku[web.2]: Process exited with status 143
EDIT 2: I re-cloned the repository into a different directory and then ran heroku create, git push heroku master, and then heroku run rake db:migrate. I did this to eliminate any possible DNS issues. The log now says:
2015-06-03T15:55:51.082260+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=lit-inlet-1933.herokuapp.com request_id=2cd494b9-8f93-4270-b8db-e1dda9a6ab4a fwd="173.27.229.45" dyno= connect= service= status=503 bytes=
2015-06-03T15:55:51.274766+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lit-inlet-1933.herokuapp.com request_id=78128ada-cb90-4580-8102-be756ec7b7cc fwd="173.27.229.45" dyno= connect= service= status=503 bytes=
2015-06-03T15:55:53.861456+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=lit-inlet-1933.herokuapp.com request_id=6d89785d-1b00-4b40-8984-15dbbe5e994f fwd="173.27.229.45" dyno= connect= service= status=503 bytes=
This shows 2 crashes to the root url "/" and 2 crashes on /favicon.ico. Based on the favicon.ico, I removed any favicons from the root page as a test. Now the app is behaving similarly to the earlier one: It immediately redirects to heroku.com instead of loading the page and the logs says:
2015-06-03T16:00:42.804253+00:00 heroku[web.1]: State changed from crashed to starting
2015-06-03T16:00:48.568268+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 25258 -e production`
2015-06-03T16:00:57.769255+00:00 app[web.1]: [2015-06-03 16:00:57] INFO WEBrick 1.3.1
2015-06-03T16:00:57.769284+00:00 app[web.1]: [2015-06-03 16:00:57] INFO ruby 2.1.5 (2014-11-13) [x86_64-linux]
2015-06-03T16:00:57.769643+00:00 app[web.1]: [2015-06-03 16:00:57] INFO WEBrick::HTTPServer#start: pid=3 port=25258
2015-06-03T16:00:58.321124+00:00 heroku[web.1]: State changed from starting to up
2015-06-03T16:01:00.754258+00:00 heroku[router]: at=info method=GET path="/" host=lit-inlet-1933.herokuapp.com request_id=8664d409-5542-4bee-914d-00639c08c2d0 fwd="173.27.229.45" dyno=web.1 connect=1ms service=174ms status=302 bytes=501
The root URL is very simple. There is a welcome_controller:
class WelcomeController < ApplicationController
skip_before_filter :authenticate_user!, only: :index
def index
end
end
and the view is:
<div class="jumbotron">
<h1> Task Clash</h1>
<p>A ridiculously simple and easy-to-use CRM/Time Tracking tool aimed at small businesses!</p>
<p><%= link_to "Create Account", new_account_path, class: "btn btn-primary btn-lg" %></p>
</div>
Any help would be greatly appreciated!
EDIT 3: I added rails_12factor to my Gemfile and now get this:
2015-06-03T19:37:48.713189+00:00 heroku[router]: at=info method=GET path="/" host=www.taskclash.com request_id=c0dfd7ac-233c-4be9-a155-57b66f9a84cb fwd="173.27.229.45" dyno=web.1 connect=0ms service=12ms status=302 bytes=435
2015-06-03T19:37:48.700898+00:00 app[web.1]: Started GET "/" for 173.27.229.45 at 2015-06-03 19:37:48 +0000
2015-06-03T19:37:48.710826+00:00 app[web.1]: Account Load (1.4ms) SELECT "public"."accounts".* FROM "public"."accounts" WHERE "public"."accounts"."subdomain" = $1 LIMIT 1 [["subdomain", "www"]]
2015-06-03T19:37:48.711577+00:00 app[web.1]: Filter chain halted as :load_schema rendered or redirected
2015-06-03T19:37:48.711704+00:00 app[web.1]: Completed 302 Found in 8ms (ActiveRecord: 6.5ms)
2015-06-03T19:37:48.703333+00:00 app[web.1]: Processing by TasksController#index as HTML
2015-06-03T19:37:48.711291+00:00 app[web.1]: Redirected to https://taskclash.com/
Check if there's a production migration pending. Run from the terminal this command:
$ heroku run rake db:migrate
If there are no migrations pending, post more lines of the logs.
see this https://help.heroku.com/tickets/89264
basically, I updated my config/environments/production.rb file and followed
this advice https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally, but it still isn't working.
i just changed
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
to
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( home.css )
and then did the following:
~/collegeanswerz >> RAILS_ENV=production bundle exec rake assets:precompile
/Users/adamzerner/.rvm/rubies/ruby-1.9.3-p327/bin/ruby /Users/adamzerner/.rvm/gems/ruby-1.9.3- p327#rails3tutorial2ndEd/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
~/collegeanswerz >> git add public/assets
~/collegeanswerz >> git commit -m "vendor compiled assets 2"
[master 23fa523] vendor compiled assets 2
9 files changed, 4 insertions(+)
create mode 100644 public/assets/home-73d942132cfdcc305dabf385494f8201.css
create mode 100644 public/assets/home-73d942132cfdcc305dabf385494f8201.css.gz
create mode 100644 public/assets/home.css
create mode 100644 public/assets/home.css.gz
~/collegeanswerz >> git push heroku master
Counting objects: 20, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 2.30 KiB, done.
Total 12 (delta 9), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-1.9.3
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
Using rake (10.0.4)
Using i18n (0.6.1)
Using multi_json (1.7.3)
Using activesupport (3.2.13)
Using builder (3.0.4)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.2)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.5.3)
Using actionmailer (3.2.13)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using coffee-script-source (1.6.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.7.7)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.13)
Using coffee-rails (3.2.2)
Using dynamic_form (1.1.4)
Using jquery-rails (2.2.1)
Using pg (0.12.2)
Using bundler (1.3.2)
Using rails (3.2.13)
Using sass (3.2.9)
Using sass-rails (3.2.6)
Using uglifier (2.1.0)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Detected manifest.yml, assuming assets were compiled locally
-----> WARNINGS:
you have not declared a Ruby version in your Gemfile.
To set your Ruby version add this line to your Gemfile:"
ruby '1.9.3'"
# See https://devcenter.heroku.com/articles/ruby-versions for more information."
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size: 20.1MB
-----> Launching... done, v9
http://fast-reaches-9399.herokuapp.com deployed to Heroku
To git#heroku.com:fast-reaches-9399.git
28772c1..23fa523 master -> master
~/collegeanswerz >> heroku open
Opening fast-reaches-9399... done
but I still got the same 500 error.
can anyone help me with this? I am eager to deploy and I can't figure out what I'm doing wrong. I read through https://devcenter.heroku.com/articles/rails-asset-pipeline#compiling-assets-locally and http://guides.rubyonrails.org/asset_pipeline.html, but I still don't know what's wrong. any help would be appreciated. thanks.
EDIT: I only added home.css to config/environments/production.rb. I have other css files and javascript files though. Do I need to add them along with home.css? I'm confused as to what I need to add to this file and what I don't.
Heroku Logs:
~/collegeanswerz >> heroku logs
2013-06-21T18:09:38.400164+00:00 app[web.1]: => Call with -d to detach
2013-06-21T18:09:38.400164+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-21T18:09:38.400164+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-06-21T18:09:41.816038+00:00 app[web.1]: [2013-06-21 18:09:41] INFO WEBrick::HTTPServer#start: pid=2 port=37598
2013-06-21T18:09:41.806086+00:00 app[web.1]: [2013-06-21 18:09:41] INFO WEBrick 1.3.1
2013-06-21T18:09:41.806250+00:00 app[web.1]: [2013-06-21 18:09:41] INFO ruby 1.9.3 (2013-05-15) [x86_64-linux]
2013-06-21T18:09:41.846306+00:00 heroku[web.1]: State changed from starting to up
2013-06-21T18:09:42.983092+00:00 app[web.1]: Started GET "/" for 150.212.44.53 at 2013-06-21 18:09:42 +0000
2013-06-21T18:09:43.796440+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-21T18:09:43.918982+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (26.0ms)
2013-06-21T18:09:43.926737+00:00 app[web.1]: app/views/static_pages/home.html.erb:1:in `_app_views_static_pages_home_html_erb___725405358529282062_26831120'
2013-06-21T18:09:43.919413+00:00 app[web.1]: Completed 500 Internal Server Error in 121ms
2013-06-21T18:09:43.926737+00:00 app[web.1]:
2013-06-21T18:09:43.926737+00:00 app[web.1]: ActionView::Template::Error (home.css isn't precompiled):
2013-06-21T18:09:43.926737+00:00 app[web.1]: 1: <%= stylesheet_link_tag "home", :media => "all" %>
2013-06-21T18:09:43.926737+00:00 app[web.1]: 2: <%= javascript_include_tag :application %>
2013-06-21T18:09:43.926737+00:00 app[web.1]: 3: <% provide(:title, 'CollegeANSWERZ') %>
2013-06-21T18:09:43.926737+00:00 app[web.1]: 4:
2013-06-21T18:09:43.926737+00:00 app[web.1]:
2013-06-21T18:09:43.926737+00:00 app[web.1]:
2013-06-21T18:09:43.930798+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="150.212.44.53" dyno=web.1 connect=9ms service=997ms status=500 bytes=643
2013-06-21T18:10:43.120112+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2013-06-21T18:10:43.119811+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (0.8ms)
2013-06-21T18:10:43.109481+00:00 app[web.1]: Started GET "/" for 130.49.162.173 at 2013-06-21 18:10:43 +0000
2013-06-21T18:10:43.115024+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-21T18:10:43.163822+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="130.49.162.173" dyno=web.1 connect=1ms service=65ms status=500 bytes=643
2013-06-21T18:10:43.159816+00:00 app[web.1]: 4:
2013-06-21T18:10:43.159816+00:00 app[web.1]: app/views/static_pages/home.html.erb:1:in `_app_views_static_pages_home_html_erb___725405358529282062_26831120'
2013-06-21T18:10:43.159816+00:00 app[web.1]: 3: <% provide(:title, 'CollegeANSWERZ') %>
2013-06-21T18:10:43.159816+00:00 app[web.1]: ActionView::Template::Error (home.css isn't precompiled):
2013-06-21T18:10:43.159816+00:00 app[web.1]:
2013-06-21T18:10:43.159816+00:00 app[web.1]:
2013-06-21T18:10:43.159816+00:00 app[web.1]: 1: <%= stylesheet_link_tag "home", :media => "all" %>
2013-06-21T18:10:43.159816+00:00 app[web.1]:
2013-06-21T18:10:43.159816+00:00 app[web.1]: 2: <%= javascript_include_tag :application %>
2013-06-21T18:10:43.284647+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="130.49.162.173" dyno=web.1 connect=2ms service=14ms status=200 bytes=0
2013-06-21T18:31:38.978118+00:00 app[web.1]: Started GET "/" for 150.212.67.168 at 2013-06-21 18:31:38 +0000
2013-06-21T18:31:38.988162+00:00 app[web.1]: ActionView::Template::Error (home.css isn't precompiled):
2013-06-21T18:31:38.981955+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-21T18:31:38.983438+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (0.7ms)
2013-06-21T18:31:38.984407+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2013-06-21T18:31:38.988162+00:00 app[web.1]:
2013-06-21T18:31:38.988162+00:00 app[web.1]: 1: <%= stylesheet_link_tag "home", :media => "all" %>
2013-06-21T18:31:38.988162+00:00 app[web.1]: 2: <%= javascript_include_tag :application %>
2013-06-21T18:31:38.976788+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="150.212.67.168" dyno=web.1 connect=2ms service=23ms status=500 bytes=643
2013-06-21T18:31:38.988162+00:00 app[web.1]: 3: <% provide(:title, 'CollegeANSWERZ') %>
2013-06-21T18:31:38.988162+00:00 app[web.1]: 4:
2013-06-21T18:31:38.988162+00:00 app[web.1]: app/views/static_pages/home.html.erb:1:in `_app_views_static_pages_home_html_erb___725405358529282062_26831120'
2013-06-21T18:31:38.988162+00:00 app[web.1]:
2013-06-21T18:31:38.988162+00:00 app[web.1]:
2013-06-21T18:31:39.272322+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="150.212.67.168" dyno=web.1 connect=1ms service=14ms status=200 bytes=0
2013-06-21T19:34:46.968884+00:00 heroku[web.1]: Idling
2013-06-21T19:34:51.384909+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-21T19:34:52.554631+00:00 app[web.1]: [2013-06-21 19:34:52] ERROR SignalException: SIGTERM
2013-06-21T19:34:52.554631+00:00 app[web.1]: /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
2013-06-21T19:35:01.380745+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-06-21T19:35:01.381015+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-21T19:35:04.641711+00:00 heroku[web.1]: State changed from up to down
2013-06-21T19:35:04.615493+00:00 heroku[web.1]: Process exited with status 137
2013-06-22T01:19:15.580026+00:00 heroku[api]: Deploy 23fa523 by arz21#pitt.edu
2013-06-22T01:19:15.610236+00:00 heroku[api]
: Release v9 created by arz21#pitt.edu
2013-06-22T01:19:15.645481+00:00 heroku[api]: Deploy 23fa523 by arz21#pitt.edu
2013-06-22T01:19:15.812011+00:00 heroku[web.1]: State changed from down to starting
2013-06-22T01:19:19.358919+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 16312`
2013-06-22T01:19:24.227544+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-22T01:19:24.227544+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-22T01:19:26.887652+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-22T01:19:26.887652+00:00 app[web.1]: => Booting WEBrick
2013-06-22T01:19:26.887652+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:16312
2013-06-22T01:19:26.887652+00:00 app[web.1]: => Call with -d to detach
2013-06-22T01:19:26.887652+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-06-22T01:19:27.090788+00:00 app[web.1]: [2013-06-22 01:19:27] INFO WEBrick 1.3.1
2013-06-22T01:19:27.091334+00:00 app[web.1]: [2013-06-22 01:19:27] INFO WEBrick::HTTPServer#start: pid=2 port=16312
2013-06-22T01:19:27.090788+00:00 app[web.1]: [2013-06-22 01:19:27] INFO ruby 1.9.3 (2013-05-15) [x86_64-linux]
2013-06-22T01:19:27.339684+00:00 heroku[web.1]: State changed from starting to up
2013-06-22T01:19:30.066268+00:00 app[web.1]: Started GET "/" for 24.131.255.163 at 2013-06-22 01:19:30 +0000
2013-06-22T01:19:30.468648+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-06-22T01:19:30.537004+00:00 heroku[router]: at=info method=GET path=/ host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=1ms service=488ms status=500 bytes=643
2013-06-22T01:19:30.525930+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (8.3ms)
2013-06-22T01:19:30.537856+00:00 app[web.1]:
2013-06-22T01:19:30.537856+00:00 app[web.1]: ActionView::Template::Error (layout.css isn't precompiled):
2013-06-22T01:19:30.537856+00:00 app[web.1]: 2: <html>
2013-06-22T01:19:30.537856+00:00 app[web.1]: 7: <%= csrf_meta_tags %>
2013-06-22T01:19:30.532648+00:00 app[web.1]: Completed 500 Internal Server Error in 64ms
2013-06-22T01:19:30.537856+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___1612393333745609223_32479780'
2013-06-22T01:19:30.538131+00:00 app[web.1]:
2013-06-22T01:19:30.537856+00:00 app[web.1]: 8: </head>
2013-06-22T01:19:30.538131+00:00 app[web.1]:
2013-06-22T01:19:30.537856+00:00 app[web.1]: 3: <head>
2013-06-22T01:19:30.537856+00:00 app[web.1]: 4: <title><%= yield(:title) %></title>
2013-06-22T01:19:30.537856+00:00 app[web.1]: 5: <%= stylesheet_link_tag "layout", :media => "all" %>
2013-06-22T01:19:30.537856+00:00 app[web.1]: 6: <%= javascript_include_tag "application" %>
2013-06-22T01:19:31.142918+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fast-reaches-9399.herokuapp.com fwd="24.131.255.163" dyno=web.1 connect=1ms service=48ms status=200 bytes=0
2013-06-22T02:25:29.121546+00:00 heroku[web.1]: Idling
2013-06-22T02:25:34.186899+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-22T02:25:35.206762+00:00 app[web.1]: /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:98:in `select'
2013-06-22T02:25:35.206762+00:00 app[web.1]: [2013-06-22 02:25:35] ERROR SignalException: SIGTERM
2013-06-22T02:25:43.540073+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-06-22T02:25:43.540320+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-22T02:25:46.353635+00:00 heroku[web.1]: State changed from up to down
2013-06-22T02:25:46.337936+00:00 heroku[web.1]: Process exited with status 137
~/collegeanswerz >>
Now that I see your logs I did some looking around and you are not the only person to experience this. Try removing the locally compiled assets with: git rm -r public/assets then push to heroku. Leave the change you made to your production.rb.
I saw your post in StackOverflow and it's cool! I love seeing people help each other in the community.
Do you remember what caused your problem last time? It was:
ActionView::Template::Error (home.css isn't precompiled):
And you needed to add home.css to config/environments/production.rb. You need to tell production.rb that you need home.css. You need to tell that you need other css files than application.css.
Now, what error you see in your log after the deploy?
ActionView::Template::Error (layout.css isn't precompiled):
Figured out? Now you need to add layout.css as well. You can simply add like this:
%w( home.css layout.css )
Again, you need to add every css you need other than application.css to config/environments/production.rb. If you have some js files that you need to add other than application.js, you also need to add to config/environments/production.rb. I can see there are a lot of css files that you need to add there in your app(e.g. college_pages, essays, about_college, etc for css, about_college for js).
Reading your log is the first step for debugging, programming. Log always tells you something (if there is no logs, I wouldn't be able to point out your problem!). I'm sorry that I didn't tell you how to watch your logs (seems like you didn't know about it).
Here is the usage of reading your log:
Usage: heroku logs
display recent log output
-n, --num NUM # the number of lines to display
-p, --ps PS # only display logs from the given process
-s, --source SOURCE # only display logs from the given source
-t, --tail # continually stream logs
Example:
$ heroku logs
2012-01-01T12:00:00+00:00 heroku[api]: Config add EXAMPLE by email#example.com
2012-01-01T12:00:01+00:00 heroku[api]: Release v1 created by email#example.com
You can do something like heroku logs -n 100 to see your last 100 lines of logs.
Hope this helps,
Keiko
Thanks so much for your help! I know you're kinda going beyond your responsibility and I appreciate it.
I added all my other css and js files to production.rb and I deployed successfully! The reason I was confused was that I didn't realize that I had to include all of them in production.rb. I thought for some reason that application.css and application.js somehow made it so I didn't have to, and I thought that home.css was an exception for some reason.
So I have a rails 3.2 app. I created an index.
I followed this guide: https://gist.github.com/nz/2041121 to create an bonsai.rb file in config/initializers/bonsai.rb
It looks like this:
ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
# Optional, but recommended: use a single index per application per environment.
# Caveat: This convention not be entirely supported throughout Tire's API.
app_name = Rails.application.class.parent_name.underscore.dasherize
app_env = Rails.env
INDEX_NAME = "#{app_name}-#{app_env}"
But I dosent work, this outprint from the heroku logs:
2013-03-06T17:04:54+00:00 app[web.1]: Processing by SchoolsController#index as HTML
2013-03-06T17:04:54+00:00 app[web.1]: Started GET "/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6" for 192.165.96.102 at 2013-03-06 17:04:54 +0000
2013-03-06T17:04:54+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "query"=>"Malmö"}
2013-03-06T17:04:58+00:00 heroku[router]: at=info method=GET path=/trafikskola?utf8=%E2%9C%93&query=Malm%C3%B6 host=stormy-escarpment-2346.herokuapp.com fwd="192.165.96.102" dyno=web.1 queue=0 wait=0ms connect=1ms service=3106ms status=500 bytes=643
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]: app/models/school.rb:19:in `search'
2013-03-06T17:04:58+00:00 app[web.1]: app/controllers/schools_controller.rb:10:in `index'
2013-03-06T17:04:58+00:00 app[web.1]: Completed 500 Internal Server Error in 3073ms
2013-03-06T17:04:58+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2013-03-06T17:04:58+00:00 app[web.1]:
2013-03-06T17:04:58+00:00 app[web.1]:
My questions:
Should I put somehting in the ELASTICSEARCH_URL in the bonsai.rb file? If yes, then what?
I have created a local index to, does that mean something?
Or is it something else?
The config/initializers/bonsai.rb was right and the problem was I had to index it in production mode also.
So I did this:
heroku rake environment tire:import CLASS=School FORCE=true
And it worked.
I'm making a simple blog to learn rails.
Everything is almost finished, and I'm trying to apply HTTP authentication, as outlined here --> http://berk.es/2011/03/29/simplest-authentication-in-rails-basic-authentication-with-a-logged_in-helper/
My authentication code looks like this, in the ApplicationController
class ApplicationController < ActionController::Base
protect_from_forgery
protected
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == ADMIN_ID && password == ADMIN_PASSWORD
end
end
end
instead of passing the variable in my files, however, I want to pass it through heroku. So I ran -->
heroku config:add ADMIN_ID=myusername
heroku config:add ADMIN_PASSWORD=mypassword
When I tried logging in though I get a "Something went wrong" message. Here's what heroku logs say :
GET fast-chamber-1998.herokuapp.com/admin dyno=web.1 queue=0 wait=0ms service=10ms status=500 bytes=643
2012-11-11T07:18:47+00:00 app[web.1]:
2012-11-11T07:18:47+00:00 app[web.1]:
2012-11-11T07:18:47+00:00 app[web.1]: Started GET "/admin" for 60.245.65.132 at 2012-11-11 07:18:47 +0000
2012-11-11T07:18:47+00:00 app[web.1]: Processing by PostsController#admin as HTML
2012-11-11T07:18:47+00:00 app[web.1]: Completed 500 Internal Server Error in 1ms
2012-11-11T07:18:47+00:00 app[web.1]:
2012-11-11T07:18:47+00:00 app[web.1]: NameError (uninitialized constant ApplicationController::ADMIN_ID):
2012-11-11T07:18:47+00:00 app[web.1]: app/controllers/application_controller.rb:7:in `block in authenticate'
2012-11-11T07:18:47+00:00 app[web.1]: app/controllers/application_controller.rb:6:in `authenticate'
2012-11-11T07:18:47+00:00 app[web.1]:
2012-11-11T07:18:47+00:00 app[web.1]:
From the looks of it, I think the environment variables I passed don't seem to be detected. What do you suggest I do?
You should access them as ENV['ADMIN_ID'] and ENV['ADMIN_PASSWORD']