I have created a sinatra-heroku-template app to make it easy on you. All files combined, it is only 20 lines of code.
Do the following to get it up and running.
git clone git://github.com/scottmotte/sinatra-heroku-cedar-template.git gem install bundler bundle heroku create yourwebapp git push heroku master bundle exec heroku open
That’s it. You now have a bare bones Ruby app running in production on Heroku. Add your own code as necessary.
Here’s a breakdown the file structure:
- app.rb defines your routes and is the core of your application
- config.ru boots your app
- Gemfile defines your library dependencies
- Procfile instructs Heroku how to run your application on its platform
Additionally, you can run the application locally with the following commands
git clone git://github.com/scottmotte/sinatra-heroku-cedar-template.git gem install bundler bundle bundle exec foreman
Visit localhost:5000 and you will see your application running.
Enjoy Sinatra and enjoy Heroku.