Docker APP & APM
The MegaEase Cloud platform can host users' servers, support rapid deployment and management of common software service and cloud-native applications, and allow users to obtain a low-cost, high-availability cloud-native platform that is not locked by the platform.
This document introduces the basic operations of the MegaEase Cloud platform, including the Docker APP & APM.
Docker App Deployment
Deploy Docker
Note: Docker is a dependency service of Docker APP, if the machine already has Docker installed, you can ignore it.
Left navigation bar -> Services -> Create Service, click the button to select Docker to start creating.

Fill in the information.
- Name: Name of the service (can be default)
- Node count: the number of machines to be installed (default)
- Select Hosts: Select the machines to be installed (required)
- Directory: Data installation, configuration, storage directory (default)
- Tags: Tags (default)
Finally click Create to deploy

Deploy Docker App
Left navigation bar -> Apps -> Create App, click the button to select Docker compose to start creating.

Upload files.
- Upload
docker-compose.yml(required) - Upload the configuration file, the path to the configuration file and the reference to volumes in
docker-compose.ymlmust match. Note: This item is not required and can be ignored if it is not available. The configuration file should be a file that can be edited on the front end, you can't upload some big binary file, and uploading it won't work.

Fill in the information.
- Zone.Domain.Name: Name of the service (can be default)
- Select Hosts: Select the machine to be installed (required)
- Directory: Data installation, configuration, storage directory (can be default)
- Tags: Tags (default)
Click Create to deploy

Examplesļ¼
- Javaļ¼https://hub.docker.com/r/megaease/java-apm-user-list-mysql-example (opens in a new tab)
- Goļ¼https://hub.docker.com/r/megaease/go-apm-use-admin-redis-example (opens in a new tab)
- PHPļ¼https://hub.docker.com/r/megaease/php-apm-user-list-frontend-example (opens in a new tab)
Docker APM
To fill out the configuration, click on the switch for APM Agents and select the type of APM monitoring you want to monitor.

Java Agent
Select APM Agents --> Java.
Deployment example (use the way point link to see): https://hub.docker.com/r/megaease/java-apm-user-list-mysql-example (opens in a new tab)
Access service: curl http://ip:port/user/list
Add the startup parameter JAVA_OPTS
When playing the Docker image, the java startup parameter must be added with the environment variable JAVA_OPTS, such as
java ${JAVA_OPTS} -jar ./java-user-list-1.0.0.jarConfiguration details: (Default is fine)
Click JAVA to view and modify the detailed configuration

Modify Configuration & Configuration Documentation

Access document (opens in a new tab): Java monitoring access for Docker APP, you need to add the environment variable $JAVA_OPTS to the startup parameters when building the image in Dockerfile, e.g.
java ${JAVA_OPTS} -jar ./java-user-list-1.0.0.jar
After the app is successfully published and the data is generated by accessing the service, click See Your Data to view the data of the current application
Go APM SDK
Select APM Agents --> Go.
Deployment use case (click the link to see how to use it): https://hub.docker.com/r/megaease/go-apm-use-admin-redis-example (opens in a new tab)
Access to services: curl http://ip:port/is_root\?name\=admin
SDK access.
According to the document access SDK: left navigation bar -> Documents -> Go -> How to Use Go SDK (opens in a new tab)

Configuration details: (Default is fine)
Click Go to view and modify the detailed configuration

Modify Configuration & Configuration Documentation

Access documentation: Go SDK needs to be accessed in the code, in order to facilitate viewing access, access documentation is also placed here
After the app is successfully published and the data is generated by accessing the service, click See Your Data to view the current app data
PHP APM SDK
Select APM Agents --> PHP.
Deployment use case (use way click the link to see): https://hub.docker.com/r/megaease/php-apm-user-list-frontend-example (opens in a new tab)
Access service: http://ip:port/ (opens in a new tab)
Access the SDK according to the documentation: left navigation bar -> Documents -> PHP -> How to Use PHP SDK (opens in a new tab)

