AMC Tech Tips: Project portability in Enterprise 6.0

by Micro Focus Employee in Application Modernization & Connectivity

Introduction: Docker Support In Visual Studio IDE for Enterprise Server projects

In our last post, we discussed some of the support added into the Visual Studio IDE for working with Docker when using native COBOL projects. This time we will cover some of the specifics for working with Enterprise Server projects in conjunction with Docker; including deploying code to a containerised Enterprise Server from the IDE to debug. We will be building upon the content from the previous post, so it is worth reading that first.

Containerising ES (Enterprise Server) Projects

Enterprise Server projects are designed to deploy programs to a server running under an instance of ES. Typically, a developer would have an instance of ES running on their local machine to test against. There is usually a server set up in ES that is associated with the project in the IDE. This is then used to deploy and debug the application being developed. With the new containerisation support, the ES instance will instead be running inside a container instead of directly on the host machine. This isolates the execution environment from the development environment, giving the developer greater confidence that their code will perform correctly in production. Additionally, if the application is containerised in production, it is possible to test against the same environment locally.

Adding Docker support

Adding Docker support in a ES project is as simple as clicking the Add -> COBOL Docker Support button on the project node in Solution Explorer. When adding Docker support to a ES project, the developer will be prompted for a few items. This includes defining a server that should be started inside the containerised environment. There are two options for supplying a server definition.

  1. Create from associated server
    • If the project is already associated with a local ES server, then a server definition can be exported from it. This definition can then be used to create instance within the container.
  2. Create new server from a server definition file
    • Specify a name and the file location of the server definition

edsnipblog.JPG

 

After the server definition has been provided and a number of items will be added to the ES project.

  1. Dockerfile
    • This defines how the Docker image should be built. It retains the same structure as mentioned in the previous post with a base, build and final layers
  2. Folder containing PowerShell script and server definition file
    • The PowerShell script gets invoked when the container starts. This setups ES and creates the server within the container. It also deploys any ES packages that are present
  3. Docker debug launch profile
    • Profile for debugging within a container. Provides a means of configuring the debug launch settings.

Launching and Debugging a Container

 

Docker Debug Profile

When launching to debug inside a container, the developer needs to ensure that the Docker debug profile is active. This profile gets added when the Docker support is added, and is selectable in the launch profile dropdown in the top toolbar. To configure the launch settings, open the Debug page within the project properties. If the values are left blank, default values will be used.

 

DebugProfile.PNG

 

What happens on launch

The steps to debugging a containerised ES project are similar to those of a containerised console project. For ES projects, the steps are as follows:

  1. Build project locally
  2. Build base layer of image from Dockerfile
  3. Start container from new image and run the DeployAndWait.ps PowerShell script inside the container. We also volume mount the output directory to a location in the container. By default, this is C:\app.
  4. PowerShell script starts up ES, creates the server from the included definition and deploys any services in the output directory.
  5. Debugger in the IDE attaches to ES instance running inside the container

Server Explorer

Once a developer has triggered a Docker debug session, the Server Explorer tool window will automatically show a node for the ES instance. This node will be labelled with an IP address, this is the address of the ES instance within the container. Servers hosted by the ES instance will show up as sub nodes and can be interacted with as usual.

Visual Studio Container Tool Window

Visual Studio 2019 has a built in Containers tool window. It is possible to view and manage containers/images directly within the IDE.

Afterword

This covers some of the specifics for enabling Docker support for Enterprise Server projects. In it we covered how to add container support to ES projects and how debugging works. I hope this has been useful and further information on the 6.0 release can be found in our docs.

Don't forget to attend the launch webinar to find out more:

curated_article_image20200604-8054-1tqigsq.png

Tags:

Labels:

Mainframe
Enterprise Developer
Enterprise Analyzer
Anonymous