Skip to content

rmcfadzean/rails-docker-template

Repository files navigation

Rails Docker Template [WIP]

A Rails template for generating a clean, new Rails (API) project with Docker, docker-compose, rspec and some nice defaults.

Notes / Requirements

  • This is very opinionated.
  • Rails >= 5.0.0
  • Ruby 2.5.0
  • --api only

Usage

Installation

rails new my_unicorn \
  -d postgresql \
  --api \
  -m https://raw.githubusercontent.com/rmcfadzean/rails-docker-template/master/template.rb

Using the application

Development

docker-compose run web rails db:create

Testing

docker-compose run web rspec

Deploying

TODO

The opinions

  • Testing is done with Rspec & Rack::Test
    • Controller tests are out
    • Integration/request/API tests are in
  • Docker & Docker compose are used for a containerised application

Gem List

  • Core
  • Testing
    • rspec-rails
    • webmock - Stop hitting real endpoints! You're testing your application, not theirs.
    • factory_girl_rails - Boo fixtures. Yay factories!
    • timecop - Allows you to timetravel during your tests
    • simplecov - Test coverage checker
    • faker - Generating fake data
  • Debugging
    • awesome_print - ap @object will print out things in a nice way to help with puts debugging
    • pry-rails - binding.pry will save your life
    • bullet - Helps with finding N+1 queries
    • sentry - catch and log your errors.
  • Security & Style
    • rubocop - A style checker with an autofixer. Keep your code clean and readable!
    • brakeman - Static analysis for security vulns & bad practice.
    • bundler-audit - Checks your gemfile for known vulnerabilities
  • Utils
    • annotate - Annotates your models, routes and factories with schema comments. Helpful for at-a-glance checks.

Credits

License

MIT

Releases

No releases published

Packages

No packages published

Languages