Build microservice applications based on Git repository¶
Build traditional microservice applications based on the source code of the Git registry through the application workbench, so as to manage the traffic of the application, view logs, monitor, link tracking and other functions.
Prerequisites¶
- Need to create a workspace and a user, the user needs to join the workspace and give
workspace edit
role. Refer to Creating Workspaces, Users and Roles. - Create two credentials that can access the codebase registry and the container registry, and name them respectively:
git-credential
andregistry
. For more information on creating credentials, please refer to Credential Management. - Prepare a Gitlab registry, Harbor registry
Create Credentials¶
-
Create two credentials on the Credentials page:
- git-credential: username and password for accessing the code repository
- registry-credential: username and password for accessing the container registry
-
After the creation is complete, you can see the credential information on the
Certificate List
page.
Create a microservice application based on Git¶
-
On
Application Workbench
->Wizard
page, clickBuild Based on Git Repository
. -
On the
Build Based on Git Repository
page, set the following basic information and clickNext
:- Name: Fill in the name of the application.
- Resource type: supports stateless load and stateful load. This demo chooses stateless load.
- Enter or select an application group.
- Set the deployment location, if you want to access microservices, please ensure that the current workspace
- Cluster: Select the cluster where the application needs to be deployed.
- Namespace: Select the namespace where the application needs to be deployed.
- Number of instances: Fill in the number of instances and the number of Pods.
-
After setting the pipeline construction information, click
Next
.- code repository
- codebase: Enter the Git registry address
https://gitlab.daocloud.cn/ndx/skoala.git
. Here is an example address, please use your own registry address in actual operation. - Branch: default is
main
, here ismain
, no need to change - Credentials: Select the credential
git-credential
to access the codebase, if it is a public registry, you do not need to fill in
- codebase: Enter the Git registry address
- Construct
- Dockerfile path: Enter the absolute path of the Dockerfile in the codebase, the example address here is
demo/integration/springcloud-nacos-sentinel/code/Dockerfile
- Target image name: Enter the container registry name
release-ci.daocloud.io/test-lfj/fromgit
. - Tag: Enter the container registry version
v2.0.0
- Credentials: Select the credential
registry-credential
to access the container registry
- Dockerfile path: Enter the absolute path of the Dockerfile in the codebase, the example address here is
- advanced settings
- ContextPath: ContextPath is the execution context path of the docker build command. Fill in the path relative to the root directory of the code, such as target, or the directory where the Dockerfile is located if not filled.
- Build parameters: Build parameters will be passed to the parameters of the build command in the form of --build-arg, which supports setting the upstream product download address and upstream image download address as parameters, and supports custom arbitrary parameters.
- code repository
-
After configuring the container, click
Next
.-
service configuration
- Access type: supports intra-cluster access, node access, and load balancing. Example values are as follows:
-
resource constraints
- Specify the upper limit of resources that the application can use, including CPU and memory.
-
-
On the
Advanced Configuration
page, selectEnable Microservice Access
, configure the following fields and clickOK
.- Select framework: support
Spring Cloud
,Dubbo
, here chooseSpring Cloud
. - Registry instance: currently only supports Nacos registry instance managed by the microservice engine.
- Registry namespace: nacos namespace for microservice applications
- Registry service grouping: service grouping of microservice applications
- Registry instance grouping:
- Username/Password: If the registry instance is authenticated, you need to fill in the username and password
- Enable Microservice Governance: The registry instance that needs to be selected supports enabling it, otherwise it cannot be enabled
- Observable:
- Monitoring: Select Enable, and you can view service-related monitoring information after enabling it
- Log: enabled by default
- Link tracking: After opening, you can view the link tracking information of the service, currently only supports Java language
- Select framework: support
View and access microservice related information¶
-
Click
Overview
on the left navigation bar, and in theNative App
tab, hover the cursor over an app, and clickView More Details
on the floating menu. -
Jump to the microservice engine to view service details.