Configuration details: (Default is fine)
Click PHP to view and modify the detailed configuration

Modify Configuration & Configuration Documentation

Access documentation: PHP SDK needs to be accessed in the code, in order to facilitate viewing access, access documentation is also placed here
After the app is successfully published and the data is generated by accessing the service, click See Your Data to view the current app data
.NET APM SDK
Select APM Agents --> .NET.
Deployment use case (use way click the link to see): https://hub.docker.com/repository/docker/megaease/net-apm-manager-example (opens in a new tab)
Access service: http://ip:port/user?name="addName"
Access the SDK according to the documentation: left navigation bar -> Documents -> .NET -> How to Use .NET SDK (opens in a new tab)

Configuration details: (Default is fine)
Click .NET to view and modify the detailed configuration

Modify Configuration & Configuration Documentation

Access documentation: .NET SDK needs to be accessed in the code, in order to facilitate viewing access, access documentation is also placed here
After the app is successfully published and the data is generated by accessing the service, click See Your Data to view the current app data
APM Diagram
Two ways to navigate to Tracing data.
- Side navigation bar -> Trace Records -> Service Instances Select filter to see only PHP applications: demo/php/demo.php.user_list_frontend
- Left navigation bar -> Apps -> Application Details -> Configuration -> APM Agents Detail -> Click See Your Data

View Topology
Side navigation bar -> Topology -> Service Instances Select filter to see only related applications: demo/php/demo.php.user_list_frontend

Docker App CI/CD
MegaEase offers a robust CI/CD (continuous integration and continuous delivery) solution that automatically builds and deploys Docker apps when code is updated.
Open Image Registry
To use MegaEase CI/CD, you must first open the image registry provided by MegaEase Cloud.
To do this, navigate to Settings -> Registry -> Open Image Registry and click the button to open the image registry.

After opening the registry, you can view the registry's address, username, and password.

Once an image is pushed to the registry, you can view and manage the image on the registry page.

Add Github Action script
MegaEase provides Github Action scripts that automate continuous integration tasks, such as building an image and pushing it to the registry opened in the previous step.
To add the script file to your project's .github/workflow directory, use the following script file:
- megaease_ci_workflow.yml
name: MegaEase Cloud CI Workflow
on:
push:
branches:
- main
- master
jobs:
megaease_cloud_ci_job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ vars.megaease_registry_url }}/${{ vars.megaease_ci_image_name }}
tags: |
type=sha
${{ vars.megaease_ci_image_tag }}
- name: Login to the registry
uses: docker/login-action@v2
with:
registry: ${{ vars.megaease_registry_url }}
username: ${{ vars.megaease_registry_username }}
password: ${{ secrets.megaease_registry_password }}
- name: Build and push image
uses: docker/build-push-action@v3
with:
context: .
file: ${{ vars.megaease_ci_dockerfile_path}}
push: true
tags: ${{ steps.meta.outputs.tags }}
To use this workflow, you must add the variables and secrets used for workflow operation to Github's project settings.
Github Action variables
-
megaease_registry_url: The address of your MegaEase image registry, such as
registry.megaease.cn/demo. -
megaease_registry_username: Your MegaEase image registry username.
-
megaease_ci_dockerfile_path: The file path of
Dockerfile. Github Action will use this file path to build the image. -
megaease_ci_image_name: The name of the image built by Github Action.
-
megaease_ci_image_tag: The tag of the image built by Github Action. Please ensure that the tag is consistent with the tag in the deployed Docker app. It is advisable to set a stable tag, such as
latest.
Examples are as follows:

Github Action secrets
- megaease_registry_password: Your MegaEase image registry password.
Examples are as follows:

After configuration, you can enable CI/CD when deploying Docker APP.
Ā
Execute Github Action
When the code is pushed to the Github repository, Github Action will be triggered to execute the image build and push.

After the image push succeeds, the continuous deployment event will be triggered to automatically deploy the Docker app.

