Multi-environment infrastructure migration (multi-tenant SaaS)
Migration of three environments (dev, staging, production) for a multi-tenant B2B SaaS from legacy infrastructure to an alternative cloud provider, without interrupting service to active tenants.
- Multi-tenant relational database
- Legacy framework (PHP)
- In-memory queue/cache
- Server provisioning tool
- Cloud provider migration
Context
A B2B SaaS client with a multi-tenant architecture, running three environments on legacy VM infrastructure that had been provisioned and maintained mostly by hand over several years. The goal of the engagement was to migrate all three environments to an alternative cloud provider, with a repeatable and documented process, without interrupting service to active tenants.
Problem
- Drift between environments: dev, staging, and production diverged in runtime versions and configuration, causing undocumented failures between environments.
- Manual, non-repeatable provisioning, increasing the risk of human error on every new environment.
- A database authentication-plugin mismatch between the newer MySQL version and the legacy application framework’s driver.
- Poorly configured queue and cache processes, leaving integrations stuck with no visible alert.
Approach
Migration carried out in two phases, from the least to the most critical environment: a full assessment phase of the existing environments, followed by the migration itself (establishing explicit database-user recreation as a mandatory procedure for any new environment), and an optimization phase that decoupled storage and database from the application instances.
Outcome
Production migration completed across all three environments with no tenant data loss, with deploy processes documented in a runbook. The optimization phase reduced monthly infrastructure cost.
Lessons
Documenting and standardizing the database authentication plugin before a major version change avoids hours of connection troubleshooting, and migrating from the least to the most critical environment lets you validate the whole process at controlled risk before the final cutover.