Publishing Applications


This tutorial will guide you through the EnOS Enterprise Container Platform to quickly build and deploy an application, publish it to a specified cluster, and test using the application.

Scenario

Publish the application named uic to the alpha cluster via EnOS ECP and use the service to query personal information.

Description

In the application development project, complete the container configuration of the application uic, pipeline creation and publish. Create the deployment configuration, service configuration and route configuration, then create a pipeline for it, add the three tasks of build, code scan and deployment, click Run to start the pipeline, complete the above tasks, and use the service to query personal information.


Based on the above requirements, the flow of quick application publish is shown in the following diagram.


../_images/app_deployment_process.png

Prerequisites

  1. The application development project has been created in EnOS ECP and the application named uic has been created and the application code has been saved to the Git repository.

  2. The user is a member of the application development project and has the application uic development privileges. For detailed steps, refer to Managing Project and Application

Step 1:Creating deployment configuration

This step creates the deployment configuration for the application uic and completes the details of the resources needed to deploy the application.

  1. Log in to the ECP (you can contact EnOS Support for the URL) service.

  2. In the left navigation bar, select Container > Deployments.

  3. Click New Deployment and select the Create by Form method to provide the following deployment configuration.

    • Application Name: uic

    • Environment:alpha

    • Cluster:alpha-k8s-cn4

    • Replicas:1

    • CPU Request:0.1Cores;CPU Limit:0.8Cores

    • Memory Request: 0.1G;Memory Limit:0.5G

    • Readinesss Probe: Added

    • Timeout:120

    • Period:2

    • Retry Times:3

    • Initial Delay:20

    • Handler:tcpSocket;TCP Port:8080

    • Minimum Ready Seconds:30s

    • Description:Apply uic’s alpha environment deployment configuration

  4. Click the OK button to save the deployment configuration.

Step 2: Creating a configuration map and update the deployment configuration

This step creates a configuration map for the application uic and updates the existing deployment configuration information.

  1. In the left navigation bar, select Container > Config Maps

  2. Click New Config Map to provide the following configuration map information.

    • Name:Enter the Config Map name

    • Application:uic

    • Environment:alpha

    • Cluster:alpha-k8s-cn4

    • Data:Manually Enter,Key: application.properties;Value: for the contents of the application.properties file

    • Description:Apply the configuration map of uic’s alpha environment

  3. Click OK to save the configuration map information.

    ../_images/config_map.png
  4. Click on Deployments in the navigation bar, select the deployment configuration created in Step 1, and click on the Edit button.

  5. Can edit the Config Map in the deployment configuration.

Step 3: Creating Service configuration and Route configuration

This step creates the Service configuration and Route configuration for the application uic to support the uic application to expose web services to the outside of the cluster.


The Service configuration steps are as follows.

  1. In the left navigation bar, select Container > Services

  2. Click New Service to provide the following Service configuration information.

    • Application:uic

    • Environment:alpha

    • Cluster:alpha-k8s-cn4

    • Type:ClusterIP

    • Port:8080,8080,TCP

    • Description:Apply uic’s alpha environment Service configuration

  3. Click the OK button to complete the Service configuration.

    ../_images/service_config.png


The detailed steps for Route Configuration are as follows.

  1. In the left navigation bar, select Container > Routes

  2. Click New Route to provide the following Route configuration information.

    • Application:uic

    • Environment:alpha

    • Cluster:alpha-k8s-cn4

    • Host:uic

    • Route:/api/user

    • Service:uic

    • Port:8080

    • Description:Apply uic’s alpha environment Route configuration

  3. Click the OK button to complete the Route configuration.

    ../_images/route_config.png

Step 4: Creating pipeline

This step creates a pipeline for the application uic. A pipeline consists of basic information, views and tasks, and the following steps are required to create a pipeline.

Configuring Basic Information

  1. In the left navigation bar, select Development > Pipeline.

  2. Click New Pipeline to provide the following basic information.

    • App/Product: uic

    • Pipeline Name: uic-pipeline-dev

    • Language/version: java_1.8.0

    • Tools: maven_3.3.9

    • Git Repository:

    • Trigger Mode: manual trigger

    ../_images/create_pipeline1.png

Configuring Stage

  1. Select Build and provide the following information.

    • Job Name:Build

    • Docker File Path:Dockerfile

    • Docker Registry:harbor.eniot.io

      ../_images/task_build.png
  2. Select SCAN and provide the following information.

    • Job Name:Code Scan

    • Source Code:src/main/java

    Note

    For a detailed description of the build and code scan rules, refer to New Pipeline

  3. Select DEPLOY and provide the following information.

    • Environment: alpha

    • Job name: Deployment

    • Cluster: alpha-k8s-cn4

    • Resource type: Deployment

    • Resource name: uic-deployment-dev

  4. Click the New Pipeline button to save the pipeline configuration.

Step 5: Running the pipeline and viewing the results

This procedure runs the configured pipeline and views the results of the pipeline run.

  1. In the list of created pipelines, click the created pipeline uic-pipeline-dev to open the pipeline details page.

  2. Click the Run button, select the code repository branch, and click Run.

    ../_images/run_pipeline.png
  3. View the results of the pipeline run.

    • Click BUILD to view the results of the build task run, including the build log and the image address.

    • Click SCAN to view the results of the code scan task run, including the scan log and the scan result address.

    • Click DEPLOY to see the results of the deployment task

Step 6: Testing the published application

After the application is successfully deployed, test the application to ensure that the application can function properly according to the configured service information.