Bootstrap Sinatra projects using Corneal, Capistrano, Puma, and Nginx
Sinatra is a Ruby framework that helps you quickly create web applications, APIs and microservices. Its minimalism not only attracted a lot of developers, but it also inspired Flask in Python and Express in Node.js
If you are developing microservices or web APIs, Sinatra is a great choice. However, bootstraping a Sinatra project that is optimized for development speed as well as is easy to deploy has become non trivial because
- Documentation is not easy to find (you mostly find Ruby on Rails specific tips)
- You need to write code to set up and connect DB, manage migrations etc.
- You need to create a right directory structure yourself and configure it accordingly
- You also miss a boot file that you can use with console and with custom rake tasks/scripts
- Setting up projects for deployment is tedious and error prone, with a lot of details to be filled in for Capistrano, Puma and Nginx.
Scoop solves it by providing a good boilerplate that can be a starting point for your next project. It solves all the above mentioned problems and comes up with easy to edit configuration files that can help you correctly configure servers.
Scoop uses
- Corneal to make scaffolding models, controllers and views
- ActiveRecord as database ORM
- Capistrano for deployment
- Puma as app server
- Nginx as a proxy server
In addition,
- it is also JSON API ready with JSON, CORS and JSONP support already enabled,
- has a RoR like console, and
- comes up with example script and rake task that can be used to perform tasks that load the environment
Try Sinatra & Scoop by forking Scoop Repository. Scoop's README has detailed steps to set up development and production systems as well as the deployment process.
Please let me know in comments if you would want to try it out or have any suggestions - would love to improve the project.
Top comments (0)