Skip to content

Azure Spring Apps: Deploy

Jialuo Gan edited this page May 6, 2022 · 1 revision

azure-spring-apps:deploy

  • This goal triggers a deploy in Azure Spring Cloud. Before you execute deploy goal, you need to have the spring cluster created. This goal will create the app if the app doesn't exist(the default app name is the artifactId in pom.xml), upload the jar at target folder and update all the configuration in app and deployment. It will start the app if it is previously stopped. If the same jar is already deployed, only the configuration will be updated(it may not be implemented in version 1.0.0, but will be supported in later versions). This goal will quit until the deployment enters the final state: Succeeded or Failed. If the app is public and deployed successfully, this goal will print an endpoint of this app before exit.

Here is a sample configuration:

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-apps-maven-plugin</artifactId>
<version>1.10.0</version>
<configuration>
    <subscriptionId>00000000-0000-0000-0000-000000000000</subscriptionId>
    <clusterName>testCluster1</clusterName>
    <appName>helloworld</appName>
    <isPublic>true</isPublic>>
    <enablePersistentStorage>false<enablePersistentStorage>
    <deployment>
        <cpu>1</cpu>
        <memoryInGB>4</memoryInGB>
        <instanceCount>1</instanceCount>
        <runtimeVersion>Java 8</runtimeVersion>
        <jvmOptions>-XX:+UseG1GC -XX:+UseStringDeduplication</jvmOptions>
        <environment>
            <foo>bar</foo>
        </environment>
        <resources>
            <resource>
            <directory>${project.basedir}/target</directory>
            <includes>
                <include>*.jar</include>
            </includes>
            </resource>
        </resources>
    </deployment>
</configuration>

Note:
- if the ASC does not exist, this goal will fail with error messages.
- if you have not yet built the jar by package goal, this goal will fail with error messages.
- if this jar in target folder is not executable-jar , this goal will fail with error messages.
- This goal requires you to login using any way described in Authentication Methods section, if you have no configuration in <auth> section, this goal will check if you have ever logged in with “azure:login” goal, and if not, if will then check if you have ever logged in through azure cli, if not, it will execute “azure:login” goal and then continue the deploy process.

Multi-jar behavior

  • If executed in parent folder
    • Deploy all sub-modules one by one.
  • If executed in child folder
    • Only deploy that project.