Building Blue/Green application deployment to Micro Focus Enterprise Server

海外精选
海外精选的内容汇集了全球优质的亚马逊云科技相关技术内容。同时,内容中提到的“AWS” 是 “Amazon Web Services” 的缩写,在此网站不作为商标展示。
0
0
{"value":"Organizations running mainframe production workloads often follow the traditional approach of application deployment. To release new features of existing applications into production, the application is redeployed using the new version of software on the existing infrastructure. This poses the following challenges:\n\n - The cutover of the application deployment from testing to production usually takes place during a planned outage window with associated downtime.\n - Rollback is difficult, since the earlier version of the software must be redeployed from scratch on the existing infrastructure. This may result in applications being unavailable for longer durations owing to the rollback.\n - Due to differences in testing and production environments, some defects may leak into production, affecting the application code quality and thus increasing the number of production outages\n\nAutomated, robust application deployment is recognized as a prime driver for moving from a Mainframe to AWS, as service stability, security, and quality can be better managed. In this post, you will learn how to build Blue/Green (zero-downtime) deployments for mainframe applications rehosted to Micro Focus Enterprise Server with AWS Developer Tools ([AWS CodeBuild](https://aws.amazon.com/codebuild/), CodePipeline, and CodeDeploy).\n\nThis is a continuation of our previous post “[Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite](https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/)”. In our last post, we explained how you can implement a pattern for continuous integration and testing of mainframe applications with AWS Developer tools and Micro Focus Enterprise Suite. If you haven’t already checked it out, then we strongly recommend that you read through it before proceeding to the rest of this post.\n\n#### **Overview of solution**\n\nIn this section, we explain the three important design “ingredients” to be implemented in the overall solution:\n\n 1. Implementation of Enterprise Server Performance and Availability Cluster (PAC)\n 2. End-to-end design of CI/CD pipeline for multiple teams development\n 3. Blue/green deployment process for a rehosted mainframe application\n\nFirst, let’s look at the solution design for the Micro Focus Enterprise Server PAC cluster.\n\n##### **Overview of Micro Focus Enterprise Server Performance and Availability Cluster (PAC)**\n\nIn the Blue/Green deployment solution, Micro Focus Enterprise Server is the hosting environment for mainframe applications with the software installed into [Amazon EC2 ](https://aws.amazon.com/cn/ec2/?trk=cndc-detail)instances. Application deployment in [Amazon EC2 Auto Scaling ](https://aws.amazon.com/cn/ec2/autoscaling/?trk=cndc-detail)is one of the critical requirements to build a Blue/Green deployment. Micro Focus Enterprise Server PAC technology is the feature that allows for the Auto Scaling of Enterprise Server instances. For details on how to build Micro Focus Enterprise PAC Cluster with [Amazon EC2 Auto Scaling ](https://aws.amazon.com/cn/ec2/autoscaling/?trk=cndc-detail)and Systems Manager, see our [AWS Prescriptive Guidance](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/build-a-micro-focus-enterprise-server-pac-with-amazon-ec2-auto-scaling-and-systems-manager.html) document. An overview of the infrastructure architecture is shown in the following figure, and the following table explains the components in the architecture.\n\n![image.png](https://dev-media.amazoncloud.cn/9664c5c06bb84046a370352f6bb5e13c_image.png)\n\n![image.png](https://dev-media.amazoncloud.cn/3d42aea58d04443d914ea2496bb39314_image.png)\n\n##### **CI/CD Pipelines design supporting multi-streams of mainframe development**\n\nIn a previous DevOps post, [Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite](https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/), we introduced two levels of pipelines. The first level of pipeline is used by mainframe project teams to test project scope changes. The second level of the pipeline is used for system integration tests, where the pipeline will perform tests for all of the promoted changes from the project pipelines and perform extensive systems tests.\n\nIn this post, we are extending the two levels pipeline to add a production deployment pipeline. When system testing is complete and successful, the tested application artefacts are promoted to the production pipeline in preparation for live production release. The following figure depicts each stage of the three levels of CI/CD pipeline and the purpose of each stage.\n\n![image.png](https://dev-media.amazoncloud.cn/104fd42b9bab48a39b5d51b504c96b16_image.png)\n\nLet’s look at the artifact promotion to production pipeline in greater detail. The Systems Test Pipeline promotes the tested artifacts in binary format into an [Amazon S3](https://aws.amazon.com/cn/s3/?trk=cndc-detail) bucket and the S3 event triggers production pipeline to kick-off. This artifact promotion process can be gated using a manual approval action in CodePipeline. For customers who want to have a fully automated continuous deployment, the manual promotion approval step can be removed.\n\nThe following diagram shows the AWS Stages in [AWS CodePipeline](https://aws.amazon.com/cn/codepipeline/?trk=cndc-detail) of the production deployment pipeline:\n\n![image.png](https://dev-media.amazoncloud.cn/04f021a6ed31460f9695007522ea1f67_image.png)\n\nAfter the production pipeline is kicked off, it downloads the new version artifact from the S3 bucket. See the details of how to setup the S3 bucket as a Source of CodePipeline in the document [*AWS CodePipeline Document S3 as Source*](https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-S3.html). \n\nIn the following section, we explain each of these pipeline stages in detail:\n\n 1. It prepares and packages a new version of production configuration artifacts, for example, the Micro Focus Enterprise Server config file, blue/green deployment scripts etc.\n 2. Use in the CodeBuild Project to kick off an application blue/green deployment with [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail).\n 3. Use a manual approval gate to wait for an operator to validate the new version of the application and approve to continue the production traffic switch\n 4. Continue the blue/green deployment by allowing traffic to the new version of the application and block the traffic to the old version.\n 5. After a successful Blue/Green switch and deployment, tag the production version in the code repository.\n\nNow that you’ve seen the pipeline design, we will dive deep into the details of the blue/green deployment with [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail).\n\n##### **Blue/green deployment with [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail)**\n\nIn the blue/green deployment, we used the technique of swapping Auto Scaling Group behind an Elastic Load Balancer. Refer to the [AWS Blue/Green deployment](https://docs.aws.amazon.com/whitepapers/latest/blue-green-deployments/swap-the-auto-scaling-group-behind-elastic-load-balancer.html) whitepaper for the details of the technique. As [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) is a fully-managed service that automates software deployment, it is used to automate the entire Blue/Green process.\n\nFirstly, the following best practices are applied to setup the Enterprise Server’s infrastructure:\n\n 1. [AWS Image Builder](https://aws.amazon.com/image-builder/) is used to install Micro Focus Enterprise Server software and [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) Agent into Amazon Machine Image (AMI). Create an EC2 Launch Template with the Enterprise Server AMI ID.\n 2. A Network Load Balancer is used to setup a TCP connection health check to validate that Micro Focus Enterprise Server is listening on the required ports, e.g., port 9270, so that connectivity is available for 3270 emulators.\n 3. A script was created to confirm application deployment validity in each EC2 instance. This is achieved by using a PowerShell script that triggers a CICS transaction from the Micro Focus Enterprise Server command line interface.\n\nIn the CodePipeline, we created a CodeBuild project to create a new deployment with CodeDeploy. We will go into the details of the CodeBuild buildspec.yaml configuration.\n\nIn the CodeBuild *buildspec.yaml’s pre_build* section, we used the following steps:\n\nIn the *pre-build* stage, the CodeBuild will perform two steps:\n\n 1. Create an initial [Amazon EC2 Auto Scaling ](https://aws.amazon.com/cn/ec2/autoscaling/?trk=cndc-detail)using Micro Focus Enterprise Server AMI and a Launch Template for the first-time deployment of the application.\n 2. Use AWS CLI to update the initial Auto Scaling Group name into a Systems Manager Parameter Store, and it will later be used by CodeDeploy to create a copy during the blue/green deployment.\n\nIn the *build* stage, the buildspec will perform the following steps:\n\n 1. Retrieve the Auto Scaling Group name of the Enterprise Servers from the Systems Manager Parameter Store.\n 2. Then, a blue/green deployment configuration is created for the deployment group of the application. In the AWS CLI command, we use the WITH_TRAFFIC_CONTROL option to let us manually verify and approve before switching the traffic to the new version of the application. The command snippet is shown here.\n\n```\\nBlueGreenConf=\\\\\\n \\"terminateBlueInstancesOnDeploymentSuccess={action=TERMINATE}\\"\\\\\\n \\",deploymentReadyOption={actionOnTimeout=STOP_DEPLOYMENT,waitTimeInMinutes=600}\\" \\\\\\n \\",greenFleetProvisioningOption={action=COPY_AUTO_SCALING_GROUP}\\"\\n\\nDeployType=\\"BLUE_GREEN,deploymentOption=WITH_TRAFFIC_CONTROL\\"\\n\\n/usr/local/bin/aws deploy update-deployment-group \\\\\\n --application-name \\"\${APPLICATION_NAME}\\" \\\\\\n --current-deployment-group-name \\"\${DEPLOYMENT_GROUP_NAME}\\" \\\\\\n --auto-scaling-groups \\"\${AsgName}\\" \\\\\\n --load-balancer-info targetGroupInfoList=[{name=\\"\${TARGET_GROUP_NAME}\\"}] \\\\\\n --deployment-style \\"deploymentType=\$DeployType\\" \\\\\\n --Blue/Green-deployment-configuration \\"\$BlueGreenConf\\"\\n```\n\n 3.Next, the new version of application binary is released from the CodeBuild source *DemoBinto* the production S3 bucket.\n\n```\\nrelease=\\"bankdemo-\$(date '+%Y-%m-%d-%H-%M').tar.gz\\"\\nRELEASE_FILE=\\"s3://\${PRODUCTION_BUCKET}/\${release}\\"\\n\\n/usr/local/bin/aws deploy push \\\\\\n --application-name \${APPLICATION_NAME} \\\\\\n --description \\"version - \$(date '+%Y-%m-%d %H:%M')\\" \\\\\\n --s3-location \${RELEASE_FILE} \\\\\\n --source \${CODEBUILD_SRC_DIR_DemoBin}/\\n```\n\n 4.Create a new deployment for the application to initiate the Blue/Green switch.\n\n```\\n/usr/local/bin/aws deploy create-deployment \\\\\\n --application-name \${APPLICATION_NAME} \\\\\\n --s3-location bucket=\${PRODUCTION_BUCKET},key=\${release},bundleType=zip \\\\\\n --deployment-group-name \\"\${DEPLOYMENT_GROUP_NAME}\\" \\\\\\n --description \\"Bankdemo Production Deployment \${release}\\"\\\\\\n --query deploymentId \\\\\\n --output text\\n```\n\nAfter setting up the deployment options, the following is a snapshot of a deployment configuration from the AWS Management Console.\n\n![image.png](https://dev-media.amazoncloud.cn/40b1c9f673a6400e86d78916255cd552_image.png)\n\nIn the AWS Post [“Under the Hood: AWS CodeDeploy and Auto Scaling Integration”](https://aws.amazon.com/blogs/devops/under-the-hood-aws-codedeploy-and-auto-scaling-integration/), we explain how [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) sets up Auto Scaling lifecycle hooks to listen for Auto Scaling events. In the event of an EC2 instance launch and termination, [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) can instruct its agent in the instance to run the prepared scripts.\n\nIn the following table, we list each stage in a blue/green deployment and the tasks that ran.\n\n![image.png](https://dev-media.amazoncloud.cn/d611d12698d0448bbe2953d4f267f7cf_image.png)\n![image.png](https://dev-media.amazoncloud.cn/9679ec37d46d479abdeca5754bfd5b7c_image.png)\n\nThe tasks in the table are automated using PowerShell, and the scripts are used in appspec.yml config for CodeDeploy to orchestrate the deployment.\n\nIn the following appspec.yml, the locations of the binary files to be installed are defined in addition to the Micro Focus Enterprise Server Region XML config file. During the AfrerInstall stage, the XML config is imported into the Enterprise Server.\n\n```\\nversion: 0.0\\nos: windows\\nfiles:\\n - source: scripts\\n destination: C:\\\\scripts\\\\\\n - source: online\\n destination: C:\\\\BANKDEMO\\\\online\\\\\\n - source: common\\n destination: C:\\\\BANKDEMO\\\\common\\\\\\n - source: batch\\n destination: C:\\\\BANKDEMO\\\\batch\\\\\\n - source: scripts\\\\BANKDEMO.xml\\n destination: C:\\\\BANKDEMO\\\\\\nhooks:\\n BeforeInstall: \\n - location: scripts\\\\BeforeInstall.ps1\\n timeout: 300\\n AfterInstall: \\n - location: scripts\\\\AfterInstall.ps1 \\n ApplicationStart:\\n - location: scripts\\\\ApplicationStart.ps1\\n timeout: 300\\n ValidateService:\\n - location: scripts\\\\ValidateServer.cmd\\n timeout: 300\\n AfterBlockTraffic:\\n - location: scripts\\\\AfterBlockTraffic.ps1\\n```\n\nUsing the sample Micro Focus Bankdemo application, and the steps outlined above, we have setup a blue/green deployment process in Micro Focus Enterprise Server.\n\nThere are four important considerations when setting up blue/green deployment:\n\n 1. For batch applications, the blue/green deployment should be invoked only outside of the scheduled “batch window”.\n 2. For online applications, [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) will deregister the Auto Scaling group from the target group of the Network Load Balancer. The deregistration may take a while as the server has to finish processing the ongoing requests before it can continue deployment of the new application instance. In this case, enabling [Elastic Load Balancing](https://aws.amazon.com/cn/elasticloadbalancing/?trk=cndc-detail) connection draining feature with appropriate timeout value can minimize the risk of closing unfinished transactions. In addition, consider doing deployment in low-traffic windows to improve the deployment speeds.\n 3. For application changes that require updates to the database schema, the version roll-forward and rollback can be managed via DB migrations tools, e.g., Flyway and Fluent Migrator.\n 4. For testing in production environments, adherence to any regulatory compliance, such as full audit trail of events, must be considered.\n\n#### **Conclusion**\n\nIn this post, we introduced the solution to use Micro Focus Enterprise Server PAC, [Amazon EC2 ](https://aws.amazon.com/cn/ec2/?trk=cndc-detail)Auto Scaling, [AWS Systems Manager](https://aws.amazon.com/cn/systems-manager/?trk=cndc-detail), and [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) to automate the blue/green deployment of rehosted mainframe applications in AWS.\n\nThrough the blue/green deployment methodology, we can shift traffic between two identical clusters running different application versions in parallel. This mitigates the risks commonly associated with mainframe application deployment, namely downtime and rollback capacity, while ensure higher code quality in production through “Shift Right” testing.\n\nA demo of the solution is available on the AWS Partner Micro Focus website [[Solution-Demo](https://content.microfocus.com/en-au-devday-demo/continous-delivery-of-cobol-pl1-applications-with-blue-green-deployment?lx=aFvjAB)]. If you’re interested in modernizing your mainframe applications, then please contact [Micro Focus](http://www.cloud4mainframe.com/) and AWS mainframe business development at mainframe@amazon.com.\n\n#### **Additional Information**\n\n - [AWS Blue Green deployment whitepaper](https://docs.aws.amazon.com/whitepapers/latest/blue-green-deployments/aws-tools-and-services-enabling-bluegreen-deployments.html)\n - [AWS Prescriptive Guidance – Build a Micro Focus Enterprise Server PAC with Amazon EC2 Auto Scaling and Systems Manager](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/build-a-micro-focus-enterprise-server-pac-with-amazon-ec2-auto-scaling-and-systems-manager.html?did=pg_card&trk=pg_card)\n - [AWS Prescriptive Guidance – Mainframe modernization: DevOps on AWS with Micro Focus](https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/mainframe-modernization-devops-on-aws-with-micro-focus.html?did=pg_card&trk=pg_card)\n - [AWS DevOps Blog – Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite](https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/)\n\n##### **About the authors**\n\n![image.png](https://dev-media.amazoncloud.cn/9470b2afea904f159ba10f1bb7dd2fdc_image.png)\n\n##### **Kevin Yung**\nKevin is a Senior Modernization Architect in AWS Professional Services Global Mainframe and Midrange Modernization (GM3) team. Kevin currently is focusing on leading and delivering mainframe and midrange applications modernization for large enterprise customers.\n\n![image.png](https://dev-media.amazoncloud.cn/0f8d63bd24754282a7e8c3bfb55e2cbe_image.png)\n\n##### **Krithika Palani Selvam**\nKrithika is a Senior Modernization Architect in AWS Professional Services Global Mainframe and Midrange Modernization (GM3) team. She is currently working with enterprise customers for migrating and modernizing mainframe and midrange applications to cloud.\n\n![image.png](https://dev-media.amazoncloud.cn/e91e95e1e4ee448fb8f95bf40005f62d_image.png)\n\n##### **Peter Woods**\nPeter Woods has been with Micro Focus for over 30 years <within the Application Modernisation & Connectivity portfolio>. His diverse range of roles has included Technical Support, Channel Sales, Product Management, Strategic Alliances Management and Pre-Sales and was primarily based in the UK. In 2017 Peter re-located to Melbourne, Australia and in his current role of AM2C APJ Regional Technical Leader and ANZ Pre-Sales Manager, he is charged with driving and supporting Application Modernisation sales activity across the APJ region.\\n\\n![image.png](https://dev-media.amazoncloud.cn/ead1262f73c04ec39d7c261dff226d1b_image.png)\\n\\n##### **Abraham Mercado Rondon**\\nAbraham Rondon is a Solutions Architect working on Micro Focus Enterprise Solutions for the Application Modernization team based in Melbourne. After completing a degree in Statistics and before joining Micro Focus, Abraham had a long career in supporting Mainframe Applications in different countries doing progressive roles from Developer to Production Support, Business and Technical Analyst, and Project Team Lead. Now, a vital part of the Micro Focus Application Modernization team, one of his main focus is Cloud implementations of mainframe DevOps and production workload rehost.","render":"<p>Organizations running mainframe production workloads often follow the traditional approach of application deployment. To release new features of existing applications into production, the application is redeployed using the new version of software on the existing infrastructure. This poses the following challenges:</p>\n<ul>\\n<li>The cutover of the application deployment from testing to production usually takes place during a planned outage window with associated downtime.</li>\n<li>Rollback is difficult, since the earlier version of the software must be redeployed from scratch on the existing infrastructure. This may result in applications being unavailable for longer durations owing to the rollback.</li>\n<li>Due to differences in testing and production environments, some defects may leak into production, affecting the application code quality and thus increasing the number of production outages</li>\n</ul>\\n<p>Automated, robust application deployment is recognized as a prime driver for moving from a Mainframe to AWS, as service stability, security, and quality can be better managed. In this post, you will learn how to build Blue/Green (zero-downtime) deployments for mainframe applications rehosted to Micro Focus Enterprise Server with AWS Developer Tools (<a href=\\"https://aws.amazon.com/codebuild/\\" target=\\"_blank\\">AWS CodeBuild</a>, CodePipeline, and CodeDeploy).</p>\\n<p>This is a continuation of our previous post “<a href=\\"https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/\\" target=\\"_blank\\">Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite</a>”. In our last post, we explained how you can implement a pattern for continuous integration and testing of mainframe applications with AWS Developer tools and Micro Focus Enterprise Suite. If you haven’t already checked it out, then we strongly recommend that you read through it before proceeding to the rest of this post.</p>\\n<h4><a id=\\"Overview_of_solution_10\\"></a><strong>Overview of solution</strong></h4>\\n<p>In this section, we explain the three important design “ingredients” to be implemented in the overall solution:</p>\n<ol>\\n<li>Implementation of Enterprise Server Performance and Availability Cluster (PAC)</li>\n<li>End-to-end design of CI/CD pipeline for multiple teams development</li>\n<li>Blue/green deployment process for a rehosted mainframe application</li>\n</ol>\\n<p>First, let’s look at the solution design for the Micro Focus Enterprise Server PAC cluster.</p>\n<h5><a id=\\"Overview_of_Micro_Focus_Enterprise_Server_Performance_and_Availability_Cluster_PAC_20\\"></a><strong>Overview of Micro Focus Enterprise Server Performance and Availability Cluster (PAC)</strong></h5>\\n<p>In the Blue/Green deployment solution, Micro Focus Enterprise Server is the hosting environment for mainframe applications with the software installed into Amazon EC2 instances. Application deployment in Amazon EC2 Auto Scaling is one of the critical requirements to build a Blue/Green deployment. Micro Focus Enterprise Server PAC technology is the feature that allows for the Auto Scaling of Enterprise Server instances. For details on how to build Micro Focus Enterprise PAC Cluster with Amazon EC2 Auto Scaling and Systems Manager, see our <a href=\\"https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/build-a-micro-focus-enterprise-server-pac-with-amazon-ec2-auto-scaling-and-systems-manager.html\\" target=\\"_blank\\">AWS Prescriptive Guidance</a> document. An overview of the infrastructure architecture is shown in the following figure, and the following table explains the components in the architecture.</p>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/9664c5c06bb84046a370352f6bb5e13c_image.png\\" alt=\\"image.png\\" /></p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/3d42aea58d04443d914ea2496bb39314_image.png\\" alt=\\"image.png\\" /></p>\n<h5><a id=\\"CICD_Pipelines_design_supporting_multistreams_of_mainframe_development_28\\"></a><strong>CI/CD Pipelines design supporting multi-streams of mainframe development</strong></h5>\\n<p>In a previous DevOps post, <a href=\\"https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/\\" target=\\"_blank\\">Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite</a>, we introduced two levels of pipelines. The first level of pipeline is used by mainframe project teams to test project scope changes. The second level of the pipeline is used for system integration tests, where the pipeline will perform tests for all of the promoted changes from the project pipelines and perform extensive systems tests.</p>\\n<p>In this post, we are extending the two levels pipeline to add a production deployment pipeline. When system testing is complete and successful, the tested application artefacts are promoted to the production pipeline in preparation for live production release. The following figure depicts each stage of the three levels of CI/CD pipeline and the purpose of each stage.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/104fd42b9bab48a39b5d51b504c96b16_image.png\\" alt=\\"image.png\\" /></p>\n<p>Let’s look at the artifact promotion to production pipeline in greater detail. The Systems Test Pipeline promotes the tested artifacts in binary format into an Amazon S3 bucket and the S3 event triggers production pipeline to kick-off. This artifact promotion process can be gated using a manual approval action in CodePipeline. For customers who want to have a fully automated continuous deployment, the manual promotion approval step can be removed.</p>\n<p>The following diagram shows the AWS Stages in AWS CodePipeline of the production deployment pipeline:</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/04f021a6ed31460f9695007522ea1f67_image.png\\" alt=\\"image.png\\" /></p>\n<p>After the production pipeline is kicked off, it downloads the new version artifact from the S3 bucket. See the details of how to setup the S3 bucket as a Source of CodePipeline in the document <a href=\\"https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-S3.html\\" target=\\"_blank\\"><em>AWS CodePipeline Document S3 as Source</em></a>.</p>\n<p>In the following section, we explain each of these pipeline stages in detail:</p>\n<ol>\\n<li>It prepares and packages a new version of production configuration artifacts, for example, the Micro Focus Enterprise Server config file, blue/green deployment scripts etc.</li>\n<li>Use in the CodeBuild Project to kick off an application blue/green deployment with AWS CodeDeploy.</li>\n<li>Use a manual approval gate to wait for an operator to validate the new version of the application and approve to continue the production traffic switch</li>\n<li>Continue the blue/green deployment by allowing traffic to the new version of the application and block the traffic to the old version.</li>\n<li>After a successful Blue/Green switch and deployment, tag the production version in the code repository.</li>\n</ol>\\n<p>Now that you’ve seen the pipeline design, we will dive deep into the details of the blue/green deployment with AWS CodeDeploy.</p>\n<h5><a id=\\"Bluegreen_deployment_with_AWS_CodeDeploy_54\\"></a><strong>Blue/green deployment with AWS CodeDeploy</strong></h5>\\n<p>In the blue/green deployment, we used the technique of swapping Auto Scaling Group behind an Elastic Load Balancer. Refer to the <a href=\\"https://docs.aws.amazon.com/whitepapers/latest/blue-green-deployments/swap-the-auto-scaling-group-behind-elastic-load-balancer.html\\" target=\\"_blank\\">AWS Blue/Green deployment</a> whitepaper for the details of the technique. As [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) is a fully-managed service that automates software deployment, it is used to automate the entire Blue/Green process.</p>\\n<p>Firstly, the following best practices are applied to setup the Enterprise Server’s infrastructure:</p>\n<ol>\\n<li><a href=\\"https://aws.amazon.com/image-builder/\\" target=\\"_blank\\">AWS Image Builder</a> is used to install Micro Focus Enterprise Server software and [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) Agent into Amazon Machine Image (AMI). Create an EC2 Launch Template with the Enterprise Server AMI ID.</li>\\n<li>A Network Load Balancer is used to setup a TCP connection health check to validate that Micro Focus Enterprise Server is listening on the required ports, e.g., port 9270, so that connectivity is available for 3270 emulators.</li>\n<li>A script was created to confirm application deployment validity in each EC2 instance. This is achieved by using a PowerShell script that triggers a CICS transaction from the Micro Focus Enterprise Server command line interface.</li>\n</ol>\\n<p>In the CodePipeline, we created a CodeBuild project to create a new deployment with CodeDeploy. We will go into the details of the CodeBuild buildspec.yaml configuration.</p>\n<p>In the CodeBuild <em>buildspec.yaml’s pre_build</em> section, we used the following steps:</p>\\n<p>In the <em>pre-build</em> stage, the CodeBuild will perform two steps:</p>\\n<ol>\\n<li>Create an initial Amazon EC2 Auto Scaling using Micro Focus Enterprise Server AMI and a Launch Template for the first-time deployment of the application.</li>\n<li>Use AWS CLI to update the initial Auto Scaling Group name into a Systems Manager Parameter Store, and it will later be used by CodeDeploy to create a copy during the blue/green deployment.</li>\n</ol>\\n<p>In the <em>build</em> stage, the buildspec will perform the following steps:</p>\\n<ol>\\n<li>Retrieve the Auto Scaling Group name of the Enterprise Servers from the Systems Manager Parameter Store.</li>\n<li>Then, a blue/green deployment configuration is created for the deployment group of the application. In the AWS CLI command, we use the WITH_TRAFFIC_CONTROL option to let us manually verify and approve before switching the traffic to the new version of the application. The command snippet is shown here.</li>\n</ol>\\n<pre><code class=\\"lang-\\">BlueGreenConf=\\\\\\n &quot;terminateBlueInstancesOnDeploymentSuccess={action=TERMINATE}&quot;\\\\\\n &quot;,deploymentReadyOption={actionOnTimeout=STOP_DEPLOYMENT,waitTimeInMinutes=600}&quot; \\\\\\n &quot;,greenFleetProvisioningOption={action=COPY_AUTO_SCALING_GROUP}&quot;\\n\\nDeployType=&quot;BLUE_GREEN,deploymentOption=WITH_TRAFFIC_CONTROL&quot;\\n\\n/usr/local/bin/aws deploy update-deployment-group \\\\\\n --application-name &quot;\${APPLICATION_NAME}&quot; \\\\\\n --current-deployment-group-name &quot;\${DEPLOYMENT_GROUP_NAME}&quot; \\\\\\n --auto-scaling-groups &quot;\${AsgName}&quot; \\\\\\n --load-balancer-info targetGroupInfoList=[{name=&quot;\${TARGET_GROUP_NAME}&quot;}] \\\\\\n --deployment-style &quot;deploymentType=\$DeployType&quot; \\\\\\n --Blue/Green-deployment-configuration &quot;\$BlueGreenConf&quot;\\n</code></pre>\\n<p>3.Next, the new version of application binary is released from the CodeBuild source <em>DemoBinto</em> the production S3 bucket.</p>\\n<pre><code class=\\"lang-\\">release=&quot;bankdemo-\$(date '+%Y-%m-%d-%H-%M').tar.gz&quot;\\nRELEASE_FILE=&quot;s3://\${PRODUCTION_BUCKET}/\${release}&quot;\\n\\n/usr/local/bin/aws deploy push \\\\\\n --application-name \${APPLICATION_NAME} \\\\\\n --description &quot;version - \$(date '+%Y-%m-%d %H:%M')&quot; \\\\\\n --s3-location \${RELEASE_FILE} \\\\\\n --source \${CODEBUILD_SRC_DIR_DemoBin}/\\n</code></pre>\\n<p>4.Create a new deployment for the application to initiate the Blue/Green switch.</p>\n<pre><code class=\\"lang-\\">/usr/local/bin/aws deploy create-deployment \\\\\\n --application-name \${APPLICATION_NAME} \\\\\\n --s3-location bucket=\${PRODUCTION_BUCKET},key=\${release},bundleType=zip \\\\\\n --deployment-group-name &quot;\${DEPLOYMENT_GROUP_NAME}&quot; \\\\\\n --description &quot;Bankdemo Production Deployment \${release}&quot;\\\\\\n --query deploymentId \\\\\\n --output text\\n</code></pre>\\n<p>After setting up the deployment options, the following is a snapshot of a deployment configuration from the AWS Management Console.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/40b1c9f673a6400e86d78916255cd552_image.png\\" alt=\\"image.png\\" /></p>\n<p>In the AWS Post <a href=\\"https://aws.amazon.com/blogs/devops/under-the-hood-aws-codedeploy-and-auto-scaling-integration/\\" target=\\"_blank\\">“Under the Hood: AWS CodeDeploy and Auto Scaling Integration”</a>, we explain how [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) sets up Auto Scaling lifecycle hooks to listen for Auto Scaling events. In the event of an EC2 instance launch and termination, [AWS CodeDeploy](https://aws.amazon.com/cn/codedeploy/?trk=cndc-detail) can instruct its agent in the instance to run the prepared scripts.</p>\\n<p>In the following table, we list each stage in a blue/green deployment and the tasks that ran.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/d611d12698d0448bbe2953d4f267f7cf_image.png\\" alt=\\"image.png\\" /><br />\\n<img src=\\"https://dev-media.amazoncloud.cn/9679ec37d46d479abdeca5754bfd5b7c_image.png\\" alt=\\"image.png\\" /></p>\n<p>The tasks in the table are automated using PowerShell, and the scripts are used in appspec.yml config for CodeDeploy to orchestrate the deployment.</p>\n<p>In the following appspec.yml, the locations of the binary files to be installed are defined in addition to the Micro Focus Enterprise Server Region XML config file. During the AfrerInstall stage, the XML config is imported into the Enterprise Server.</p>\n<pre><code class=\\"lang-\\">version: 0.0\\nos: windows\\nfiles:\\n - source: scripts\\n destination: C:\\\\scripts\\\\\\n - source: online\\n destination: C:\\\\BANKDEMO\\\\online\\\\\\n - source: common\\n destination: C:\\\\BANKDEMO\\\\common\\\\\\n - source: batch\\n destination: C:\\\\BANKDEMO\\\\batch\\\\\\n - source: scripts\\\\BANKDEMO.xml\\n destination: C:\\\\BANKDEMO\\\\\\nhooks:\\n BeforeInstall: \\n - location: scripts\\\\BeforeInstall.ps1\\n timeout: 300\\n AfterInstall: \\n - location: scripts\\\\AfterInstall.ps1 \\n ApplicationStart:\\n - location: scripts\\\\ApplicationStart.ps1\\n timeout: 300\\n ValidateService:\\n - location: scripts\\\\ValidateServer.cmd\\n timeout: 300\\n AfterBlockTraffic:\\n - location: scripts\\\\AfterBlockTraffic.ps1\\n</code></pre>\\n<p>Using the sample Micro Focus Bankdemo application, and the steps outlined above, we have setup a blue/green deployment process in Micro Focus Enterprise Server.</p>\n<p>There are four important considerations when setting up blue/green deployment:</p>\n<ol>\\n<li>For batch applications, the blue/green deployment should be invoked only outside of the scheduled “batch window”.</li>\n<li>For online applications, AWS CodeDeploy will deregister the Auto Scaling group from the target group of the Network Load Balancer. The deregistration may take a while as the server has to finish processing the ongoing requests before it can continue deployment of the new application instance. In this case, enabling Elastic Load Balancing connection draining feature with appropriate timeout value can minimize the risk of closing unfinished transactions. In addition, consider doing deployment in low-traffic windows to improve the deployment speeds.</li>\n<li>For application changes that require updates to the database schema, the version roll-forward and rollback can be managed via DB migrations tools, e.g., Flyway and Fluent Migrator.</li>\n<li>For testing in production environments, adherence to any regulatory compliance, such as full audit trail of events, must be considered.</li>\n</ol>\\n<h4><a id=\\"Conclusion_174\\"></a><strong>Conclusion</strong></h4>\\n<p>In this post, we introduced the solution to use Micro Focus Enterprise Server PAC, Amazon EC2 Auto Scaling, AWS Systems Manager, and AWS CodeDeploy to automate the blue/green deployment of rehosted mainframe applications in AWS.</p>\n<p>Through the blue/green deployment methodology, we can shift traffic between two identical clusters running different application versions in parallel. This mitigates the risks commonly associated with mainframe application deployment, namely downtime and rollback capacity, while ensure higher code quality in production through “Shift Right” testing.</p>\n<p>A demo of the solution is available on the AWS Partner Micro Focus website [<a href=\\"https://content.microfocus.com/en-au-devday-demo/continous-delivery-of-cobol-pl1-applications-with-blue-green-deployment?lx=aFvjAB\\" target=\\"_blank\\">Solution-Demo</a>]. If you’re interested in modernizing your mainframe applications, then please contact <a href=\\"http://www.cloud4mainframe.com/\\" target=\\"_blank\\">Micro Focus</a> and AWS mainframe business development at mainframe@amazon.com.</p>\\n<h4><a id=\\"Additional_Information_182\\"></a><strong>Additional Information</strong></h4>\\n<ul>\\n<li><a href=\\"https://docs.aws.amazon.com/whitepapers/latest/blue-green-deployments/aws-tools-and-services-enabling-bluegreen-deployments.html\\" target=\\"_blank\\">AWS Blue Green deployment whitepaper</a></li>\\n<li><a href=\\"https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/build-a-micro-focus-enterprise-server-pac-with-amazon-ec2-auto-scaling-and-systems-manager.html?did=pg_card&amp;trk=pg_card\\" target=\\"_blank\\">AWS Prescriptive Guidance – Build a Micro Focus Enterprise Server PAC with Amazon EC2 Auto Scaling and Systems Manager</a></li>\\n<li><a href=\\"https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/mainframe-modernization-devops-on-aws-with-micro-focus.html?did=pg_card&amp;trk=pg_card\\" target=\\"_blank\\">AWS Prescriptive Guidance – Mainframe modernization: DevOps on AWS with Micro Focus</a></li>\\n<li><a href=\\"https://aws.amazon.com/blogs/devops/automate-mainframe-tests-on-aws-with-micro-focus/\\" target=\\"_blank\\">AWS DevOps Blog – Automate thousands of mainframe tests on AWS with the Micro Focus Enterprise Suite</a></li>\\n</ul>\n<h5><a id=\\"About_the_authors_189\\"></a><strong>About the authors</strong></h5>\\n<p><img src=\\"https://dev-media.amazoncloud.cn/9470b2afea904f159ba10f1bb7dd2fdc_image.png\\" alt=\\"image.png\\" /></p>\n<h5><a id=\\"Kevin_Yung_193\\"></a><strong>Kevin Yung</strong></h5>\\n<p>Kevin is a Senior Modernization Architect in AWS Professional Services Global Mainframe and Midrange Modernization (GM3) team. Kevin currently is focusing on leading and delivering mainframe and midrange applications modernization for large enterprise customers.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/0f8d63bd24754282a7e8c3bfb55e2cbe_image.png\\" alt=\\"image.png\\" /></p>\n<h5><a id=\\"Krithika_Palani_Selvam_198\\"></a><strong>Krithika Palani Selvam</strong></h5>\\n<p>Krithika is a Senior Modernization Architect in AWS Professional Services Global Mainframe and Midrange Modernization (GM3) team. She is currently working with enterprise customers for migrating and modernizing mainframe and midrange applications to cloud.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/e91e95e1e4ee448fb8f95bf40005f62d_image.png\\" alt=\\"image.png\\" /></p>\n<h5><a id=\\"Peter_Woods_203\\"></a><strong>Peter Woods</strong></h5>\\n<p>Peter Woods has been with Micro Focus for over 30 years &lt;within the Application Modernisation &amp; Connectivity portfolio&gt;. His diverse range of roles has included Technical Support, Channel Sales, Product Management, Strategic Alliances Management and Pre-Sales and was primarily based in the UK. In 2017 Peter re-located to Melbourne, Australia and in his current role of AM2C APJ Regional Technical Leader and ANZ Pre-Sales Manager, he is charged with driving and supporting Application Modernisation sales activity across the APJ region.</p>\n<p><img src=\\"https://dev-media.amazoncloud.cn/ead1262f73c04ec39d7c261dff226d1b_image.png\\" alt=\\"image.png\\" /></p>\n<h5><a id=\\"Abraham_Mercado_Rondon_208\\"></a><strong>Abraham Mercado Rondon</strong></h5>\\n<p>Abraham Rondon is a Solutions Architect working on Micro Focus Enterprise Solutions for the Application Modernization team based in Melbourne. After completing a degree in Statistics and before joining Micro Focus, Abraham had a long career in supporting Mainframe Applications in different countries doing progressive roles from Developer to Production Support, Business and Technical Analyst, and Project Team Lead. Now, a vital part of the Micro Focus Application Modernization team, one of his main focus is Cloud implementations of mainframe DevOps and production workload rehost.</p>\n"}
目录
亚马逊云科技解决方案 基于行业客户应用场景及技术领域的解决方案
联系亚马逊云科技专家
亚马逊云科技解决方案
基于行业客户应用场景及技术领域的解决方案
联系专家
0
目录
关闭