What does changing RACK_ENV and RAILS_ENV do? - ruby-on-rails

I have deployed my application to Heroku and forked the environment to create a 'staging' environment. I copied my paroduction.rb file to create a staging.rb, but when I change the RAILS_ENV and RACK_ENV variables from production to staging no assets are returned and the logs show the following type errors:
2014-05-05T07:42:33.614170+00:00 app[web.1]: F, [2014-05-05T07:42:33.610206 #2] FATAL -- :
2014-05-05T07:42:33.614172+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets/application-835271b3bd7cf8b176e8b30d9ca395fd.js"):
2014-05-05T07:42:33.614173+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-05-05T07:42:33.614174+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-05-05T07:42:33.614176+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:38:in `call_app'
2014-05-05T07:42:33.614177+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:20:in `block in call'
2014-05-05T07:42:33.614178+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-05-05T07:42:33.614200+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-05-05T07:42:33.614202+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-05-05T07:42:33.614203+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/rack/logger.rb:20:in `call'
2014-05-05T07:42:33.614204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-05-05T07:42:33.614206+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-05-05T07:42:33.614207+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-05-05T07:42:33.614218+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.4/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-05-05T07:42:33.614219+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2014-05-05T07:42:33.614221+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/engine.rb:511:in `call'
2014-05-05T07:42:33.614222+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.4/lib/rails/application.rb:97:in `call'
2014-05-05T07:42:33.614224+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-05-05T07:42:33.614225+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-05-05T07:42:33.614226+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-05-05T07:42:33.614228+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-05-05T07:42:33.614229+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-05-05T07:42:33.614231+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I have found other posts on Stackoverflow e.g.: ActionController::RoutingError (No route matches [GET] "/assets/images/control_top.png"): in rails 3.2.8
and indeed changing config.serve_static_assets = false to true solves the problem, but I am reluctant to do this in just my staging environment and I understand that this will affect performance within the production environment.
What I really do not understand is why this error is occurring when the only difference as far as I can tell is that the environment variable names are changed. So to my question:
What does changing these environment variables actually change about the application? Why does it have this effect in my application?
As a bonus if there is a better way to solve the underlying problem I have described to have staging mirroring the production config I would appreciate the guidance.

Further investigation has established that the setting of environment variables has the following effect within deployment:
The environment-specific configuration files (such as config/environments/production.rb)
installation of gems as defined within the Gemfile group (e.g. group :production)
In this case heroku requires the gem 'rails_12factor' to enable static assets to be served. Therefore in addition to the group :production this gem is required for :staging.

Related

Persist spree product pictures after 'heroku restart'

I have a sample page I'm working on:
http://os-oven.herokuapp.com/
where I started uploading pictures for products. At some point during my trying things out, I had to run
heroku restart
which wiped out my pictures:
2015-01-08T14:13:39.161552+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/spree/products/1/small/Pumpkin_Pie_from_a_-real-_pumpkin__November_2007.jpg"):
2015-01-08T14:13:39.161554+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2015-01-08T14:13:39.161555+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2015-01-08T14:13:39.161573+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:38:in `call_app'
2015-01-08T14:13:39.161574+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `block in call'
2015-01-08T14:13:39.161576+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2015-01-08T14:13:39.161578+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:26:in `tagged'
2015-01-08T14:13:39.161579+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/tagged_logging.rb:68:in `tagged'
2015-01-08T14:13:39.161581+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/rack/logger.rb:20:in `call'
2015-01-08T14:13:39.161582+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2015-01-08T14:13:39.161584+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2015-01-08T14:13:39.161585+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2015-01-08T14:13:39.161586+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
2015-01-08T14:13:39.161588+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/middleware/static.rb:84:in `call'
2015-01-08T14:13:39.161590+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2015-01-08T14:13:39.161591+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:514:in `call'
2015-01-08T14:13:39.161593+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:144:in `call'
2015-01-08T14:13:39.161594+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'
2015-01-08T14:13:39.161596+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'
2015-01-08T14:13:39.161597+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'
2015-01-08T14:13:39.161598+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'
2015-01-08T14:13:39.161600+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'
2015-01-08T14:13:39.161601+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `load'
2015-01-08T14:13:39.161602+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>'
The pictures must have been saved locally, and when I restarted my app, it pulled the latest code from git.
How do I persist product pictures in the database for spree?
My thoughts:
Put them in something like s3. Downside to this is I would rather have a 'free-er' option for now. Plus, how would you configure spree to do this?
Get the files in version control. This may work, except I would need prod and dev to use the same db with the same file paths stored in the db.
Persist blobs to the db. I know this is probably not the most efficient way, but the data would always be available. Still would have to tweak the spree engine to do this.
You can't save picture on heroku.
Heroku has "Read-only Filesystem" https://devcenter.heroku.com/articles/read-only-filesystem
For free you can use cloudinary.com or Amazon S3
Amazon S3 also free up to 5Gb. http://aws.amazon.com/free/

download files from heroku

I have a utility on ruby on rails that uploads files to public folder. And by providing the link to that file i can download that file.
It is working fine on local rails server.
I deployed my work to heroku. where uploading part works. but when i click to login button it simply gives error
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
on looking to heroku logs, i noticed it is a routing error.
Any one please let me know what i am missing. as i am really beginner with heroku.
Thanks regards,
Update
Here are the heroku logs
2014-08-12T12:44:02.705737+00:00 app[web.1]: Rendered internships/show.html.erb within layouts/application (23.2ms)
2014-08-12T12:44:14.260997+00:00 heroku[router]: at=info method=GET path="/resume/Saghir%20Resume1.docx" host=shielded-atoll-2450.herokuapp.com request_id=87d911ee-2bb3-40e7-923b-a8029f7ab6ff fwd="39.44.84.14" dyno=web.1 connect=2ms service=27ms status=404 bytes=1182
2014-08-12T12:44:14.253695+00:00 app[web.1]: Started GET "/resume/Saghir%20Resume1.docx" for 39.44.84.14 at 2014-08-12 12:44:14 +0000
2014-08-12T12:44:14.256004+00:00 app[web.1]:
2014-08-12T12:44:14.253706+00:00 app[web.1]: Started GET "/resume/Saghir%20Resume1.docx" for 39.44.84.14 at 2014-08-12 12:44:14 +0000
2014-08-12T12:44:14.256011+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-08-12T12:44:14.256016+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-08-12T12:44:14.256007+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/resume/Saghir%20Resume1.docx"):
2014-08-12T12:44:14.256009+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-08-12T12:44:14.256014+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-08-12T12:44:14.256017+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:26:in `tagged'
2014-08-12T12:44:14.256012+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-08-12T12:44:14.256056+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-08-12T12:44:14.256059+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-08-12T12:44:14.256054+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-08-12T12:44:14.256022+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-08-12T12:44:14.256063+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-08-12T12:44:14.256019+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
2014-08-12T12:44:14.256020+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `call'
2014-08-12T12:44:14.256064+00:00 app[web.1]:
2014-08-12T12:44:14.256060+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-08-12T12:44:14.256078+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:20:in `block in call'
2014-08-12T12:44:14.256066+00:00 app[web.1]:
2014-08-12T12:44:14.256057+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-08-12T12:44:14.256094+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/engine.rb:511:in `call'
2014-08-12T12:44:14.256023+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-08-12T12:44:14.256077+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/rack/logger.rb:38:in `call_app'
2014-08-12T12:44:14.256072+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/resume/Saghir%20Resume1.docx"):
2014-08-12T12:44:14.256074+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2014-08-12T12:44:14.256090+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-08-12T12:44:14.256080+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `block in tagged'
2014-08-12T12:44:14.256098+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-08-12T12:44:14.256091+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-08-12T12:44:14.256025+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-08-12T12:44:14.256104+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2014-08-12T12:44:14.256027+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-08-12T12:44:14.256097+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-08-12T12:44:14.256085+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.5/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-08-12T12:44:14.256095+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.5/lib/rails/application.rb:97:in `call'
2014-08-12T12:44:14.256102+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-08-12T12:44:14.256083+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.5/lib/active_support/tagged_logging.rb:68:in `tagged'
Your link is to /resume/Saghir%20Resume1.docx (/resume/Saghir Resume1.docx) but you say its in the public folder -- is the upload directory /public/resume/file_name? And are you set for Rails to serve_static_assets?
As #CodeGnome pointed out, Heroku is an ephemeral filesystem so the entire approach is a bad idea -- typically you'd use Amazon S3 or a similar filestore for your uploaded files. Even if your routes are right, the file you uploaded can be on a different dyno because you're running more than one or because you've redeployed.
Heroku has something called the Ephemeral filesystem, so during the dyno’s lifetime its running processes can make use of it, but any file stored here will be discarded after the dyno has finished, so yes it does save the file, but after that it is deleted so it won't find it.
A very common approach is using paperclip and Amazon S3 for handling/storing the uploads, and those are pretty straightforward to install too. Here is a great article explaining how to do so: https://devcenter.heroku.com/articles/paperclip-s3

Apartment::SchemaNotFound when trying to deploy multi-tenancy Rails app on Heroku

I have been working on an app locally for a while now, and I've matched my development environment to that on Heroku as closely as I can.
The app is set up for multi-tenancy using Apartment (https://github.com/influitive/apartment), and designed to use subdomains to identify tenants. Both environments use postgres, and Apartment has been using schemas to manage the 'tanants' data.
This evening, I have attempted to push the code to Heroku (the same app before it became multi-tenancy worked beautifully), and no pages load, all give an error.
I've taken a look at the logs, and the most interesting line I can find is; Apartment::SchemaNotFound (One of the following schema(s) is invalid: heroku-app-name, "public"):
This certainly seems to be a peculiarity of Heroku, but I'm struggling for ideas on where to look next.
Any suggestions or help would be appreciated.
I've included all of the logs for reference;
2014-04-04T18:27:09.884367+00:00 app[web.1]: Apartment::SchemaNotFound (One of the following schema(s) is invalid: heroku-app-name, "public"):
2014-04-04T18:27:09.884368+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/postgresql_adapter.rb:95:in `rescue in connect_to_new'
2014-04-04T18:27:09.884384+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
2014-04-04T18:27:09.884362+00:00 app[web.1]:
2014-04-04T18:27:09.884385+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
2014-04-04T18:27:09.884364+00:00 app[web.1]: I, [2014-04-04T18:27:09.879482 #2] INFO -- : Started GET "/favicon.ico" for 92.25.163.224 at 2014-04-04 18:27:09 +0000
2014-04-04T18:27:09.884388+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
2014-04-04T18:27:09.884389+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/flash.rb:241:in `call'
2014-04-04T18:27:09.884366+00:00 app[web.1]: F, [2014-04-04T18:27:09.884136 #2] FATAL -- :
2014-04-04T18:27:09.884370+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/postgresql_adapter.rb:88:in `connect_to_new'
2014-04-04T18:27:09.884381+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
2014-04-04T18:27:09.884371+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/adapters/abstract_adapter.rb:100:in `switch'
2014-04-04T18:27:09.884383+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
2014-04-04T18:27:09.884396+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
2014-04-04T18:27:09.884372+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/apartment-0.24.3/lib/apartment/elevators/generic.rb:20:in `call'
2014-04-04T18:27:09.884387+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
2014-04-04T18:27:09.884398+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2014-04-04T18:27:09.884403+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
2014-04-04T18:27:09.884391+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
2014-04-04T18:27:09.884392+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
2014-04-04T18:27:09.884399+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__2212192162733263500__call__callbacks'
2014-04-04T18:27:09.884400+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
2014-04-04T18:27:09.884393+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/cookies.rb:486:in `call'
2014-04-04T18:27:09.884402+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2014-04-04T18:27:09.884406+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-04-04T18:27:09.884379+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
2014-04-04T18:27:09.884395+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/query_cache.rb:36:in `call'
2014-04-04T18:27:09.884409+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2014-04-04T18:27:09.884407+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2014-04-04T18:27:09.884410+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2014-04-04T18:27:09.884404+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
2014-04-04T18:27:09.884430+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2014-04-04T18:27:09.884431+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2014-04-04T18:27:09.884432+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-04-04T18:27:09.884428+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2014-04-04T18:27:09.884435+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-04-04T18:27:09.884444+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2014-04-04T18:27:09.884434+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-04-04T18:27:09.884437+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-04-04T18:27:09.884442+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2014-04-04T18:27:09.884445+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-04-04T18:27:09.884448+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-04-04T18:27:09.884446+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-04-04T18:27:09.884450+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-04-04T18:27:09.884451+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-04-04T18:27:09.884452+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
Take a look at your apartment initializer and remove the subdomain elevator settings. i commented out everything related to elevator. since your app is probably on a heroku subdomain, the elevator setting will try to load that particular tenant from the db and will issue that error.
it worked fine for me after i commented
# Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain'

Rails app fails on Heroku: (No route matches [GET] "/")

Newbie to both Rails and Heroku, and I'm trying to deploy a simple app by following the step-by-step instructions in the Rails Tutorial. The app runs fine locally and shows the default Rails starter page. But navigating to the app url in Heroku keeps giving me a 404 Page Not Found, even though it's the same app and I haven't touched the routes files or any controllers etc.
I'm on a Mac 10.6.8 with the latest Ruby (1.9.3) and Rails (4.0.0).
Things I've Tried:
Following the answer in Rails 3.1.3 on Heroku: (No route matches [GET] "/assets/rails.png") I added code to config/application.rb for lazily compiling assets in production:
if defined?(Bundler)
# If you want your assets lazily compiled in production, use this line
Bundler.require(:default, :assets, Rails.env)
end
Following the answer in Rails production static files routing error I modified production.rb to ensure static assets were being served:
config.serve_static_assets = true
But I still get the 404. What else can I try?
Heroku Log:
2013-05-31T16:39:41.675219+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-05-31T16:39:41.675219+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `call'
2013-05-31T16:39:41.675219+00:00 app[web.1]: F, [2013-05-31T16:32:49.152450 #2] FATAL -- :
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-05-31T16:39:41.676016+00:00 app[web.1]: F, [2013-05-31T16:32:52.415675 #2] FATAL -- :
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]:
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/engine.rb:511:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]:
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/application.rb:96:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-05-31T16:39:41.675513+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-05-31T16:39:41.676016+00:00 app[web.1]: I, [2013-05-31T16:32:52.414612 #2] INFO -- : Started GET "/" for 67.244.94.162 at 2013-05-31 16:32:52 +0000
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `block in call'
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:38:in `call_app'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-05-31T16:39:41.676016+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-05-31T16:39:41.675777+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
2013-05-31T16:39:41.676016+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/application.rb:96:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]:
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-05-31T16:39:41.676490+00:00 app[web.1]:
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/engine.rb:511:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
2013-05-31T16:39:41.676490+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-05-31T16:39:41.676253+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]: I, [2013-05-31T16:38:42.543864 #2] INFO -- : Started GET "/" for 67.244.94.162 at 2013-05-31 16:38:42 +0000
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `call'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:38:in `call_app'
2013-05-31T16:39:41.676490+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-05-31T16:39:41.676490+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
2013-05-31T16:39:41.676490+00:00 app[web.1]: F, [2013-05-31T16:38:42.544833 #2] FATAL -- :
2013-05-31T16:39:41.677196+00:00 app[web.1]:
2013-05-31T16:39:41.677196+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
2013-05-31T16:39:41.677196+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-05-31T16:39:41.677196+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-05-31T16:39:41.677196+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:38:in `call_app'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/engine.rb:511:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-05-31T16:39:41.677196+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `block in call'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `call'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/engine.rb:511:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/rack/logger.rb:21:in `block in call'
2013-05-31T16:39:41.676725+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
2013-05-31T16:39:41.677196+00:00 app[web.1]:
2013-05-31T16:39:41.677196+00:00 app[web.1]: I, [2013-05-31T16:39:41.674148 #2] INFO -- : Started GET "/" for 67.244.94.162 at 2013-05-31 16:39:41 +0000
2013-05-31T16:39:41.676969+00:00 heroku[router]: at=info method=GET path=/ host=floating-refuge-5703.herokuapp.com fwd="67.244.94.162" dyno=web.1 connect=0ms service=5ms status=404 bytes=1351
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/application.rb:96:in `call'
2013-05-31T16:39:41.676961+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-05-31T16:39:41.677196+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-05-31T16:39:41.677665+00:00 app[web.1]:
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-4.0.0.rc1/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
2013-05-31T16:39:41.677665+00:00 app[web.1]:
2013-05-31T16:39:41.677196+00:00 app[web.1]: F, [2013-05-31T16:39:41.675079 #2] FATAL -- :
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0.rc1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-05-31T16:39:41.677432+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-4.0.0.rc1/lib/rails/application.rb:96:in `call'
2013-05-31T16:39:41.677665+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
First of all Rails4 apps no longer serve public/index.html, or app/assets/rails.png, as those files are now handled by the rails gem itself, so you can safely ignore all talk relating to them.
Secondly, I would advise you to ignore the advice given in the question you linked to as it's not at all relevant for rails4. You will not need to procompile your assets if you're using heroku. They do it for you when you push your app to them. It's probably worth removing the public/assets folder that you created when your ran rake assets:precompile as it will just get in the way
Thirdly, remove the code you added to config/application.rb as there is no assets group in Rails 4
Fourthly, heroku used to inject a plugin for serving static assets into your app, but now you need to do that yourself by adding the following to your Gemfile:
gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
Fifthly, you are using Webrick server. Heroku advise you to switch to Unicorn.
Lastly, don't worry about the default Rails landing page not being shown on Heroku. It might be a bug in their system, it happened to me, it will happen to the next guy, it would more than likely happen to Matz if he tried it too. It's no big deal. Just move on. Your app is ready for you to start developing your own landing page.
Good luck and for what it's worth, here's a very simple example Gemfile optimised for heroku:
source 'https://rubygems.org'
# you are using Ruby 1.9.3, better to 2.0.0 upgrade for more speed
ruby '2.0.0'
gem 'rails', '4.0.0.rc1'
gem 'sass-rails', '~> 4.0.0.rc1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'
# The asset_sync gem is WELL worth using
# but you should read more about it before deciding
# https://github.com/rumblelabs/asset_sync
# gem 'asset_sync'
# only want sqlite in dev and test envs
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg' # dont want sqlite in production
gem 'unicorn' # make sure you follow installation instructions for this gem
gem 'rails_log_stdout', github: 'heroku/rails_log_stdout'
gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
end
group :doc do
gem 'sdoc', require: false
end

Heroku Rails Page Not Found

I'm trying to deploy a sample rails app on heroku. After creating a very basic app, adding a git repository, committing everything and "heroku create", I push it up to heroku. No errors at all in terminal, but when I open the browser with the correct address, I get the following:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
I've searched for three hours and used the heroku tutorial on how to deploy the app but I just can't figure out what I'm doing wrong.
Here is my Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0.beta1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'json'
group :production do
gem 'pg'
gem 'rails', '4.0.0.beta1'
gem 'railties', '4.0.0.beta1'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'sass-rails', '~> 4.0.0.beta1'
#gem 'coffee-rails', '~> 3.2.1'
gem 'coffee-rails', '~> 4.0.0.beta1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
I've repeated the steps above several times, didn't work. Thanks!
Edit: added heroku console logs:
2013-04-13T14:15:14.800540+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:80:in `start'
2013-04-13T14:15:14.801066+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `<top (required)>'
2013-04-13T14:15:14.801066+00:00 app[web.1]: script/rails:6:in `<main>'
2013-04-13T14:15:14.801375+00:00 app[web.1]: [2013-04-13 14:15:14] INFO going to shutdown ...
2013-04-13T14:15:14.801542+00:00 app[web.1]: [2013-04-13 14:15:14] INFO WEBrick::HTTPServer#start done.
2013-04-13T14:15:14.801066+00:00 app[web.1]: script/rails:6:in `require'
2013-04-13T14:15:14.800540+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `tap'
2013-04-13T14:15:14.822878+00:00 app[web.1]: => Booting WEBrick
2013-04-13T14:15:14.822878+00:00 app[web.1]: => Rails 4.0.0.beta1 application starting in production on http://0.0.0.0:44478
2013-04-13T14:15:14.822878+00:00 app[web.1]: => Call with -d to detach
2013-04-13T14:15:14.822878+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-04-13T14:15:14.822878+00:00 app[web.1]:
2013-04-13T14:15:14.822878+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `block in call'
2013-04-13T14:15:14.822878+00:00 app[web.1]: Started GET "/" for 178.25.122.239 at 2013-04-13 14:02:08 +0000
2013-04-13T14:15:14.822878+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:38:in `call_app'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `call'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-04-13T14:15:14.822878+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/engine.rb:510:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/application.rb:96:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-04-13T14:15:14.822878+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-04-13T14:15:14.823204+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2013-04-13T14:15:14.823433+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-04-13T14:15:14.823433+00:00 app[web.1]:
2013-04-13T14:15:14.823433+00:00 app[web.1]: Started GET "/" for 178.25.122.239 at 2013-04-13 14:04:08 +0000
2013-04-13T14:15:14.823433+00:00 app[web.1]:
2013-04-13T14:15:14.823657+00:00 app[web.1]:
2013-04-13T14:15:14.823657+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:38:in `call_app'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `block in call'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-04-13T14:15:14.823657+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/engine.rb:510:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/application.rb:96:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-04-13T14:15:14.823871+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-04-13T14:15:14.824082+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-04-13T14:15:14.824082+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-04-13T14:15:14.824082+00:00 app[web.1]:
2013-04-13T14:15:14.824082+00:00 app[web.1]:
2013-04-13T14:15:14.824082+00:00 app[web.1]: Started GET "/favicon.ico" for 178.25.122.239 at 2013-04-13 14:04:09 +0000
2013-04-13T14:15:14.824082+00:00 app[web.1]:
2013-04-13T14:15:14.824082+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
2013-04-13T14:15:14.824082+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-04-13T14:15:14.824082+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2013-04-13T14:15:14.824082+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:38:in `call_app'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `block in call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:67:in `tagged'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/rack/logger.rb:21:in `call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/tagged_logging.rb:25:in `tagged'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bu
ndle/ruby/2.0.0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0.beta1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2013-04-13T14:15:14.824292+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/engine.rb:510:in `call'
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-04-13T14:15:14.824503+00:00 app[web.1]:
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2013-04-13T14:15:14.824503+00:00 app[web.1]: Exiting
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0.beta1/lib/rails/application.rb:96:in `call'
2013-04-13T14:15:14.824503+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2013-04-13T14:15:14.824503+00:00 app[web.1]:
2013-04-13T14:15:14.516222+00:00 heroku[web.1]: State changed from starting to up
2013-04-13T14:15:16.056837+00:00 heroku[web.1]: Process exited with status 143
2013-04-13T14:16:05.609544+00:00 app[web.1]:
2013-04-13T14:16:05.609544+00:00 app[web.1]: To disable this message remove the `whitelist_attributes` option from your
2013-04-13T14:16:05.609544+00:00 app[web.1]: DEPRECATION WARNING: Model based mass assignment security has been extracted
2013-04-13T14:16:05.609544+00:00 app[web.1]: out of Rails into a gem. Please use the new recommended protection model for
2013-04-13T14:16:05.609544+00:00 app[web.1]: params or add `protected_attributes` to your Gemfile to use the old one.
2013-04-13T14:16:05.609544+00:00 app[web.1]: `config/application.rb` file and any `mass_assignment_sanitizer` options
2013-04-13T14:16:05.609544+00:00 app[web.1]: See http://guides.rubyonrails.org/security.html#mass-assignment for more information.
2013-04-13T14:16:05.609544+00:00 app[web.1]:
2013-04-13T14:16:05.609544+00:00 app[web.1]:
2013-04-13T14:16:05.609544+00:00 app[web.1]: from your `config/environments/*.rb` files.
2013-04-13T14:16:05.730223+00:00 heroku[router]: at=info method=GET path=/ host=mighty-depths-7233.herokuapp.com fwd="178.25.122.239" dyno=web.1 connect=1ms service=209ms status=404 bytes=728
2013-04-13T14:16:05.980431+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=mighty-depths-7233.herokuapp.com fwd="178.25.122.239" dyno=web.1 connect=0ms service=6ms status=404 bytes=728
First of all there's a good guide on routing in Rails here.
Lets say you have an Article model in your app and an articles controller, you have to define the routes for this resource under config/routes.rb. Rails allows you to add routes for index, show new, create, edit, update and destroy in one line:
resources :articles
This will map to the following:
GET /articles index display a list of all articles
GET /articles/new new return an HTML form for creating a new article
POST /articles create create a new article
GET /articles/:id show display a specific article
GET /articles/:id/edit edit return an HTML form for editing a article
PUT /articles/:id update update a specific article
DELETE /articles/:id destroy delete a specific article
However to make sure that the homepage routes to one of these actions you need to define root under config/routes.rb
root to: "articles#index"
Then commit and push it to heroku again.
I notice that you're trying (probably unintentionally) to use an 'edge' version of rails (4+).
I would stick with a 3.x version for now and that's what the tutorial is probably assuming.
You can use this to create an app with a specific version (3.2 in this case)
rails _3.2_ new myapp
If you don't have that version of rails on your system you may need to install it, e.g.
gem install -v=3.2 rails
or, if that fails,
sudo gem install rails -v3.2
The above is why, when you follow the current Heroku instructions it assumes rails 3 and that version does do that default root path and the public/index.html file

Resources