Publish a service
Publish your application services to the SOFAStack platform to run them in the cloud. After publishing, you can perform service management and administration operations. This topic describes how to publish a service.
Services can be published in two ways: Classic service publishing and Container service publishing.
Video tutorial
Watch this video to quickly learn how to publish a service:
Classic service publishing
For classic service publishing, package your local project into a JAR file. Then, publish it using the virtual machine build mode.
Create an application.
For more information, see Manage applications. The application must have the Service Mesh feature enabled. When you enable this feature, note the following:
The application name must be the same as the project's application name. You can find the project's application name in the
app/web/src/main/resources/config/application.propertiesfile. The following is an example:#required spring.application.name=web-appSet the application's technology stack to SOFA Boot. For more information about technology stacks, see Technology stack user guide.
Create a deployment unit.
For more information, see Deployment units.
Upload the deployment package.
Upload the JAR package generated in Preparations to the SOFAStack platform. For more information, see Manage deployment packages.
Create an application service.
For more information, see Application service instances.
The application service must have the Service Mesh feature enabled. You must also select a technology stack version that supports the Mesh feature. For more information about technology stack versions, see Technology stack guide.
Add an Elastic Compute Service (ECS) instance.
On the Application Service page, click the name of the target service instance.
Click the Elastic Compute Service tab, and then click the Add button.
Configure the ECS information, and then click Create.
For more information about the configuration items, see Add an ECS instance.
Create a release ticket.
Go to the Release Ticket page and click Create.
In the Create Release Ticket panel, configure the following parameters:
The following figure shows an example of the release ticket configuration:

Click Edit Advanced Information.
In the Deployment Parameters section, click Batch Add, and then add the following parameters:
-Dcom.alipay.instanceid=P9HPGG****** # The instance ID of the current account. -Dcom.antcloud.antvip.endpoint=cn-hangzhou-middleware-acvip-prod.cloud.alipaycs.net # The AntVIP address of the current region. -Dcom.antcloud.mw.access=LTAI*************** # The AccessKey ID of the current account. -Dcom.antcloud.mw.secret=yourAccessKeySecret # The AccessKey secret of the current account.NoteThe preceding parameter values are global configuration items for middleware. You can obtain them from the Scaffolding console. For more information, see Configuration guide.
Click OK, and then click Next.
Click Create.
Publish the application.
On the release ticket details page, click Full Release in the upper-right corner. After the application is published, you can view the published service on the Service Administration page.
Container service publishing
For container service publishing, build an image from your local project. Then, publish it using the container build mode.
Create a cluster.
For more information, see Create a cluster. The cluster must have the Service Mesh feature enabled.
Create a SOFA Boot application.
For more information, see Manage applications.
Create an application service.
For more information, see Create an application service. When you create the application service, specify a Registry Address that is accessible to the container service.
ImportantThe cluster must have the Service Mesh feature enabled.
The Registry Address must be in the same region as the service.
Modify the middleware tuple information
On the Application Service page, click the name of the target application service.
In the upper-right corner, click Edit Configuration Information.
Click Next.
In the Advanced Configuration section, click Environment Variable Configuration.
Click Add Environment Variable, and then add the following four variables:
For Variable Name, select Manual Input. The variable names and values are as follows:
Variable name
Value
com.alipay.instanceid
Enter the instance ID of the current account.
For example:
P9HPGG******com.antcloud.antvip.endpoint
Enter the AntVIP address of the current region.
For example:
100.**.**.136com.antcloud.mw.access
Enter the AccessKey ID of the current account.
For example:
LTAI****************com.antcloud.mw.secret
Enter the AccessKey secret of the current account.
For example:
yourAccessKeySecretNoteThe preceding parameter values are global configuration items for middleware. You can obtain them from the Scaffolding console. For more information, see Configuration guide.
Click Preview and Submit, and then click Submit.
Create a release ticket.
For more information, see Release Ticket. After the release ticket is successfully published, you can view the published service on the Service Administration page.