Azure continuous deployment issue when using Node.js and Github - node.js

Azure allows you to deploy from source code located in Github. I've been able to create my first Node app in Visual Studio but when trying to set up continuous deployment (meaning that whenever I push changes to the github repository, it automatically publishes to my azure website), I won't update. My azure portal shows that commits have been made and updates the deployments, but the website won't show the actual changes. What do I need to do to make this work?

Related

Disable automatic deploy on push on Azure Repo

I'm using Azure DevOps repository for a .NET Core web API and it happens that when I push the code into the repository, the application is immediately published to an Azure App Service. Since I'm using Azure Pipelines to execute some checks before publishing it, I need to disable this automatic deployment done by the push operation, but I didn't figure out how to do it. Is there a way to do it?
By accessing the Kudu service at xxxxxxxxxxxxxx.scm.azurewebsites.net I noticed that there's a folder under site/deployments/tool that contains two files:
- deploy.cmd
- deploymentCacheKey
If I manually remove them, they're automatically recreated once a push is done and the unwanted deployment operation happens.
I have other repositories that have the same folder but it's empty and when I push it remains empty and no unwanted deployment operation is done.
Do you have any suggestion about how to disable this behavior?
Edit
Added screenshots of continuous deployment trigger in the Release pipeline and the release history
Continuous deployment triggers
Release history
You can check if the Continuous deployment trigger is disabled in the lightning icon of Artifacts , as shown below.

Azure App Service Kudu Continuous Deployment stopped working, not even showing latest commits

Two weeks ago I created 2 App Services, one is a Function App and the other is a PHP website... after having them created, I went to Deployment Center and configured this option to pull the code from an Azure GIT Repo and build & deploy the code using Kudu, everything was working as expected, whenever I made a code change and pushed it, Kudu was taking the latest commit, building and deploying the latest version...
Yesterday it stopped getting the latest commits from the Repo and by the time I tried to re-configure the setup to see if that helps it won't event display the commits anymore.
Here some screenshots showing the Web App and it's continuous deployment setup mapped to the Azure GIT Repo:
WebApp Continuous Deployment Setup
Azure Repo
Does anyone have faced this issue before? What could be potentially causing this situation? Could any quota limit be causing it?
NOTE: I have a Pay-as-you-go subscription.

Best workflow to restart app service after a git push

Short version: How can I deploy a new version without first manually stopping the app-service?
Long version:
I'm using the following workflow to publish a new version of my ASP.NET Core app to an Azure App-Service.
The App-Service is running on a basic instance. I understand this is not intended for real use but I hope there is a good way to get this workflow running before we go into production(standard instance).
This works but how can I avoid step 4 to 7?
Publish the solution into a local folder.
Move the published content into a local git repo.
Commit all files and push to the app-service.
Stop the app-service from the portal
Enter the console and delete all files in the wwwroot folder
Redeploy the commit from the portal
Start the app-service
I was hoping that the push in step 3 would automatically trigger the remaining steps.
After step 3 I can see that the files have been updated, the new static files are served to the browser but the old binary is still running.
Similarly I can switch between deployment slots on the portal. I get the new static files served but the previous deployed binary is still answering all calls.
This doesn't work, the static files are changed but the old binary is still responding to calls.
Redeploy from portal
Restart app-service
The old binary is still served.
This works.
Stop app-service
Deploy from portal
Start app-service
It appears the running binary is blocking the deployment.
How can I automate deployment using git push or from the portal without manually having to stop the service?
Application settings:
You need to enable msdeploy flag MSDEPLOY_RENAME_LOCKED_FILES=1 in Azure App Service application settings. The option if set enables msdeploy to rename locked files that are locked during app deployment
Click application settings and scroll down until you see app settings.
set this key: MSDEPLOY_RENAME_LOCKED_FILES and for its value put 1
How can I deploy a new version without first manually stopping the app-service?
When I develop my .Net Core Web application via VS, I would leverage the publish wizard, check the option Remove additional files at destination and use the App offline support by setting EnableMSDeployAppOffline to true under the publish profile for publishing my application to Azure Web App.
Based on your current deployment workflow, I assume that you are using the Continuous Deployment to your Azure App Service with your local Git Repository. After I changed the source code, then commit the changes to the local repository, then push the source code to my web app remote repository, the source code would be built and copied to D:\home\site\wwwroot on Azure side. Details you could follow Local Git Deployment to Azure App Service.
For your step 1 to 3, I just push the code changes from the local repository to my app service remote repository. Azure would generate the deployment script for you to build your source code project and move the built content to D:\home\site\wwwroot. Moreover, you could Custom Deployment Script for your additional requirement.

How to deploy to azure app service from VSTS?

I have nodejs app. Can I deploy it to azure app service without VS or other big IDE?
So, I want an easy way to select branch what I need push it to azure and run default command for nodejs.
I'm stuck with it, because all of solution it is use VS.
You can deploy to azure app service by using Azure App Service Deployment step/task. For example:
Create a build definition
Add related step/task to build your project
Add Azure App Service Deployment step/task (Can publish using Web Deploy or upload files directly)
Select Triggers tab and enable Continuous Integration
Specify repository and branch filters
After that, the build will be triggered if you push changes to target branch.
Related article: Define a continuous integration build for your Node.js app
Regarding run command for nodejs, you can refer to this thread by using kudu API: Include node modules in azure deployment via VSTS.
This can be done. Take a look at the build and release functionality in Visual Studio Team Services.
With VSTS Build, you can trigger a build and push to an Azure Web App automatically on a Git check-in for a particular branch, or you can manually trigger the build and push.
Take a look at the Azure App Service Deploy task in VSTS build.
Note that since VSTS is pulling from your Git repo, it doesn't matter what IDE you use to actually develop your app with.
Also, VSTS is free for small teams and a single deployment pipeline.

How do I deploy an Azure Website while using GitHub as source control?

I want to create a website and use GitHub for source control. How can I have Azure websites point to my GitHub account and pull the code from there?
Azure App Service supports continuous deployment to Web Apps from source code control and repository tools like BitBucket, CodePlex, Dropbox, Git, GitHub, Mercurial, and TFS. You can use these tools to maintain the content and code for your application, and then quickly and easily push changes to your Azure web app when you want.
There are a several steps to make this happen:
Create an empty website on Azure.
Push your web code from your local Git repository to one on GitHub.
From with in the Azure portal, click on your newly created website, followed by Deployments -> Set up continuous deployment.
At the next screen, you'll be prompted to select your source. Select GitHub.
You'll be prompted to enter your credentials.
Select the repository you'd like to monitor, and if possible, the branch.
In a few moments Azure will pull the code from your GitHub repository, and you'll be good to go!
You are not limited to GitHub, though. You can also deploy from BitBucket, CodePlex, Dropbox, GitHub, or Mercurial results in a continuous deployment process where Azure will pull in the most recent updates from your project, nearly instantly.

Resources