Containerize Monolith Application

There are multiple ways* in which you can containerize monolith application. AWS has also recently launched App2Container - A2C commmand line tool, which automates containerization process by packaging the application artifact and identified dependencies into container images, configures the network ports, and generates the ECS task and Kubernetes pod definitions. A2C provisions, through CloudFormation, the cloud infrastructure and CI/CD pipelines required to deploy the containerized application.

For this workshop, we will take dive deep - step by step approach, which will help you with better understanding of the underlaying infrastructure components and AWS Services.

  • Download Dockerfile and files to working directory. It is required to containerize our Trip Management monolith application.

    cd ~/environment/tripmgmt/
    wget -O Dockerfile
  • Review support files.

    cat Dockerfile
  • Build application with production flag. This command may take around 3 - 5 mins.

    ./gradlew bootWar -Pprod -Pwar
  • Create docker image.

    docker build -t tripmgmt .
  • Test production release application locally through docker-compose.

    docker-compose -f src/main/docker/app.yml up 

    Monolith Application boot

  • To open application for testing, use Preview -> Preview Running Application and then click Pop Out Into New Window from newly opened IDE browser window as shown in below image.

    Trip Management Cloud9 Test

  • Play with the Application by sign-in.

    Trip Management Monolith Application

  • Once you are done with playing with, open another terminal window and gracefully shutdown Trip Management Monolith Application.

    docker-compose -f src/main/docker/app.yml down
  • Great, Congratulations !!! You have successfully created and conainerized Java and React based Monolith Application. Let’s learn and explore next section for deploying containerized Monolith Application through AWS DevOps services.

* Note: Jhipster provides jhipster aws and jhipster aws-containers generator options, which respectively deploys to AWS Elastic Beanstalk and AWS ECS with Fargate launch type with other supported services. However, it has limited support and all setup is done with cloudformation template. So for this workshop, we will learn and explore AWS DevOps Services and Amazon ECS with dive deep approach.