Jump to Content
Application Modernization

Developers, embrace application modernization with Migrate to Container's new CLI

May 23, 2023
https://storage.googleapis.com/gweb-cloudblog-publish/images/cloudmigration_2022.max-2500x2500.jpg
Eyal Yaron

Senior Product Manager

Erez Geva

Engineering Manager

Do you have applications in your portfolio that have been running for five, ten, or twenty years? 

Congratulations, that means people use them and they add value! However, those existing applications are often built on older technologies and platforms, which can make them difficult to maintain and upgrade. Modernizing these applications into containers or serverless applications can help provide a plethora of benefits, including: 

  • Increased agility: Containers can be easily deployed and scaled, which gives businesses greater agility to respond to changes in demand.

  • Improved performance: Containers can be more efficient than traditional virtual machines, which can lead to improved performance.

  • Enhanced security: Moving to container-based architecture makes it easier to introduce automated DevSecOps, enable secure supply chain and image security scans.

  • Reduced costs: Containers can help businesses to reduce their IT costs, as they can be deployed on a pay-as-you-go basis and offer efficient resource utilization compared with virtual machines.

  • Enable new technologies: By using uniform infrastructure which legacy applications run as containers makes it easier to extend existing applications to new technologies ‘born in cloud’ like AI/ML and Analytics that can be natively integrated in a container based environment.

  • Benefit from modern operations: Having existing applications run in containers can help businesses benefit from declarative infrastructure, automated CI/CD which reduce operations cost of existing applications. 

Modernization rewards require an investment, but the ROI is worth it

There are a number of different ways to modernize legacy applications. One option is to rewrite the application from scratch. However, this can be a time-consuming and expensive process. A more cost-effective option is to modernize the application using a modern technology stack. This can be done by using a cloud-based platform, such as Google Cloud containerization platform, such as Google Kubernetes Engine, or a serverless platform like Google Cloud Run.

Enterprises run existing workloads which are essential part of their core business and play key roles in business processes which are either revenue contributing or supporting revenue generating activities. When enterprises create transformation cloud programs, they must decide how to handle existing applications. Due to effort and cost related with code rewrite, enterprises look for alternative approaches such as refactoring applications to run in containers. The approach offered by Migrate to Containers will reuse software binaries running on middleware frameworks like Windows IIS, Tomcat, IBM WebSphere or JBoss, and transform them to run on top of the image container of the framework. By transforming the application binary the application layer remains unchanged. The underlying services which are used by the application and provided by the framework and OS layers, are now provided through the Kubernetes ecosystem. 

Here, you’re modernizing the runtime and compute host, not the code or architecture itself.

https://storage.googleapis.com/gweb-cloudblog-publish/images/Drawing_1_-_M2C_Dev_Tools_Diagram-01.max-2100x2100.jpg
Example of Tomcat application refactoring diagram

Where does refactoring make the most sense? 

The promise of modernizing containers sounds appealing to IT Architects and CIOs, but is it a viable path for software built using the frameworks mentioned here? The answer to this question depends on the software architecture and its design, which sometimes is not known to the modernization practitioners tasked with containerizing heritage software. Limitations on containerization can come, for example, from code which includes access to other resources using IP addresses coded in the application, or logic which includes information about the physical deployment of the software. For this reason, the technical assessment plays a critical role in eliminating risks of modernization by inspecting the existing software architecture and indicating potential obstacles.Google Cloud offers multiple assessment options including our Fit Assessment Tool (mFit) - which inspects inspects the software binaries, configuration files and services running on the candidate applications and provides you with detailed technical fit analysis for containerization. In some cases, there is the need to go one step further and apply code scanning methods which require access to the software code, and use tools like the one offered by Google Cloud partners such as CAST or vFunction.

Can you make your modernization to containers simpler?

Containerization is a process of packaging an application component and its dependencies into a single unit that can be easily deployed and managed. This makes it much easier to move applications between different environments, and it can also improve performance and security. We are introducing a new tool called Migrate to Containers CLI that allows you to modernize existing software to containers running on GKE, GKE Autopilot, Cloud Run or Anthos clusters. The Migrate to Containers CLI is based on the existing Migrate to Containers, and introduces containerization functionality using a standalone, easy to operate CLI tool that can help you containerize legacy applications. The new command-line tool automates the process of converting your applications to containers. The CLI tool can be used to containerize a wide variety of software based on frameworks such as Tomcat, WebSphere, Apache, JBoss and WordPress. Additional frameworks are in the works, like Windows IIS applications and Linux-based software modernization to containers running on Linux system containers. 

How to modernize existing software with Migrate to Container’s new CLI

To containerize legacy applications, you typically follow these steps: Assess, Copy, Analyze, Generate and Deploy.

https://storage.googleapis.com/gweb-cloudblog-publish/images/Drawing_2_-_M2C_CLI_Flow_go_m2ccli-blog-ar.max-1400x1400.jpg

In this example we are going to follow modernization of Tomcat application binaries from the source machine to Google Kubernetes Engine using tools installed on the developer local machine as illustrated in the diagram below.

https://storage.googleapis.com/gweb-cloudblog-publish/images/Drawing_4_Architecture_diagram_refactor_To.max-1600x1600.jpg
Diagram of Tomcat modernization flow

1. Download and install Google modernization tools binaries of mFit and M2C CLI to your local environment 

To download and install mFit run the following command:

Loading...

To download and install M2C CLI run the following command:

Loading...

2. Assess application - By running the fit assessment of your existing application use the command below to perform discovery on the source machine. The tool will run collection scripts on the assessed machine while it runs, no need to stop any running processes on the assessed machine. To learn more about the collection through SSH see here

Loading...

Then generate an HTML report.

Loading...

Finally, view the technical fit report by opening the generated HTML file in your local machine browser .

https://storage.googleapis.com/gweb-cloudblog-publish/images/Drawing_3_-_Fit_assessment_of_application_.max-1500x1500.jpg

3. Copy the application folders to your local machine from the source machine by running the following command.

Loading...

4. Analyze the application files by running the following command using the parameters relevant to your application.

Loading...

In this example we used the command for the Tomcat application containerization. At this stage you can edit the generated migration file YAML files to configure parameters like the server name, ports to expose, deployment files to use, or sensitive data that you want to remove from the generated container image. 

5. Generate the required artifacts as container image, artifacts.yaml and skaffold.yaml files by running the following command:

Loading...

6. Deploy the generated artifacts on your target cluster using the generated Skaffold configuration file. You can build and deploy to your GKE cluster with a single command. Select an image repository that can host your images and is available from the target cluster. Then, in the generated artifacts directory, run the following command:

Loading...

You can now use kubectl port-forward to test access to your deployed Tomcat application component. See kubectl documentation for more information.

For more information on how to modernize application using Migrate to Containers CLI, see the technical documentation

Posted in