/unibus

A Hub-Spoke Rails Monorepo with Engines

Primary LanguageRuby

E Unibus Pluram CircleCI

Out of one, many.

Features

  • Run RSpec tests for all projects automatically via CircleCI 2.0
    • See circle.yml
  • Heroku Deployment via Hub-Spoke Buildpack
    • Include arbitrary number of engines in each application.

Why?

  • Build one application-per-audience.
  • Be AuthZ Free™ by spinning up new spoke Rails applications (that include core) for each new consumer.
  • Given a single repo, all related applications (that share a database) are free to run alongside one another without tripping over internal gem versioning.
  • Each Rails app can mount its own devise model, whether or not that model lives in core.

Structure

Caveats

A single application must be appointed "primary" and is responsible for maintaining and running migrations. In our case, it's customer. However, that makes utilizing rails g model Foo in employee a little more cumbersome.

Tips

  • Ignore .engines in your editor's project settings.

Setup Notes

# create all the rails app
rbenv local 2.3.1
gem install rails
rbenv rehash

rails plugin new api -T --mountable --dummy-path=spec/dummy --database=postgresql
rails plugin new core -T --mountable --dummy-path=spec/dummy --database=postgresql

rails new customer -T --database=postgresql
rails new employee -T --database=postgresql

ln -s $PWD/customer ~/.pow/unibus-customer
ln -s $PWD/employee ~/.pow/unibus-employee