Skip to main content

Command Palette

Search for a command to run...

Deploying a Node JS App to Azure App Service using Azure Dev-ops (Part 2)

Published
3 min read
Deploying a Node JS App to Azure App Service using Azure Dev-ops (Part 2)

Creating and configuring release pipeline for Node JS app in the azure DevOps release pipeline

This is the second article of a two part tutorial, if you haven't read the first part you can find it here.

Release pipelines in Azure Dev-Ops pipeline help your team continuously deliver software to your customers at a faster pace and with lower risk. You can integrate automated test scenarios and delivery modules. You can have multiple releaspipelines for multiple build pipelines in case you have different builds like dev, staging, and prod and you want to release them to three different env. In this example, we will not be going through test scenarios but rather only a simple release pipeline to deploy your latest code once a build is completed.

Step 5: Creating Release pipeline

The first step to create a release pipeline is to open the Releases tab and click on the new pipeline option upon which you will be prompted with a template selection menu for your release type. Choose Deploy a Node.js app to Azure App Service.

Creating a release pipeline.

Adding a new stage.

Step 6: Adding an Artifact

Click on add an artifact and choose the default source type ( build). Your current project will be selected automatically. Choose the source build (pipeline) for this pipeline. Here you will see all the build pipelines that you had previously created. Add the artifact once you have selected the build.

Adding an artifact.

Step 5: Enabling CD

After adding the artifact click on the lightning icon on the card to enable Continuous deployment trigger. This will create a new release every time a new release has been completed. You can also set filters for build branches but leave it as it is if you don’t have a need for it.

Adding an artifact and set up continuous deployment

Step 7: Release Tasks

Now click on the tasks tab to edit your release tasks. Here select your azure subscription ( if it’s not already selected). Now choose the same app type that you created in Azure portal ( in part 1) and your app service names will be populated automatically in the last dropdown. Make sure that you select the same app service where you want your release to be deployed.

Selecting the app service resource.

Step 8: Release settings

In this step, you have to mention the path of the release folder that has to be pushed to your app service, node version and node commands to start the server once it deployed.
First, click on the deploy azure app service task under the agent and edit the package or folder field. The default path is $(System.DefaultWorkingDirectory)/<*build pipiline name*>/drop/<*zip folder name*>.

Release tasks

The build pipeline name will be the pipeline name that you see on the left side when you open build pipelines section, preceded by an underscore.

The zip folder name will be same as the archive file name that you have entered in Archive task. Refer screenshot 2.6 in Part 1.

Now in the File Transforms & Variable Substitution Options field you have to make sure that the command to start your node JS server is correct. Since our app service type is windows, in this case, we will be using an IIS command -Handler iisnode -NodeStartFile index.js -appType node.

Here index.js is the entry point of your Node JS application, replace this with your entry point file name if it is different.

Editing server start commands and application settings,

The last step is to make sure that the Default node version matches the Node version that you specified while creating the azure app service. This can be checked under Application and Configuration Settings section.

That’s it, test your CI-CD process by just pushing something to your git repo and just wait for a minute until your changes are deployed.

4 views