DEV Community

A.J. Romaniello
A.J. Romaniello

Posted on • Edited on

Sinatra on Heroku

Building my first Sinatra Application

I needed to create an application with a basic MVC structure. I chose to go with a Trail rating application that would let users browse and leave reviews on a number of trails.

You can view the project hosted on heroku here: hike-it-up.herokuapp.com

Hike-It-Up Homepage

Development

Starting out I used a gem called Corneal which is used to generate scaffolding for a basic Sinatra application. Very useful and exactly what I needed to get started.

I wanted to use Puma over Thin as a webserver which limited me from using shotgun. Puma is recommended for the production environment over Thin on Heroku. As well as Heroku not supporting SQLite3, I had to switch to PostgreSQL and for this reason I just all in all removed thin and shotgun from my project.

As in the development environment puma automatically would update like shotgun would if the changes were to html files.

As for the database, PostgreSQL is faster, so might as well go with the more optimized option.

Production

To deploy this project to Heroku I needed to learn how to correctly configure a Puma web server using workers. Luckily their guide was thorough and helpful when running into errors.

Heroku also automatically will redeploy your app if you link it to a github repository. This made production even easier once the initial setup was done.

Conclusion

After building this project I am extremely excited for the automation of Rails to build models, views, and controllers as well as dynamically building routes. After learning Sinatra I thought that it felt like magic, yet Rails takes things to a whole new level.

P.S. If you made it this far... thank you! Feel free to check out more information in the projects README on github.

Top comments (0)