Search code examples
node.jsgrailsupgrademicroservices

How to change backend technology iteratively?


Background

Our backend is currently written in Grails. We would like to change the backend to NodeJs. We would like to execute the change in small iterations. We deploy everything on AWS.

Question

How to change the technology from Grails to NodeJs iteratively?

My opinion

Although we don't use Microservice Architecture (and none of us has any experience with it) I personally would:

  1. build a NodeJs server before our Grails server (something like a Gateway API maybe?)
  2. at first the NodeJs would just pass requests/responses to/from Grails
  3. then we would move other functionality from Grails (request logging, validations, ...) until we moved everything needed. (Maybe we keep something on Grails but most of the logic should end up on NodeJs.)

Solution

  • We have done a successful migration from Ruby & Rails to API Gateway & Lambda based Microservices written in NodeJS. The same architecture you can use if you prefer NodeJS server (Without Microservices) or using Docker Containers Cluster with ECS.

    • Setup CloudFront as a Proxy which will be getting all the HTTP traffic to your application domain (You can map the DNS to CloudFront CName)
    • In CloudFront you can add the current Grails Application as the default origin and behavior which makes your application works as it is same as today.
    • Then you can setup your Microservices Architecture with API Gateway and Lambda or NodeJS Web Server or Docker Container Cluster with ECS seperately. (Note that if you use a Relational Database like MySQL, it also requires to do proper placement of new server code in Lambda, WebServer or Containers so that it can access the Database)
    • Afterwards, you can write the new feature logic and override one http subpath at a time from CloudFront pointing to the new application.

    Following diagram shows the architecture in high-level. enter image description here

    Note: In the diagram, it uses DynamoDB for new Microservices and in the migration phase, you can also connect to the current Database with proper VPC, Subnet and Server placement.

    In Addition you gets the benefits from CloudFront CDN in caching static assets to improve application performance and also you will be able to terminate the SSL handhshake in CloudFront with free SSL Certificates issued by Amazon.