Getting Started

This section helps you quickly build and deploy an application, publish the application to a specified cluster, and test the application by using the EnOS ECP.

Scenario

An application named uic for querying personnel information in the organization has been developed. The source code of the application is stored in GitLab. You need to publish the application to the beta cluster with EnOS ECP, and then test using the application to query the personnel information.

About this Task

You will complete the container configuration for the uic application, create a pipeline for it, publish it online, and then use it to query personnel information. The steps include configuring the deployment, service, and route for the application, creating the pipeline with build, code scanning, and deployment tasks, and running the pipeline.


Based on the above, the process of publishing an application is shown in the following figure.

../../_images/app_deployment_process_e.png

Prerequisites

  • An application development project has been created in EnOS ECP. - An application named uic has been created, and the application code is stored in the GitLab repository.

  • You are a member of the application development project and have development permission for the uic application. For more information about role and permission, see Managing Projects and Applications.

Step 1: Configure Deployment

In this step, create an application deployment for the uic application and complete the detailed resource configuration.

  1. Log in to the EnOS Management Console and select Enterprise Container Platform in the left navigation menu.

  2. Select your organization from the Organization menu.

  3. Select the created project from the Project menu.

  4. Select Container > Deployments from the left navigation.

  5. Click New Deployment, select Config mode, and provide the following deployment configuration information:

    • Application Name: uic

    • Environment: beta

    • Cluster: beta-k8s-cn4

    • Replicas: 1

    • CPU Limit: 0.8

    • Memory Limit: 0.5

    • Readiness Probe: + Add

    • Timeout: 120

    • Period: 2

    • Retry Times: 3

    • Initial Delay: 20

    • Handler: tcpSocket; TCP Port: 8080

    • Minimum Ready Seconds: 30s

    • Description: Deployment configuration for application uic in beta environment


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

    ../../_images/deployment1_2.png

Step 2: Configure Config Map and Update the Deployment

In this step, create the Config Map configuration for the uic application and update the deployment configuration created in Step 1.

  1. Select Container > Config Maps.

  2. Click New Config Map and enter the following information.

    • Name: uic-configmap

    • Application: uic

    • Environment: beta

    • Cluster: beta-k8s-cn4

    • Data (Manually Enter): Key - application.properties; Value - the content of the application.properties file

    • Description: Config Map for application uic in beta environment


  3. Click the OK button to save the config map configuration.

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

  5. Fill in the details of the Config Map in the deployment configuration as shown below.

    ../../_images/update_config_map_e.png

Step 3: Configure Service and Route

In this step, create the service and route for the uic application so that it can open the Web services to those outside the cluster.

  1. Select Container > Services.

  2. Click the New Service button and enter the following information.

    • Application: uic

    • Environment: beta

    • Cluster: beta-k8s-cn4

    • Type: ClusterIp

    • Port: 8080, 8080, TCP

    • Description: Service configuration for application uic in beta environment

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

    ../../_images/service_e.png


  4. At the Enterprise Container Platform section, select Container > Routes.

  5. Click the New Route button and enter the following information.

    • Application: uic

    • Environment: beta

    • Cluster: beta-k8s-cn4

    • Host: uic

    • Route: /api/user

    • Service: uic-service-dev

    • Port: 8080

    • Description: Route configuration for application uic in beta environment


  6. Click the OK button to complete the route configuration.

    ../../_images/route_e.png

Step 4: Create a Pipeline

In this step, create the pipeline for the uic application. A pipeline consists of the basic information, stages, and jobs.

Configure the Basic Information

  1. Select Development > Pipeline.

  2. Click the New Pipeline button and enter the following basic information.

    • Application Name: uic

    • Pipeline Name: uic-pipeline-dev

    • Language/Version: java_1.8.0

    • Tool: maven_3.3.9

    • Triggering Mode: Manual

    ../../_images/pipeline_basic_e.png

Configure the Stages

  1. Select the BUILD stage, and enter the following information.

    • Job Name: Build

    • Docker File Path: Dockerfile

    • Docker Registry: harbor.eniot.io

      ../../_images/task_build.png


  2. Select the SCAN stage, and enter the following information.

    • Job Name: Sonar Scan

    • Source Code: src/main/java

      ../../_images/task_code_scan.png

    Note

    For a detailed description for build and code scan rules, see Creating Pipelines.


  3. Select the DEPLOY stage, and enter the following information.

    • Environment: beta

    • Job Name: Deployment

    • Cluster: beta-k8s-cn4

    • Resource Type: Deployment

    • Resource Name: uic-deployment-dev

      ../../_images/task_deployment.png


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

Step 5: Run the Pipeline and View the Results

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

  2. Click the Run button, select the GitLab branch, and click Run.

    ../../_images/run_pipeline_e.png
  3. View the running results of the pipeline.

    • Click Build to view the running results of the build job, including the build log and the image address.

      ../../_images/build_result.png


    • Click Scan to view the results of the code scanning job, including the scanning log and scanning result address.

      ../../_images/scan_result.png


    • Click Deploy to view the results of the deployment job.

      ../../_images/deploy_result.png

Step 6: Test the Published Application

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