FastSolutions
FastSolutions

Reputation: 1829

Managing Large Scale apps via Rails

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:

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?

Upvotes: 0

Views: 136

Answers (3)

moritz
moritz

Reputation: 12832

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 :-)

Upvotes: 2

Ajit Singh
Ajit Singh

Reputation: 146

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.

Upvotes: 0

Mike Campbell
Mike Campbell

Reputation: 7978

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.

Upvotes: 1

Related Questions