Managing Large Scale apps via Rails

132 views Asked by At

We have developed an app in Rails 3 (planning to upgrade to rails 4) this year. We have sold this to 2 customers and now the problems will begin.

In the core all the apps are more or less the same except for the stylesheets, some html and some classes.

Now I am looking for a way to manage these applications for when we have for example 100 customers running the product.

Therefore the following questions:

  • How do you manage updates for all customers?
  • How do you manage fixes for all customers (for 2 customers I just cherry-pick at the moment but for 100 customers you can't do that, some customers code is different so something like mass cherry-pick will not always work)
  • How do you manage new customers?
  • Is it possible to work with stylesheet files to separate the code from the style like in drupal?
  • Any more concerns can always be added.

Kind regards.

EDIT1: the thing we provide is a site which has a core but each customer can change anything to the site from the core to the design.

EDIT2: RAILS CODE: we have a Rails admin interface let's say we make all the code customizable via settings:

If Settings.value_shown == true
 User.do_something
else
 User.do_something_else
end

CSS / SASS CODE: let's say we make 1 clean CSS and per customer we create an overwrite class that overwrites all the standard code.

EDIT3: Let's say each of the 50 customers has 3 branches a DEV / QUALITY / PRODUCTION system. We develop a fix for all customers how to do you deploy this fix to all customers?

3

There are 3 answers

4
moritz On

Putting the code for different customers into different branches is the first problem. You should really customize the per-customer code along some other axis. For example you could make a separate directory per customer, or some sort of plugin architecture, where sepcial code for customers is in separate projects. Or you have all the code in one big thing, and add some per-customer configuration.

But $N different branches for different customers mean $N copies of the code, and you'd have to patch them all manually. Don't do that.

A good keyword to google for is "software product line", because that's what you're trying to do :-)

2
Mike Campbell On

I get the impression you're hardcoding the differences? This will not scale, you need to be deploying the same codebase for all your clients otherwise you're setting yourself up for a monumental headache.

Build all the customisable components as client settings and store them in the database, so all your clients can run from the same codebase. If it's the layout and components they need to be able to change then look at building something using Shopify's Liquid, or similar. I've not used it but I've heard it's excellent.

2
Ajit Singh On

There could be a bunch of ways to solve this problem, but here are my thoughts:

  1. Create client based CSS and load appropriate CSS based on logged in client.
  2. You can have entire different markup for each client. Under your app/views directory, create entire "views" folder structure for individual client. e.g.

If you have following folder structure

app
  views
    users
    sessions
    dashboard
    etc. etc.

you can upgrade to following:

app
  views
    clientA
      users
      sessions
      dashboard

    clientB
      users
      sessions
      dashboard

and generate markup for individual client as per requirements. And to render appropriate clients "views" folder, use:

ApplicationController
  before_filter :load_views

  def load_views
    client = current_user
    #assuming that client.name is some unique identifier which points to folder name in app/views directory
    prepend_view_path "app/views/#{client.name}/"
  end
end

I hope this helps.