Note that there are some explanatory texts on larger screens.

plurals
  1. PORun a customized version of a Rails application
    text
    copied!<p>Here's our basic requirements:</p> <ul> <li>We have a base Rails application, which is being actively maintained.</li> <li>We want to offer a customized version of this app, given that: <ul> <li>servers must reside in our customer's premise and run on a different domain.</li> <li>there's a specific logging instrumentation for their own monitoring in the datacenter.</li> </ul></li> </ul> <p>To do that, I can see several options to achieve that goal:</p> <ul> <li>Git branch</li> <li><code>Rails::Engine</code></li> <li><code>Rails::Application</code></li> </ul> <p>The most obvious answer would be Git branch, for full flexibility.</p> <p>However I'm not sure if it's a good idea, because the code base is largely shared and the mainline has a lot more activities - catching up with rebase / merge could be just extra hassle.</p> <p>We want to decouple the original and the customized versions as far as possible. In other words, we want to have as less often conflicts as possible between the original and the customized.</p> <p><code>Rails::Engine</code> or <code>Rails::Application</code> seemed like a close idea (I'm not familiar with Rails Engines), but I don't understand how to have <code>OurApp::Application</code> and <code>OurCustomizedApp::Application</code> in one place and switch between them globally and dynamically.</p> <p>Probably it would be nice to have:</p> <ul> <li>custom initializers, controllers and views in a separate directory to override (or patch) the original</li> <li>ability to specify which app (the original or the customized) to boot by an environment variable like <code>RAILS_APP</code></li> <li>separate config files, like so: <code>config/database.yml</code> to be <code>config/customer1/database.yml</code></li> <li>ability to use the same <code>deploy.rb</code> for capistrano (probably with <code>config/servers.yml</code> and <code>config/customer1/servers.yml</code> to define roles and IPs?)</li> </ul> <p>Is there practices / conventions for our requirements? Any advice?</p> <p>Our apps run on Ruby 1.9.2 + Rails 3.0.3.</p> <p><strong>UPDATE</strong></p> <p>We started it as a Git branch. We created a rake task to generate a file at <code>config/branch</code> that includes text like "master" or "customized", and application.rb reads it upon bootstrap. Configs like <code>database.yml</code> or <code>servers.yml</code> now live in <code>config/mainline/</code> or <code>config/customized/</code>, and application.rb handles them accordingly.</p> <pre><code>config.paths.config.database = "config/#{branch}/database.yml" </code></pre> <p>Not perfect, but good enough for now. I'll update when we find a better way to do this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload