简体   繁体   中英

problems deploying sinatra app to heroku

Ive just tried deploying a basic sinatra app to heroku and everytime i try and access the app through heroku i keep getting the following error messages in the heroku logs

2016-10-14T14:34:12.243266+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sleepy-fjord-82689.herokuapp.com request_id=4e85cc9f-a2e2-4dc4-bbb6-8daa9de6778b fwd="82.5.195.102" dyno= connect= service= status=503 bytes=

2016-10-14T14:34:13.108228+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sleepy-fjord-82689.herokuapp.com request_id=c173f495-e2f9-4119-8e45-790e2f55fc6e fwd="82.5.195.102" dyno= connect= service= status=503 bytes=

Im new to heroku so I havent really got a clue why this is happening, any help pointing me in the right direction would be appreciated.

Your application is crashing when navigating to the root ('/'). First make sure the app works on local machine, then follow the rack app guide for Heroku. There's a section for Sinatra. If this doesn't work, makes sure you can deploy the Hello World app as shown the in the example correctly.

Can you post here your Procfile file and your config.ru please?

if you want to check that your Procfile is working, you can check it locally with the foreman gem . Basically you need to add foreman to your development group in Gemfile and you can create a Procfile file with this content:

web: bundle exec rackup -p $PORT

And start your application with command foreman start .

Also to show in logs the full backtrace of the error, please consider adding to your Gemfile the gem rails_12factor and make sure that is available in the production group also.

This should allow you to see at least the full backtrace of the error. Hope this helps you.

Note: Sinatra does not reload the application locally upon changes. If you want that, i would suggest you to use the rerun gem and the rb-fsevent gems in your development group, and a different Procfile for the development environment.

Example: Procfile.dev web: rerun -- bundle exec rackup -p $PORT

and run it locally with foreman start -f Procfile.dev . This will allow you to change code and see the changes without manually restarting the server everytime.

Hope this helps you at least find the erorr.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM