After watching the @eileencodes RailsConf keynote, I decided to resurrect an idea that Rails engines were the key to easy Rails scaling in larger companies since it promotes separation while being easier than SOA. Part of that separation is the need to have engines that can connect to their own database, promoting the portability of the engine.
Dan Manges articulates the gist of the engines only idea pretty well.
This is my original, functioning project from 2 years ago.
Current progress towards this goal.
Details of how an engine will work
Start with a separate, but otherwise normal, database.yml stored in the engine. The engine’s namespaced ApplicationRecord will establish a connection using that database.yml. Table prefix is also dropped since it is in its own database.
I think there is probably a better, less verbose way to have runtime stuff happen, but just haven’t figured it out yet.
In addition, we should expose new rake tasks, something like this from my original project.
Details of how the plugin generator will work
Right now I just added a
separate_database flag so the full command would be:
be rails plugin --full --mountable --separate_database bar_service
Thanks for your time,
Kelly Wolf Stannard