CI/CD Deployment Using Azure Devops - azure-devops

i have my springboot-rest api application. I have created Web app, CI and CD pipeline successfully.But after successful deployment if i am hitting deployed app service URL i am not able to see my application.Please find the attached screen shots for different steps. Can anyone tell me what i need to do to see my application running.
Below image link is successful deployment of CI/CD Pipeline.
https://i.stack.imgur.com/AgmME.png
Following image i am getting after hitting deployed App Service URL. If i am hitting deployment center it is showing successful deployment to App service. But i am not able to see my restful endpoint is running.
https://i.stack.imgur.com/lPXpF.png
i also tried with endpoint which i use to hit with postman and able to get output. Following is post man URL.
http://localhost:8080/vodafone/api/v1/azure/createProject?clientName=HexawareTechnologiesLtd&ticketNo=RITM0010739&location=southindia
My App Service Deployment URL is.
http://vmmigrateapp.azurewebsites.net
If i am hitting same URL with Postman using this URL i am getting 404 error.
http://vmmigrateapp.azurewebsites.net/vodafone/api/v1/azure/createProject?clientName=HexawareTechnologiesLtd&ticketNo=RITM0010739&location=southindia

App service needs JAR to be named as app.jar. Only JAR with app.jar name can be executed in azure app service. So Please add app in POM.xml file under section. This will generate JAR with name app.jar. By default it generate projectname+version as JAR name which can't be run in azure app service.After doing this project can be build and deployed using Azure CI/CD and run by app service.

Related

Azure Devops App Service Deploy Task Not Work Suddenly

I use [Azure App Service deploy] task in Azure Devops pipeline to deploy the artifact to an Azure App service.
Everything worked well before but today it not work suddenly. It failed when i tried to deploy the artifact to the production slot (the slot marked production). But when i tested to deploy to deployment slots, it worked well.
I just got an error message that has no much detail in the log
Cleaning up temp folders from previous zip deployments and extracting pushed zip file C:\local\Temp\zipdeploy\534hsvxr.zip (80.94 MB) to C:\local\Temp\zipdeploy\extracted
[error]Failed to deploy web package to App Service.
[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
Anyone got the same issue before?
Thanks
It seems to be a source control issue. Just try going to the App Service Deployment Center blade and click "Disconnect" to disconnect your deployment. And then try to deploy it again.

After Azure DevOps release pipeline of a Java web app in App Service, URL still shows the default page

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.
#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.
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

Azure Devops Release not update Azure WebApp

I did an initial deployment to an Azure WebApp on Linux via a direct publish from Visual Studio. The code just echoes out some text and the page comes up successfully. I can update the text in the code and re-publish. And the new text displays on the web.
Now I am trying to deploy it via Azure DevOps rather than a direct publish from Visual Studio. I created a rudimentary build and release pipeline in Azure DevOps.
I updated the text echoed out in the code then ran the build pipeline followed by the release pipeline. The Deployment status says that everything was successful. I went through the logs as well and there are no error messages. However, the website page text has not changed. Also restarted the App Service in Azure but the change is not reflected.
The release pipeline has one artifact which is linked to the latest build. And one stage which is "Azure App Service deployment" with the right subscription and the right App Service Name linked.
Release Pipeline
Any idea what I might be missing?
Here is the output from the deployment step -
Blockquote##[section]Starting: Deploy Azure App Service
==============================================================================
Task : Azure App Service deploy
Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
Version : 4.163.9
Author : Microsoft Corporation
Help : https://aka.ms/azureappservicetroubleshooting
==============================================================================
Got service connection details for Azure App Service:'myAppName'
Package deployment using ZIP Deploy initiated.
Deploy logs can be viewed at https://myAppName.scm.azurewebsites.net/api/deployments/xxx/log
Successfully deployed web package to App Service.
Successfully updated deployment History at https://myAppName.scm.azurewebsites.net/api/deployments/xxx
App Service Application URL: https://myAppName.azurewebsites.net
##[section]Finishing: Deploy Azure App Service
Thanks in advance, Jake.
I was able to create an empty Azure Service directly within Azure. Then pushed the code to this new Azure Service via DevOps. Now it seems to be working as expected. Only other difference is that I had created this as an App for Windows rather than App for Linux. Anyway, the update is working now.

Angular application from Azure Pipeline into App Service Directory

We have an Angular 7 application on one git repository and an ASP.NET Core 2.2 Web API on another git repository. We use Azure pipelines to deploy both repos into an Azure App Service.
I have successfully been able to configure the Web API to deploy to the root directory and the Angular client into a wwwrooot sub directory.
However, in order to achieve this I need to configure the wwwroot sub-directory as an application, which makes the application fail with HTTP 404. Once I change the settings to be "Directory" in the Azure app service, everything works as normal.
Is there a way to have the Angular pipeline deploy to the sub-directory while configured as Directory instead of Application?
Thank you,
I solved my issue from within the pipelines. Following this post (VSTS build with multiple repos) I added the FE artifacts to the pipeline and simply copy it's dist contents to the wwwroot folder of the API build folder. Then I simply deploy everything to App Services and now both the API and Angular App are deployed on the same server and working.
Hope this helps someone.

Azure Function deployed successfully, but not working

I am facing a weird problem. I deployed my code using Azure DevOps Pipeline Release - it ran successfully, however, the code is not reflecting in Azure Function App.
Here is what I am doing:
Created a Release pipeline with a "Deploy Azure App Service" task. It picks up artifacts from a build pipeline and is configured to deploy to a Function App using Service Connection
When the Release pipeline is triggered it runs through all its steps, and I get a success (see logs below)
However, when I open up Azure portal and navigate to the Function App, it continues to say "Now it is time to add your code" on the Overview tab, and I am not able to hit my API on that Function App
Surprisingly, On the Deployment Center tab of the Function App, it does show the details of the deployment (See details below)
I can also find the deployed zip file under D:\home\site\wwwroot when I log on to the Kudu console
Deployment logs:
Got service connection details for Azure App Service:'myFuncApp'
Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
Updated App Service Application settings and Kudu Application settings.
Package deployment using ZIP Deploy initiated.
Successfully deployed web package to App Service.
App Service Application URL: http://myFuncApp.azurewebsites.net
View on Function App Deployment Center Tab:
Deployed Successfully to production
Source Version 6d9c8340ba Build 20190411.1 Release: 3
The Function App endpoint is working, (throwing a generic welcome page) confirming the Function App itself is healthy, but I am not able to access my API.
Additional updates
Here is the structure of the .zip file that is being uploaded to d:\home\data\SitePackages as a part of the zip deploy from Azure Pipelines:
/host.json
/package.json
/proxies.json
/package-lock.json
/func_name/index.js
/func_name/function.json
/node_modules/**
The same code is working locally.
Note: When I go to the Deployment Center tab, I do see this error message, but I think this is related to Continuous deployment through Function App
We were unable to connect to the Azure Pipeline that is connected to this Web App. This could mean it has been removed from the Azure Dev Ops Portal. If this has happened, you can disconnect this pipeline and set up a new deployment pipeline.
Please help me. What can be going wrong?
I was finally able to troubleshoot. #4c74356b41 pointed me in the right direction as the key issue was the package.
Below was the issue:
I had added an archive step in the build pipeline. This was causing the artifact to be zipped before publish
In the release pipeline I was using Azure App Service Deploy task. This internally uses Zip Deploy where App type is set to Azure Functions. Thus, it was zipping my zipped file.
When I remove the archive step, the double zipping was avoided, and it started working.