0
votes

I am new to Azure DevOps. I am trying to perform small home lab projects. One of them is to deploy a "Greetings from Spring Boot!" web app in Azure Web App service with Azure DevOps pipelines, build and release.

I got the source code (Spring boot web app) from a YouTube tutorial and performed the tasks in the tutorial but using GitHub actions (Azure Portal/Home/Resources/select my App Service/Deployment Center/Settings/ configure as source a GitHub repository where my code is). This way was fine. The web page https://my-app-name-just-example.azurewebsites.net/ is showing the message in my source code, "Greetings from Spring Boot!".

But when I try to use Azure DevOps build and release pipelines on the same Azure Web App resource, accessing the URL shows the default web page "Hey, Java developers!". Both build and release pipelines show successfully completed. https://imgur.com/a/thiMfBQ

From the Azure DevOps build release I downloaded the jar file (demo-0.0.1-SNAPSHOT) and ran it locally on my PC (java -jar \path\demo-0.0.1-SNAPSHOT) and http://localhost:8080/ displays the message in my source code. This means the build pipeline was correct. When I configure and run the release pipeline using as source the build from the build pipeline, the release pipeline shows successfully completed but the web app URL still shows the the default web page "Hey, Java developers!".

I checked https://my-app-name-just-example.scm.azurewebsites.net/wwwroot/ and the demo-0.0.1-SNAPSHOT.jar is there. I stopped and started the Azure Web App too.

Any suggestions? Thank you.

2
Which platform you use, windows or linux ?Jason Pan
I use Linux as a platformYAZ84
You can try the method in my answer, I think the third link must be helpful to you.Jason Pan
If my reply is helpful, please accept it as answer(click on the mark option beside the reply to toggle it from greyed out to fill in.), see meta.stackexchange.com/questions/5234/…Jason Pan

2 Answers

0
votes

You can add startup command on portal.

Like :

java -jar /home/site/wwwroot/app.jar --server.port=80

For more details, you can reader offical doc and related post.

1. Built-in images

2. Unable to start spring boot application deployed as a jar

3. Deploy a Spring Boot Gradle application to Azure App Service from an Azure Pipeline

1
votes

@Jason Pan, Thank you very much for the solution.

I used as a solution the startup command in a new Release pipeline configuration. In my case: "java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80". I noticed the name of the artifact in my case from the Build pipeline is artifactId+version from the pom.xml file, so demo-0.0.1-SNAPSHOT.jar .

Then I edited my release pipeline with this startup command, saved it, deploy it and I could see the in the Release pipeline /Initialize job logs the message "[PARAMETERS_STARTUPCOMMAND] --> [java -jar /home/site/wwwroot/demo-0.0.1-SNAPSHOT.jar --server.port=80]" . Deployment was successful. And now Web App URL shows the content of the source code, "Greetings from Spring Boot!". Previously it was showing the default content, the "Hey, Java developers!".

Thank you again.