1
votes

We have a multi-tenant system with a separate database per tenant (but with the same schema and application code). How can we best to roll out updates to tenants? The deployment process is automated, but I don't particularly fancy having to take the whole system offline while any update scripts are run per tenant db? (particularly if one tenant has some unexpected issues because of data in their system - obviously something we'd aim to avoid).

What strategies have people used successfully for this? If I were to instead run each tenant on a separate website instance that gets upgraded separately - there would be more maintenance overhead, but perhaps more flexibility should issues be encountered upgrading? Not sure which is likely to be less painful in the long run? Thanks.

1
From the description of your problem, it seems you have a single-tenant setup, not a multi-tenant setup. - Gruber
@Gruber the database instances are separate but there is only one application instance - probably just getting into semantics as to whether that's true multi-tenant or not? - James Crowley

1 Answers

3
votes

Our way to deal with exactly this problem:

  • Have two instances, one running the old code, one the new code
  • Start (obviously) with all tenant sites pointing to the old version
  • Cycle the tenants (maybe automatically)
  • .... Copy the DB to temporary
  • .... Run update ond DB copy
  • .... wash, rinse, repeat until data converts successfully
  • .... test new code with temporary converted DB
  • .... drop temporary DB
  • .... Take tenant site offline
  • .... Run update on real DB (this should work unless last-minute changes introduced new issues)
  • .... Point tenant site to combination of new code/converted DB
  • End cycle

This has worked quite well until now, in fact it saved our bacon quite often: Problems tend to surface with the first few tenants, which may prompt a bugfix or two in the new code.