Dockerization of Multiple Applications in One Server

Problem Statement

Configuring applications like WordPress in one Operating System & migrating the same over to other OS always ends up with some misconfiguration & deployment failure. An efficient way to create light-weight packages for applications with instant portability.
Maintaining multiple servers for various properties was a cumbersome process for most organizations. Leveraging the advent of containerization & Docker, we suggested the client to incorporate Docker and containerize all the properties.

Business Objectives

  1. The client had multiple websites being hosted in separate virtual machines. Maintaining the virtual machines was a tedious task for the engineers.
  2. Reduce the cost for hosting multiple websites from multiple virtual machines.
  3. Increase the efficiency in resource utilization.

Technical Objectives

  1. Multiple websites using different versions of LAMP stack to be hosted by efficient utilization of resources.
  2. Migrate the application from the virtual machine to a Docker container.
  3. Implement high availability with the use of Amazon EC2 Container Services.
  4. Increase the scalability of each application by autoscaling the containers.

Architecture Diagram
Initial Architecture

Docker Architecture

Design Facts

Management of multiple applications in a single EC2 instance:

  • Multiple wordpress applications hosted on various versions of LAMP servers maintained in a single EC2 instance with multiple containers hosting each application.
  • Manage multiple applications on one EC2 instance without degrading the performance of the websites.

Utilisation of EC2 resources: 

  • Optimal utilization of EC2 resources for all the containers. Docker containers utilize the resources of the host EC2 instance. The resources of the host EC2 was utilized across all the containers based on the requirement. 
  • The allocation of EC2 resources for the container applications was designed in a way to maximize the utilization of resources of the host EC2.

Fault Tolerance: 

  • Container applications were connected with the same RDS instance that had their corresponding databases. 
  • Configured a Multi-AZ setup for the RDS instance that helps to recover in case of RDS failover. Multi-AZ RDS setup has synchronous replication with the Master RDS. AWS takes care of routing the request to the Multi-AZ RDS if the master RDS is out of service. 
  • Utilized Amazon Elastic Load Balancing to attain fault tolerant & load balanced distributed application. We used ELB to create endpoint that balances traffic across services in a cluster. 
  • Application Load Balancer routes traffic to each container based on the host path in the request header. 

Leveraging containers: 

  • The wordpress applications were migrated from the virtual machines to the docker containers. 
  • Docker images were created from the containers & uploaded to the private Docker Registry. 
  • Docker containers play a significant role in testing the applications with the various environments by recreating the containers. 

High Availability& Scalability: 

  • Leveraging the use of Amazon EC2 Container Service (Amazon ECS) to manage the containers across the cluster of EC2 instances. Amazon ECS facilitates to schedule the placement of containers in the cluster based on the resource requirements, availability needs & isolation policies. 
  • ECS Container agent runs in each instance of the ECS cluster. ECS monitors the current tasks & the resources that are utilized to ECS and hence manages the cluster. 
  • Configured Auto Scaling for scaling out & scaling in the container instances inside a cluster responding to various CloudWatch metrics. 

Security: 

  • No Docker container can look into processes running inside another container. 
  • The application that is converted to Docker images are pushed to private Docker registry. Images from public registry might be vulnerable to attacks & virus. 
  • Enforced least privileges for container access at runtime. This secures the docker containers from the vulnerability of attack. 

Cost reduction: 

  • The Dockerized architecture involved less number of EC2 instances to host multiple applications. This helped to reduce the cost of infrastructure. One large sized EC2 instance can replace 3-4 small sized EC2 instances. 

Result

  1. Portability of applications across various platforms for testing & production was provisioned.
  2. Dockerizing the applications helps in maximization of resource utilization.
  3. Docker ensures that the applications and resources are isolated and segregated.
  4. With Docker, the cost of infrastructure reduces with increase in scalability & availability of the application.

Quick Inquiry

Fill out my online form.