I'm trying to refactor my sinatra code to separate my main file into separate files, using some tips from this response, and I'm having troubles deploying to heroku.
Previously I didn't have a config.ru
file, and just used my Procfile
, which was:
web: bundle exec ruby web.rb -p $PORT
as per this article.
From the refactor, I've now changed my Procfile
to
web: bundle exec thin -R config.ru start -p $PORT
With my config.ru
file being
root = ::File.dirname(__FILE__)
require ::File.join( root, 'web' )
run MyApp.new
And my web.rb
file being contained around a class definition
class MyApp < Sinatra::Application
# ...
end
This works on my local development computer, but when I deploy to heroku, I get
2011-12-01T11:21:54+00:00 app[web.1]: bundler: command not found: thin
2011-12-01T11:21:54+00:00 app[web.1]: Install missing gem executables with `bundle install`
2011-12-01T11:21:56+00:00 heroku[web.1]: State changed from starting to crashed
2011-12-01T11:22:01+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2011-12-01T11:22:02+00:00 heroku[router]: Error H10 (App crashed) -> GET [my app].herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
Is thin not installed on heroku? Or is there some other way of running my app on heroku with the changes?
I had to update my Procfile
because the RACK_ENV
isn't passed into the heroku environment. The Procfile
became:
web: bundle exec thin -R config.ru start -p $PORT -e $RACK_ENV
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With