Location Research Breakthrough Possible @S-Logix pro@slogix.in

High-Availability Migration of a Legacy E-Commerce Application to Cloud Infrastructure

Description

This project is about moving an old e-commerce application from an on-premises physical server to Cloud infrastructure and making the application highly available. Currently, the application runs on one physical server, so if the server fails, the shopping website may become unavailable. The project will migrate the application and its data to Cloud, create multiple application servers, use a Cloud Application Load Balancer to distribute customer traffic, configure monitoring, and validate the application before production cutover. This allows the application to continue working even if one application server becomes unavailable.

Aim

To safely migrate the existing e-commerce application from the on-premises server to Cloud infrastructure and create a highly available environment that can handle customer traffic and continue operating if one application server fails.

Objectives

01 Assess the existing application, server, database, storage, network, and dependencies.
02 Create the required Cloud network and Cloud infrastructure using Infrastructure as Code.
03 Migrate the existing e-commerce application and its data to Cloud with minimal disruption.
04 Create multiple Cloud EC2 servers so the application does not depend on a single server.
05 Configure a Cloud Application Load Balancer to distribute customer traffic across multiple application servers.
06 Automatically configure the migrated servers and application using Ansible.
07 Configure monitoring to track server performance and application health.
08 Test the environment to verify that the application remains available when one application server fails.

Application Workflow

01

Customer Access and Product Browsing

Process

Customers access the e-commerce application, browse products, view prices and availability, and select products for purchase.

Tools
Nginx PostgreSQL 14
Implementation

Customers access the application through the web interface. Nginx receives incoming requests and forwards them to the E-Commerce Application. Product information, prices, and availability are retrieved from PostgreSQL 14.

02

Shopping Cart and Order Creation

Process

Customers add products to the shopping cart, enter required order details, and submit orders for processing.

Tools
PostgreSQL 14
Implementation

The application validates the selected products and customer details. Cart and order information is stored in PostgreSQL 14, and product availability is checked before the order is confirmed.

03

Payment Processing and Order Confirmation

Process

Payment is processed after order validation, and successful transactions result in order confirmation.

Tools
PostgreSQL 14 REST APIs
Implementation

The application sends payment requests through REST APIs to the external payment service. The payment status is received and stored in PostgreSQL 14, and the order status is updated accordingly.

04

Order Fulfillment and Shipment

Process

Confirmed orders are prepared for fulfilment, inventory is updated, and shipment information is created for delivery.

Tools
PostgreSQL 14 REST APIs
Implementation

The application retrieves confirmed order information from PostgreSQL 14, updates inventory and fulfilment details, and exchanges shipment information with external logistics services through REST APIs.

05

Order Tracking and High Availability

Process

Customers track order status while the application remains available through redundant Cloud infrastructure.

Tools
Nginx PostgreSQL 14 Cloud Load Balancer Cloud EC2 Prometheus Node Exporter Grafana
Implementation

Order and shipment status are stored in PostgreSQL 14 and displayed through the web interface. Cloud Load Balancer distributes customer requests across Cloud EC2 instances. If one instance becomes unavailable, traffic is directed to another healthy instance. Prometheus and Node Exporter monitor infrastructure performance, while Grafana provides monitoring dashboards.

Current Infrastructure

Existing on-premises infrastructure and technologies used before migration.

Existing On-Premises Environment

Database Engine PostgreSQL 14

Stores customer accounts, shopping carts, orders, and product information.

Operating System Ubuntu Server 24.04 LTS

The application and database currently run on an on-premises physical Linux server.

Process Management Systemd

Starts and manages the e-commerce application and background services.

Web Server Nginx

Receives HTTP/HTTPS requests from customers and forwards them to the e-commerce application.

Storage Linux ext4

Stores application files, database files, product images, and configuration files on the physical server.

Security and Access Linux PAM

Manages SSH access, users, and application permissions.

System Logging Journald

Collects application and system logs for troubleshooting.

Network and Firewall TCP/IP + UFW

The application uses port 8080, PostgreSQL uses port 5432, and UFW controls network access.

Deployment Location On-Premises Linux Server

The entire application and database run on one physical server. If this server fails, the e-commerce application can become unavailable.

Target Infrastructure

Cloud-hosted infrastructure and technologies used after migration and modernization.

Cloud-Hosted Modernized Environment

Database Engine PostgreSQL 14

Continues to store customer accounts, shopping carts, orders, and product information.

Operating System Ubuntu Server 24.04 LTS

Runs the application on the Cloud servers.

Process Management Systemd

Starts and manages the application, PostgreSQL, and other services.

Security and Access Linux PAM

Manages users, SSH access, and application permissions.

System Logging Journald

Collects system, Nginx, application, and PostgreSQL logs for troubleshooting and operational analysis.

Network and Firewall TCP/IP + UFW

The application uses port 8080, PostgreSQL uses port 5432, and UFW controls server traffic.

Networking Cloud VPC

Provides a private and secure network for the Cloud servers.

Load Balancer Application Load Balancer (ALB)

Distributes customer traffic between multiple EC2 servers. If one server fails, traffic can be sent to another healthy server.

Cloud Compute Servers Cloud EC2

Provides multiple virtual servers to run the e-commerce application. Multiple servers are used to provide high availability.

Storage Cloud EBS

Provides persistent storage for the operating system, application files, and PostgreSQL data on the EC2 servers.

Network Discovery Tool Nmap

Finds active systems, open ports, and network services.

Infrastructure Inventory Tool Open-AudIT

Collects information about the existing server hardware and installed software.

System Audit Tool osquery

Checks running processes, users, and installed software.

Infrastructure as Code Tool OpenTofu

Automatically creates and manages Cloud resources such as VPC, EC2, EBS, and the Application Load Balancer.

Configuration Automation Tool Ansible

Automatically configures the migrated servers and installs required software.

Monitoring Tool Prometheus + Node Exporter

Node Exporter exposes server metrics, while Prometheus collects and stores CPU, memory, disk, network, and system performance metrics.

Monitoring Dashboard Grafana

Displays Prometheus metrics in easy-to-read monitoring dashboards.

Migration Cloud MGN (Application Migration Service)

Continuously copies the on-premises server data to Cloud and supports migration of the existing server.

Implementation Process

01
Assess the Existing E-Commerce Environment
  • Use Nmap to identify active systems, open ports, and network services.
  • Use Open-AudIT to collect information about the existing server hardware and installed software.
  • Use osquery to check running processes, users, and system configuration.
  • Review PostgreSQL 14, Nginx, Systemd, storage, firewall, and logging configuration.
  • Record the existing application, database, and server resource requirements.
02
Build the Cloud High-Availability Environment
  • Use OpenTofu to create the Cloud VPC, Cloud EC2, Cloud EBS, Cloud Application Load Balancer, Security Groups, and Network ACLs.
  • Create multiple Cloud EC2 instances to host the e-commerce application.
  • Configure the Cloud Application Load Balancer to distribute customer traffic across the EC2 instances.
  • Install Ubuntu Server 24.04 LTS, Nginx, PostgreSQL 14, and Systemd.
  • Configure Linux PAM, UFW, and Cloud Security Groups for secure access.
03
Migrate and Configure the Application
  • Install the Cloud MGN agent on the existing on-premises server.
  • Use Cloud MGN to continuously replicate the existing server to Cloud.
  • Use Ansible to configure the migrated Cloud EC2 instances.
  • Migrate the e-commerce application and PostgreSQL 14 data.
  • Configure Nginx, Systemd, PostgreSQL, storage, and network settings.
  • Validate customer, product, cart, order, payment, and inventory data.
04
Configure Monitoring and High Availability
  • Configure Node Exporter on the Cloud EC2 instances to expose server metrics.
  • Configure Prometheus to collect CPU, memory, disk, network, and system metrics.
  • Configure Grafana to display monitoring dashboards.
  • Configure the Cloud Application Load Balancer health checks to identify unhealthy EC2 instances.
  • Test application availability by making one application instance unavailable and verifying that traffic continues through the healthy instance.
05
Final Testing and Production Cutover
  • Perform final synchronization using Cloud MGN.
  • Test the complete e-commerce workflow, including product browsing, cart, order creation, payment, inventory, fulfilment, and shipment.
  • Verify PostgreSQL 14 data and application functionality.
  • Confirm Cloud Application Load Balancer traffic distribution and failover between EC2 instances.
  • Update the application endpoint or DNS to direct customers to the Cloud environment.
  • Monitor the application using Prometheus + Node Exporter + Grafana after cutover.
  • After successful validation, shut down the old on-premises environment.

Proposed Solution

The proposed solution moves the existing e-commerce application from an on-premises physical server to a Cloud environment with high availability. OpenTofu creates the Cloud infrastructure, Cloud MGN migrates the existing server, and Ansible configures the migrated Cloud EC2 instances. The existing Ubuntu Server, Python application, and PostgreSQL 14 database remain largely unchanged because the migration follows a lift-and-shift approach. Multiple Cloud EC2 instances are placed behind an Application Load Balancer to distribute customer traffic and provide failover. Prometheus, Node Exporter, and Grafana are used to monitor the Cloud environment.

Benefits

Reduced dependency on physical hardware : The application no longer depends on a single on-premises physical server.
Improved availability : Multiple EC2 servers allow the application to continue operating if one server becomes unavailable.
Load distribution : The Application Load Balancer distributes customer traffic across healthy application servers.
Automated management : OpenTofu and Ansible reduce manual infrastructure and server configuration work.
Better monitoring : Prometheus, Node Exporter, and Grafana provide visibility into server and application performance.
Flexible storage : Cloud EBS storage can be increased when additional storage is required.
Easy infrastructure management : Cloud infrastructure can be managed using Infrastructure as Code.

Challenges

Network bandwidth : Large amounts of data may take time to copy from the on-premises server to Cloud.
Application downtime : The final cutover must be planned carefully to reduce customer disruption.
Data consistency : Database and application data must be checked before the final switch.
Cloud cost : Running multiple EC2 servers continuously can increase Cloud costs.
DNS change : The DNS record must be updated correctly so customers reach the new Cloud application.
High-availability testing : Failover between application servers must be tested to ensure the application remains available when one server fails.