When our client—a fast-scaling HR and EdTech platform—approached us to rethink their infrastructure, their Ruby on Rails app was already carrying a significant load. What began modestly on Heroku had evolved into a sprawling system hosted on AWS, powering the daily operations of thousands of educators, administrators, and learners across multiple countries. Years of growth, acquisitions, and technical improvisations had left them with a brittle monolith running on MongoDB. Reporting had become a bottleneck. Development was slowing down. And with GDPR growing ever more critical, a move to a European cloud provider became non-negotiable.

This is the story of how Selleo helped steer this transition—rewriting the data layer, migrating from MongoDB to PostgreSQL, and shifting infrastructure from AWS to Elastisys—all without breaking the platform or disrupting users.

Why PostgreSQL Was the Right Move

MongoDB was a great choice—once. Its flexibility allowed for rapid prototyping and fast feature rollouts. But over time, speed without structure showed its cracks. 

Graphic about why PostreSQL make sense

As the platform matured, new challenges surfaced:

  • Rectangle
    Reporting and analytics became core to business intelligence
  • Rectangle
    Data relationships grew increasingly complex
  • Rectangle
    Regional teams needed consistency and reliability.

PostgreSQL, with its transactional integrity and relational schema, emerged as the natural evolution. But getting there? That would be a challenge of its own.

Planning a Migration Without Disrupting Production

This wasn’t just a database switch—it was open-heart surgery on a live system.

Graphic with modern technology system and two womens standing in room

From day one, Selleo’s Ruby on Rails experts embedded with the client’s team. We didn’t just write code—we co-designed the path forward. Together, we mapped out risks, identified edge cases, and drafted a detailed roadmap. We weren’t a silent vendor. We were in the trenches as strategic partners.

Our work unfolded across two parallel and tightly coordinated tracks:

  • Rectangle
    Data layer rewrite: Moving from Mongoid to ActiveRecord, 
  • Rectangle
    Data migration orchestration: Supporting the client’s external consultant during the live migration from MongoDB to PostgreSQL, 
  • Rectangle
    Infrastructure transition: From AWS to GDPR-compliant Elastisys.

Simple graphic with three migration tracks

Each milestone was scoped, prioritized, and reviewed collaboratively. Every change went through transparent, async workflows. Feedback loops were tight. Surprises were few.

Rewriting the Data Layer, Model by Model

Legacy code tends to accumulate chaos. Mongoid models with embedded documents. Others with dynamic attributes. None of them fit neatly into SQL. So we slowed things down.

We began by isolating essential entities—users, assignments, clients. For each, we rebuilt clean ActiveRecord counterparts. We rewrote scopes, background jobs, and API interfaces. Crucially, we preserved method signatures to keep the frontend untouched. We paired on tricky parts. Reviewed thoroughly. And anchored the entire process in robust test coverage—running both MongoDB and Postgres validations side by side.

Running Two Databases—And Sleeping Well at Night

Eventually, we had two versions of the app in staging: the legacy MongoDB-based one and the PostgreSQL-based rebuild. We duplicated frontend clients so QA could A/B test and compare data behavior across systems.

Two mens with desktops in the office working on two apps and two databases

We scripted audits. Compared IDs, states, timestamps. We flagged edge cases before they turned into production headaches. Ownership of data integrity was ours — we traced anomalies and surfaced them early. When testing confirmed all blockers were resolved, we coordinated with all teams and stakeholders to greenlight the production launch. We timed the go-live for a quiet weekend coinciding with public holidays in our client’s key regions. That margin made a difference.

From AWS to Elastisys: A Strategic Infrastructure Shift

While the infrastructure migration was led by the client’s external partners, Selleo stayed close. Having previously architected their AWS setup, we advised on DevOps practices, reviewed migration plans, and helped align the new stack with compliance and operational needs.

The move to Elastisys—a GDPR-compliant European provider—wasn’t just a technical pivot. It was strategic. The client gained clearer billing, data sovereignty, and long-term peace of mind. CI/CD pipelines were rewritten. Observability was baked in. The new infrastructure wasn’t just compliant—it was ready to scale.

men with desktop and blue background working on global clouds

Go-Live Weekend: A Story of Quiet Success

It was quiet. Too quiet. During the final migration weekend, we ran the production data conversion script. Switched the database connection. Disabled logins except for selected test accounts. Ran manual smoke tests across all critical paths.Once everything checked out, we opened the gates.

By Monday morning, users logged in as usual. Same flows, same features. But under the hood, everything was different.

man with desktop and completed migration

Lessons We Learned

simple migration playbook with 5 key lessons

It’s hard to grasp the full weight of a migration until you’ve been inside one—living every constraint, every decision, every unknown. Some things only become clear once you’ve lived through a migration like this:

  • Rectangle
    Don’t touch the data until your app logic is airtight,
  • Rectangle
    Test staging like it’s production—because it might as well be, 
  • Rectangle
    Treat infrastructure migration as its own standalone project, 
  • Rectangle
    Write logs like your future self will depend on them (they will), 
  • Rectangle
    Great migrations begin with collaboration, not just code.

Planning a Migration of Your Own?

Whether you're replacing MongoDB, replatforming a Rails monolith, or migrating for compliance reasons — you don’t have to go it alone.

At Selleo, we help companies navigate high-stakes migrations without drama. Our Ruby on Rails teams write clean code, own deliverables, and embed deeply in your context. We anticipate. We plan. We keep you out of the dark. From database refactors to cloud transitions—we’ve done it, supported it, and made it stick.


Tomasz Noworyta's Avatar
Tomasz Noworyta

In the last 15 years, I’ve gained experience with more than 20 web applications delivered to companies from Europe, the U.S, and Australia. I love coding and enjoy solving various business problems with my programming skills, primarily in Ruby on Rails and Javascript. I work primarily for Mobile Commerce and HR solutions industry sectors helping clients to scale their development with remote teams or build custom web and mobile-based projects.

CONTACT WITH AUTHOR

CONTACT US

Tell us about your project

or

Rate this article:

0,0
based on 0 votes
Share it: