Thursday, December 5, 2024
No menu items!
HomeCloud ComputingDevelopers, embrace application modernization with Migrate to Container's new CLI

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

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.

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 CASTor 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.

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.

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:

code_block[StructValue([(u’code’, u’curl -O “https://mfit-release.storage.googleapis.com/$(curl -s https://mfit-release.storage.googleapis.com/latest)/mfit”rnchmod +x ./mfit’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c654f4210>)])]

To download and install M2C CLI run the following command:

code_block[StructValue([(u’code’, u’curl -O “https://m2c-cli-release.storage.googleapis.com/$(curl -s https://m2c-cli-release.storage.googleapis.com/latest)/linux/amd64/m2c”rnrnchmod +x ./m2c’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c74f5de10>)])]

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

code_block[StructValue([(u’code’, u’./mfit discover ssh source_machine’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c656773d0>)])]

Then generate an HTML report.

code_block[StructValue([(u’code’, u’./mfit report –format html –full > report.html’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c75478e90>)])]

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

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

code_block[StructValue([(u’code’, u’./m2c copy ssh myuser@source_machine -i <path/to/private/key> -o <output/tar/path>’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c763f0e90>)])]

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

code_block[StructValue([(u’code’, u’./m2c analyze -s <output/tar/path> -p tomcat-container -o <output/path> -r catalina-home=<path/to/catalina/home> rn-r catalina-base=<path/to/catalina/base>’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c763f0890>)])]

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:

code_block[StructValue([(u’code’, u’./m2c generate -i <analysis/path> -o <output/path>’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c7515cbd0>)])]

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:

code_block[StructValue([(u’code’, u’skaffold run -d <image-repository>’), (u’language’, u”), (u’caption’, <wagtail.wagtailcore.rich_text.RichText object at 0x3e0c7515c390>)])]

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

Cloud BlogRead More

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments