Deploying Applications to EDAS with Cloud Toolkit Maven Plug-in

For EDAS developers, if you are using a WAR or JAR package to deploy an application, you can use the Cloud Toolkit Maven plug-in to deploy applications to Alibaba Cloud EDAS.

Step 1: Add the Maven Dependency

In the pom.xml file of the project, add the following<build> dependency.

<build>
<plugins>
<plugin>
<groupId>com.alibaba.cloud</groupId>
<artifactId>toolkit-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
</plugins>
</build>

Step 2: Configure the Yaml File

Create an. edas_config.yaml file under the root directory of the project. If the packaged project is a Maven submodule, create the file in the submodule directory. The file contains the following content:

env:
region_id: cn-beijing
app:
app_id: eb20dc8a-0000-567-1234-5f6a54550453

Step 3: Associate with an EDAS Account

Create an account file and configure Access Key ID and Access Key Secret in yaml format. To view Access Key ID and Access Key Secret, log on to the Alibaba Cloud user information management system. The following provides a configuration example:

access_key_id: 123456
access_key_secret: 7891011

Step 4: Complete the Deployment

Go to the root directory (or the submodule directory if multiple Maven modules are used) and run this packaging command:

mvn package toolkit:deploy --proudct=edas -Daccess_key_file= {Account file path}

More Configuration Items

Configuration items for deploying applications are classified as follows:

  • Application configuration (app)
  • Storage configuration (oss)

Configuration Example 1: Specify the Group and the Deployment Package Version

For example, an application whose ID is eb20dc8a-e6ee-4f6d-a36f-5f6a54550453 is deployed in Beijing. The group ID is 06923bb9–8c5f-4508–94d8–517b692f30b9, and the deployment package version is 1.2. In this case, the configuration is as follows:

env:
region_id: cn-beijing
app:
app_id: eb20dc8a-e6ee-4f6d-a36f-5f6a54550453
package_version: 1.2
group_id: 06923bb9-8c5f-4508-94d8-517b692f30b9

Configuration Example 2: Specify an OSS Storage Space

For example, we want to deploy the application whose ID is eb20dc8a-e6ee-4f6d-a36f-5f6a54550453 and upload the deployment package to our own bucket named release-pkg in Beijing. The file object name is my.war, the OSS account ID is ABC, and the OSS account key is 1234567890. In this case, the configuration is as follows:

env:
region_id: cn-beijing
app:
app_id: eb20dc8a-e6ee-4f6d-a36f-5f6a54550453
oss:
region_id: cn-beijing
bucket: release-pkg
key: my.war
access_key_id: ABC
access_key_secret: 1234567890

Specify a Configuration File

  • If no configuration file is specified, this plug-in uses the .edas_config.yaml file in the root directory of the packaged project as the configuration file. If the packaged project is a submodule of the Maven project, the configuration file is under the root directory of the submodule by default, but not under the root directory of the entire Maven project.
  • You can also specify a configuration file by setting the -Dedas_config=xxx parameter.
  • If the default configuration file exists while another configuration file is specified, the plug-in uses the latter.

Description of Account Configurations and Priorities

When deploying an application with this plug-in, you must provide an Alibaba Cloud Access Key for application deployment. Currently, the plug-in supports multiple configuration methods. If duplicate configuration methods are present, the configuration method with a higher priority overrides that with a lower priority. Configuration methods in descending order of priority:

  • If you package the project by running Maven commands, specify both parameters with -Daccess_key_id=xx -Daccess_key_secret=xx.
  • When configuring this plug-in in the pom file, configure the AK and SK parameters as follows:
<plugin>
<groupId>com.aliyun</groupId>
<artifactId>edas-maven-plugin</artifactId>
<version>2.30.0</version>
<configuration>
<accessKeyId>abc</accessKeyId>
<accessKeySecret>1234567890</accessKeySecret>
</configuration>
</plugin>
access_key_id: abc
access_key_secret: 1234567890
  • aliyuncli: If you have used the latest aliyuncli tool and configured your Alibaba Cloud account, Alibaba Cloud generates the .aliyuncli sub-directory under the current Home directory and creates the credentials file in the .aliyuncli sub-directory to store your account information. Here, we use the Mac system as an example and assume the system user is "jack", so the following information is stored in the /Users/jack/.aliyuncli/credentials file:
[default]
aliyun_access_key_secret = 1234567890
aliyun_access_key_id = abc
{
"current": "",
"profiles": [{
"name": "default",
"mode": "AK",
"access_key_id": "",
"access_key_secret": "",
"sts_token": "",
"ram_role_name": "",
"ram_role_arn": "",
"ram_session_name": "",
"private_key": "",
"key_pair_name": "",
"expired_seconds": 0,
"verified": "",
"region_id": "",
"output_format": "json",
"language": "en",
"site": "",
"retry_timeout": 0,
"retry_count": 0
}, {
"name": "",
"mode": "AK",
"access_key_id": "abc",
"access_key_secret": "xxx",
"sts_token": "",
"ram_role_name": "",
"ram_role_arn": "",
"ram_session_name": "",
"private_key": "",
"key_pair_name": "",
"expired_seconds": 0,
"verified": "",
"region_id": "cn-hangzhou",
"output_format": "json",
"language": "en",
"site": "",
"retry_timeout": 0,
"retry_count": 0
}],
"meta_path": ""
}

Original Source

https://www.alibabacloud.com/blog/deploying-applications-to-edas-with-cloud-toolkit-maven-plug-in_594983?spm=a2c41.13104529.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store