I just finished chapter five of the Mike Hartle rails tutorial and was a little confused when I loaded my files to heroku and the css for whatever reason was not working its magic like it was for me localy. Here is a copy of my heroku logs if that helps at all.
2013-09-17T00:40:31.225391+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'
2013-09-17T00:40:31.225544+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-09-17T00:40:31.225544+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-09-17T00:40:31.225544+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-09-17T00:40:31.359182+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=fathomless-earth-8911.herokuapp.com fwd="66.235.48.7" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/images/rails.png"):
2013-09-17T00:40:31.225689+00:00 app[web.1]:
2013-09-17T00:40:31.225689+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'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.225689+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'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.225689+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.226038+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'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2013-09-17T00:40:31.226188+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-09-17T00:40:31.226188+00:00 app[web.1]:
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2013-09-17T00:40:31.226188+00:00 app[web.1]:
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2013-09-17T00:40:31.226038+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2013-09-17T00:40:31.226188+00:00 app[web.1]: vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2013-09-17T00:40:31.226188+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-09-17T00:40:31.226188+00:00 app[web.1]: vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
I ran into the same issue (using Windows 7). I found that the question was only partially answered by Heijmans above. Hartl isn't very specific about why or how this error occurs but does address the issue in section 2.3.5 and the end of the intro to Chapter 3.
Mine worked after the following process.
First, I ran
> heroku run bundle exec rake assets:precompile
> heroku open
But I still got errors. Then I followed Hartl's suggestion in the book in the following manner.
> git add .
> git commit -m "Add precompiled assets for Heroku"
> git push
> git push heroku master
> heroku run rake db:migrate
> heroku open
Interestingly, Hartl states that "This shouldn’t be necessary, and I have been unable to reproduce the issue, but the reports are common enough that I include it here for reference."
[tag: heroku]
[tag: railstutorial.org]
[tag: Windows 7]
[tag: Rails 4]
In Production the asset pipeline will kick in and your app will look for the precompiled version of the assets. I'm not familiar with that tutorial but I am assuming because this is the leading cause of css and javascript not available in production (heroku). There are 2 ways you can fix this...
The first way is to precompile your assets on heroku by running the precompile command from your app's directory:
heroku run bundle exec rake assets:precompile
The second way (not suggested) is to turn of the asset pipeline by commenting these lines out in your config/environments/production.rb file:
# Do not fallback to assets pipeline if a precompiled asset is missed.
# config.assets.compile = false
You may also want to turn off digests for your asset urls if you are disabling your precompiled assets
# Generate digests for assets URLs.
# config.assets.digest = true
Related
What does this mean? State changed from up to down Idling because quota is exhausted Stopping all processes with SIGTERM
My heroku app shut down and when I type heroku logs -t it give me this
State changed from crashed to starting
2019-02-27T09:41:54.000000+00:00 app[api]: Build succeeded
2019-02-27T09:41:57.263955+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 41036 -e production`
2019-02-27T09:42:08.039524+00:00 heroku[web.1]: State changed from starting to up
2019-02-27T09:42:08.050315+00:00 heroku[web.1]: Idling
2019-02-27T09:42:08.054726+00:00 heroku[web.1]: State changed from up to down
2019-02-27T09:42:08.066260+00:00 heroku[web.1]: Idling because quota is exhausted
2019-02-27T09:42:07.658395+00:00 app[web.1]: [2019-02-27 09:42:07] INFO WEBrick 1.3.1
2019-02-27T09:42:07.658431+00:00 app[web.1]: [2019-02-27 09:42:07] INFO ruby 2.3.7 (2018-03-28) [x86_64-linux]
2019-02-27T09:42:07.658737+00:00 app[web.1]: [2019-02-27 09:42:07] INFO WEBrick::HTTPServer#start: pid=4 port=41036
2019-02-27T09:42:08.831687+00:00 heroku[router]: at=info code=H82 desc="Free app running time quota exhausted" method=GET path="/" host=www.petraauto.com request_id=17318012-510b-47e2-9277-fe1a448ec3ea fwd="174.6.158.167" dyno= connect= service= status=503 bytes= protocol=http
2019-02-27T09:42:09.238077+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-02-27T09:42:09.270539+00:00 app[web.1]: [2019-02-27 09:42:09] FATAL SignalException: SIGTERM
2019-02-27T09:42:09.270590+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/webrick/server.rb:177:in `select'
2019-02-27T09:42:09.270592+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/webrick/server.rb:177:in `block in start'
2019-02-27T09:42:09.270594+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/webrick/server.rb:33:in `start'
2019-02-27T09:42:09.270596+00:00 app[web.1]: /app/vendor/ruby-2.3.7/lib/ruby/2.3.0/webrick/server.rb:164:in `start'
2019-02-27T09:42:09.270597+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.5.5/lib/rack/handler/webrick.rb:14:in `run'
2019-02-27T09:42:09.270599+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/rack-1.5.5/lib/rack/server.rb:264:in `start'
2019-02-27T09:42:09.270600+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands/server.rb:69:in `start'
2019-02-27T09:42:09.270605+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2019-02-27T09:42:09.270606+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap'
2019-02-27T09:42:09.270608+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
2019-02-27T09:42:09.270610+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2019-02-27T09:42:09.270611+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
2019-02-27T09:42:09.270613+00:00 app[web.1]: bin/rails:4:in `require'
2019-02-27T09:42:09.270615+00:00 app[web.1]: bin/rails:4:in `<main>'
2019-02-27T09:42:09.273222+00:00 app[web.1]: [2019-02-27 09:42:09] INFO going to shutdown ...
2019-02-27T09:42:09.273252+00:00 app[web.1]: [2019-02-27 09:42:09] INFO WEBrick::HTTPServer#start done.
2019-02-27T09:42:09.273368+00:00 app[web.1]: => Booting WEBrick
You've run out of time on your Free Dynos.
https://devcenter.heroku.com/articles/error-codes#h82-free-dyno-quota-exhausted
https://devcenter.heroku.com/articles/free-dyno-hours#free-dyno-hour-pool
**RECENT UPDATE
Hey your post helped me out this morning. Unfortunately, minutes later, I received an email from Salesforce.
It looks like moving forward Heroku will no longer offer the free services, such as free Dynos. I think it discontinues November 28th or so.
Give the following a read: https://blog.heroku.com/next-chapter
And prepare accordingly for your applications using free dynos!
It's a simple 2 page Sinatra app and Heroku returns the following error messages.
I tried placing config.ru and app.rb below app folder and root path
but both did not work...
Am I missing something?
2018-03-22T18:40:51.490531+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:40:51.490533+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T18:40:53.657577+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 22470`
2018-03-22T18:40:55.804338+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T18:40:55.821099+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T18:40:55.675952+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T18:40:55.675970+00:00 app[web.1]: LoadError: cannot load such file -- ./app
2018-03-22T18:40:55.675972+00:00 app[web.1]: /app/config.ru:1:in `require'
2018-03-22T18:40:55.675973+00:00 app[web.1]: /app/config.ru:1:in `block in <main>'
2018-03-22T18:40:55.675974+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
2018-03-22T18:40:55.675976+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
2018-03-22T18:40:55.675977+00:00 app[web.1]: /app/config.ru:in `new'
2018-03-22T18:40:55.675978+00:00 app[web.1]: /app/config.ru:in `<main>'
2018-03-22T18:40:55.675980+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
2018-03-22T18:40:55.675981+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
2018-03-22T18:40:55.675983+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
2018-03-22T18:40:55.675985+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2018-03-22T18:40:55.675986+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
2018-03-22T18:40:55.675988+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
2018-03-22T18:40:55.675990+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
2018-03-22T18:40:55.675991+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T18:40:55.675993+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T18:40:55.675995+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:40:55.675997+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T18:44:05.000000+00:00 app[api]: Build succeeded
2018-03-22T18:44:40.562559+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-22T18:44:42.586913+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 5319`
2018-03-22T18:44:45.148047+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T18:44:45.168235+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T18:44:45.025605+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T18:44:45.025629+00:00 app[web.1]: LoadError: cannot load such file -- sinatra/link_header
2018-03-22T18:44:45.025631+00:00 app[web.1]: /app/app/app.rb:2:in `require'
2018-03-22T18:44:45.025632+00:00 app[web.1]: /app/app/app.rb:2:in `<top (required)>'
2018-03-22T18:44:45.025634+00:00 app[web.1]: /app/config.ru:1:in `require'
2018-03-22T18:44:45.025635+00:00 app[web.1]: /app/config.ru:1:in `block in <main>'
2018-03-22T18:44:45.025637+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `instance_eval'
2018-03-22T18:44:45.025638+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:55:in `initialize'
2018-03-22T18:44:45.025641+00:00 app[web.1]: /app/config.ru:in `<main>'
2018-03-22T18:44:45.025640+00:00 app[web.1]: /app/config.ru:in `new'
2018-03-22T18:44:45.025642+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `eval'
2018-03-22T18:44:45.025644+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:49:in `new_from_string'
2018-03-22T18:44:45.025646+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/builder.rb:40:in `parse_file'
2018-03-22T18:44:45.025647+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2018-03-22T18:44:45.025649+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:219:in `app'
2018-03-22T18:44:45.025651+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:354:in `wrapped_app'
2018-03-22T18:44:45.025652+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:283:in `start'
2018-03-22T18:44:45.025654+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T18:44:45.025655+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T18:44:45.025657+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T18:44:45.025659+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T19:04:36.398574+00:00 heroku[web.1]: Restarting
2018-03-22T19:04:36.399250+00:00 heroku[web.1]: State changed from up to starting
2018-03-22T19:04:37.265389+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2018-03-22T19:04:37.446567+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:37.288342+00:00 app[web.1]: [4] - Gracefully shutting down workers...
2018-03-22T19:04:37.301303+00:00 app[web.1]: bundler: failed to load command: rackup (/app/vendor/bundle/ruby/2.4.0/bin/rackup)
2018-03-22T19:04:37.301330+00:00 app[web.1]: SignalException: SIGTERM
2018-03-22T19:04:37.301336+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:381:in `block in setup_signals'
2018-03-22T19:04:37.301338+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:475:in `select'
2018-03-22T19:04:37.301339+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/cluster.rb:475:in `run'
2018-03-22T19:04:37.301340+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/puma/launcher.rb:183:in `run'
2018-03-22T19:04:37.301341+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.11.3/lib/rack/handler/puma.rb:69:in `run'
2018-03-22T19:04:37.301343+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:297:in `start'
2018-03-22T19:04:37.301344+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/lib/rack/server.rb:148:in `start'
2018-03-22T19:04:37.301345+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.4/bin/rackup:4:in `<top (required)>'
2018-03-22T19:04:37.301347+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `load'
2018-03-22T19:04:37.301392+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/bin/rackup:23:in `<top (required)>'
2018-03-22T19:04:38.773020+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 16845`
2018-03-22T19:04:40.529326+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:40.538335+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T19:04:40.541186+00:00 heroku[web.1]: State changed from crashed to starting
2018-03-22T19:04:40.428727+00:00 app[web.1]: configuration /app/config.ru not found
2018-03-22T19:04:42.516252+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 3071`
2018-03-22T19:04:44.810385+00:00 heroku[web.1]: Process exited with status 1
2018-03-22T19:04:44.823666+00:00 heroku[web.1]: State changed from starting to crashed
2018-03-22T19:04:44.653840+00:00 app[web.1]: configuration /app/config.ru not found
I just made the test, wrote a very simple Sinatra app and pushed it to Heroku.
Gemfile
source 'https://rubygems.org'
ruby '2.4.0'
gem 'sinatra'
config.ru
require './app'
run Sinatra::Application
app.rb
require 'sinatra'
get '/' do
"Hello world"
end
Launching rackup locally worked perfectly at this point, but when I pushed to heroku, I got an error as well, just like you. Looks like I was missing a Procfile. I then added a simple Procfile to tell Heroku what should be launched when running the app:
Procfile
web: bundle exec rackup config.ru -p $PORT
So at this point, I got this file hierarchy:
App directory
\
|– Gemfile
|– config.ru
|– app.rb
|– Procfile
And voilà, it now works perfectly. It might be worth giving it a shot and add this kind of Procfile to your project. You can find more details about Procfile on Heroku Getting started on Heroku with Ruby : Procfile and their devcenter article about process types and Procfiles.
I have a blog with file up-/download via paperclip 5.1.0 and turbolinks 5.0.1. Upload without validation works fine now, but download is only working for a short period after upload. Afterwards an error (404) is displayed:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
If you are the application owner check the logs for more information.
This did not help:
heroku rake db:migrate
heroku restart
I am on production with mysql DB on heroku. When I am not deploying via heroku: then the local copy works just fine with ruby version 2.2.4!
New deployment on heroku with git push heroku master does not fix the attachment links.
Only manual deletion of DB files and new upload makes attachment links work again for a short period of time.
P. S. When the dyno is restartet, e. g. with heroku restart, then the filesystem is new and deleted. But I do not know, how to make filesystem persistent with redis or amazon aws s3!
The log says:
2017-01-31T12:21:03.027810+00:00 heroku[router]: at=info method=GET path="/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar" host=infinite-taiga-25466.herokuapp.com request_id=fb775bcc-64f4-4d6b-89c0-70991af31e2f fwd="178.15.12.47" dyno=web.1 connect=0ms service=2ms status=404 bytes=1744
2017-01-31T12:21:03.026812+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] Started GET "/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar" for 178.15.12.47 at 2017-01-31 12:21:03 +0000
2017-01-31T12:21:03.027262+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f]
2017-01-31T12:21:03.027284+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] ActionController::RoutingError (No route matches [GET] "/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"):
2017-01-31T12:21:03.027302+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f]
2017-01-31T12:21:03.027334+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:53:in call'
2017-01-31T12:21:03.027336+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:incall'
2017-01-31T12:21:03.027337+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:36:in call_app'
2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:inblock in call'
2017-01-31T12:21:03.027339+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:26:in tagged'
2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:inblock in tagged'
2017-01-31T12:21:03.027340+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:in tagged'
2017-01-31T12:21:03.027341+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:incall'
2017-01-31T12:21:03.027341+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/request_id.rb:24:in call'
2017-01-31T12:21:03.027342+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:incall'
2017-01-31T12:21:03.027343+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in call'
2017-01-31T12:21:03.027344+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall'
2017-01-31T12:21:03.027345+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/executor.rb:12:in call'
2017-01-31T12:21:03.027346+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/static.rb:136:incall'
2017-01-31T12:21:03.027346+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in call'
2017-01-31T12:21:03.027347+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:522:incall'
2017-01-31T12:21:03.027349+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:578:in handle_request'
2017-01-31T12:21:03.027349+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:415:inprocess_client'
2017-01-31T12:21:03.027350+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:275:in block in run'
2017-01-31T12:21:03.027351+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:incall'
2017-01-31T12:21:03.027352+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in block in spawn_thread'
2017-01-31T12:21:03.027348+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/configuration.rb:226:incall'
C:\Sites\blog_production_heroku>
This is the root cause:
When the dyno is restartet periodically or with heroku restart then the filesystem is initialised and new.
I am still struggling to add Amazon S3 persistence to my app...
New git version of paperclip gem now works with aws-sdk-s3 gem, add this to Gemfile:
#Paperclip
gem 'paperclip', git: 'git://github.com/thoughtbot/paperclip.git'
https://github.com/twilio/hurl
I can't achieve the running server on Heroku by the steps from the readme file.
steps I did:
git clone git://github.com/twilio/hurl
cd hurl
gem install bundler
bundle install
heroku create
git push heroku master
heroku open
using heroku logs I see the error of getting connection to PG
"/app/app/models/db.rb:16:in `initialize': could not connect to server: Connection refused (PG::Error)"
please help what I'm doing wrong..
update:
file:`db.rb`
15 class PostgresDB < AbstractDB
16 CONN = PG::Connection::new(
17 ENV.fetch("POSTGRES_HOST", "localhost"),
18 ENV.fetch("POSTGRES_PORT", 5432),
19 :dbname => ENV.fetch("POSTGRES_DATABASE", "hurls"),
20 :user => ENV.fetch("POSTGRES_USER", "postgres"),
21 :password => ENV.fetch("POSTGRES_PASSWORD", "postgres")
22 )
Changed the details from the config heroku addon server of postgresql and got this error:
Starting process with command `bundle exec rackup config.ru -p 16112`
2013-02-14T07:55:41+00:00 app[web.1]: LINE 1: INSERT INTO hurls VALUES ($1::varchar, $2::bytea)
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1137:in `new'
2013-02-14T07:55:41+00:00 app[web.1]: /app/app/models/db.rb:39:in `exec': ERROR: relation "hurls" does not exist (PG::Error)
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/app.rb:35:in `initialize'
2013-02-14T07:55:41+00:00 app[web.1]: from config.ru:1:in `new'
2013-02-14T07:55:41+00:00 app[web.1]: ^
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.1.0/lib/sinatra/base.rb:1137:in `new'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/bin/rackup:4:in `<top (required)>'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/helpers.rb:69:in `each'
2013-02-14T07:55:41+00:00 app[web.1]: from config.ru:13:in `block in <main>'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:162:in `app'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:248:in `wrapped_app'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:100:in `start'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/helpers.rb:70:in `block in setup_default_hurls'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/helpers.rb:69:in `setup_default_hurls'
2013-02-14T07:55:41+00:00 app[web.1]: from config.ru:1:in `<main>'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/app.rb:245:in `save_hurl'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `eval'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/app/models/db.rb:39:in `save'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:35:in `parse_file'
2013-02-14T07:55:41+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:213:in `start'
2013-02-14T07:55:42+00:00 heroku[web.1]: Process exited with status 1
2013-02-14T07:55:42+00:00 heroku[web.1]: State changed from starting to crashed
2013-02-14T07:55:43+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=my-hurl-*****.herokuapp.com fwd=95.65.21.178 dyno= queue= wait= connect= service= status=503 bytes=
Anyone achieved the working heroku server?
solved
added all configuration variables using:
$ heroku config:add POSTGRES_DATABASE=your_database
$ heroku config:add POSTGRES_HOST=your_host
$ heroku config:add POSTGRES_USER=your_user
$ heroku config:add POSTGRES_PASSWORD=your_password
$ heroku config:add POSTGRES_PORT=5432
or in one line: $ heroku config:add POSTGRES_DATABASE=your_database POSTGRES_HOST=your_host POSTGRES_USER=your_user POSTGRES_PASSWORD=your_password POSTGRES_PORT=5432
else create the tables manually:
$ heroku pg:psql
create table users (id character(40), content bytea);
create table hurls (id character(40), content bytea);
Other than the files in the config directory, generated by rails console, the gemfile too needs to be properly edited to work with postgresql, normally rails generate db.rb to use sqlite3 and same db is mentioned in gemfile too, they both needs to work with postgresql as heroku uses postgres, hope it might help.
What does Heroku mean by app[web.1] and by <main>:48?
I have a crash that happens only on Heroku and not on my computer, I'm trying to identify the precise line causing the crash. These are the logs
2012-10-08T21:31:49+00:00 app[web.1]: <main>:48:in `method_missing': wrong number of arguments (1 for 2) (ArgumentError)
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/server.rb:104:in `block in initialize'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/server.rb:104:in `==='
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/server.rb:102:in `initialize'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:9:in `new'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:9:in `run'
2012-10-08T21:31:49+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/server.rb:102:in `each'
2012-10-08T21:31:50+00:00 heroku[web.1]: Process exited with status 1
2012-10-08T21:31:50+00:00 heroku[web.1]: State changed from starting to crashed
2012-10-08T21:31:52+00:00 heroku[router]: Error H10 (App crashed) -> GET placeboxy.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
Is the crash in my code or in the web server Thin or elsewhere?
Edit I changed the Procfile to run the server unicorn on Heroku and the crashed stopped. No error with puma either. Any ideas? Is Thin to fault?
The app[web.1] is a tag that heroku adds to your log to mark which process is emitting the log, as all the logs are collected in a central place, you can still filter a single process and parse the process log.
The <main>:48: part means the file/line where the execution has been stopped because of the exception. In this case (<main>) it's the main script that's being run. You won't find your error there, probably. You have to search in the backtrace for the part of your code that is failing, look for something that's not an external library, nor core ruby. The backtrace you show is of no help, normally the error is much lower in the stack trace.