Deploy NodeJS Application To Azure App Service Using GitHub Actions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome back to integration ninjas in today's tutorial we are going to dive into the world of devopment and explore how to deploy a nodejs application to aure app service using the GitHub actions it will be built with the express this process is incredibly powerful allowing you to automate the deployment of your applications with very ease whether you are a season developer or just getting started understanding how to deployer not just application is a crucial skill a your app service provides a scalable and managed platform for hosting your web applications and gab actions allows you to set up a streamline cic dissolution in this video we will cover the setting up how you can set up aure app service and how you can create a GitHub action workflow and how you can deploy this noj with express application with Az web apps deoy action provided by aure so by end of this tutorial you will have a clear understanding of how to set up a robust deployment pipeline for a nodejs application on a your app service making the deployment process smoother and more efficient if you find this video helpful don't forget to like subscribe and hit the Bell icon to stay updated with our latest tutorials now let's dive into the exciting world of deine not just application on as service using GitHub actions what we are going to do is we are going to create a giup example we will have a noj example where we will set up a workflow file and we'll set up the nodejs environment and we'll build the dependencies and we'll start deploying the project with the help of action provided by kup that is web apps deploy so this is straightforward like I'm not complicating the workflow so for ease like I will create single build and we do do that you can create a multiple build that's on your choice let's do this like how you can do this I have this project here like our Evergreen node Jo app project and here I have this plune AB service deployment so this is nothing just a few of the apas are there like uh this will return return this get all user will return return this data uh this first name last name so this is a very St forward simple application it is at server. Json and the mo data is present here and the server. Json is nothing but just running this application and created some endpoints so this is very easy like endpoint I'm not going through the board as everyone knows this and let's create a app service on aure how you can do is first you need to set up a uh Resource Group let's do that let's create a resource Group first okay we'll select the subscription as free Trail and Resource Group we will select as integration ninjas group okay and just review and create this okay validation passed okay let's go to the previous and see okay not here yeah here so it's nothing but like holds all the resources like whatever the a provides us all the resources it holds all those resources so whatever a app service will create it will be part of this resource room let's create this create all right so this is created now let's go to the AER back and go to app service and let's create the web application and here now we need to we can see this integration nem so we're going to select this Resource Group so this will be part of our Resource Group like uh you can see like it's collection of resources that share the same life cycle permission and the policies so now let's name our web app something like integration ninjas you can name it anything let's see if it is available this is available very good and now let's see like what stack I I am going to select node okay node 18 LDS is there I'm going to select this and I will select the OSS Linux one and region is fine I don't want to change I am going to select this plan uh fre tier one that is more than sufficient for this example okay now let's review and create this it can take couple of minutes so we are going to like start writing the workflow file till this completes so let's create this initializing the deployment Tate deployment to Resource Group so submitting the deployment template for Resource Group so this will be completed okay you can see the deployment is in progress still this time let's go to the ID and start writing the workflow file which is the main key part here under the do gab we you will create a do GitHub workflows and we'll create a new file inside this which will have cicd do yml all right now we'll name this as apply to a app service and let's close this and when this should trigger we are going to trigger it on our current Branch so my current Branch name is uh what is my current Branch name this is app service deployment okay so this will trigger on this particular event now we'll Define the jobs here so that here we are going to define the job here I will just make this job as build and deploy okay so here where this job should run it should run on the uh runner you can create your own Runner where you should have the uh like node and everything installed you can use that you can create your machine as a runner and you can directly use that but for this video I'm going to use kuantu LS which is get up Runner okay so once this is done we are going to write few steps in our workflow which is nothing just uh first of all we will check out the source and we are going to use action SL checkout which we are familiar that this action is being used to checking out the source code and once this is completed we are going to set up the nodejs environment setup node.js version in the machine the machine we are using ubu latest here we need to install some noj if you have already configured in your machine you can skip this but in this machine I don't think we have so we are going to use this so I'm going to use one of the actions provided by tiub that is setup node okay and yeah first let's see like what the section is so we can see if you don't know just click it on Google action setup node GitHub we can see this action is provided by Kido we are going to use this particular action you can see like these are the latest version we can use this latest version and we can we just need to provide this no version here okay so let's do this node version for and we need to provide this input here what is the input here no dot version no do version we are going to Define as 18. x uh because we have selected there as 18 version now what we are going to do is we are going to install the dependencies in our project install dependencies and now we will be running a simple command only like npm install so nothing else we will just build if you have some other project like rect or other thing you can build this project as well here and you can upload that package but I don't think and necessary if we create another job here like we need to upload all this source code because we don't have any index or jar so that's why like I'm creating it in a single job so otherwise it will take a lot of time to upload and download the artifact I'm not going to do that so let's just still now deploy to aure s to aure app service and here we are going to use actions provided by Azure which is aure web apps deploy we are going to use this particular action so this is one of the documentation like this is the web apps deploy to deploy to aure apps what we need to do is like we need to provide particular inputs and we'll be able to upload this it accepts like app name what is the application name we have and the published profile how we'll get the published profile it's a good thing so let's go to our app service and select the particular or app name and we will download this published profile and we'll store this list profile in the GitHub secret variables so how we do that we need to go to the settings or repository settings and go to the secrets and variables and we'll go to the actions tab and here we'll create a secret I have already created this so I will just uh update this you don't know how to create this just click on new repository secret and select test and some domain data here and the secret will be created right the away deposit secret added and we can just access it in our code like dollar secret start so we'll see that how we can do that so we are going to use this action uses this and app this okay and I uses this and we need to provide the app name which is nothing first let's copy this secret variable and we'll paste this secrets. this and we need to provide the application name which is nothing but integration ninjas all right so we are done with this and this will deploy our code to the integration injust no we need to provide the path also here which is missing we need to provide the package information which should be the do the current Source directory this will be deployed to the and it will start on the ad Port there as on code code is running on the ad8 port yeah obviously okay so we'll see one thing we'll open the loocks here and we'll open on the long streams and we'll deploy this it takes little time and yeah let's do this let scrip commit this changes we will open the terminal and we'll see get status and and don't and then deploy this uh we'll name it as deploy to as your app service if there would be any we'll just look that and will try to rectify that okay we have already pushed this changes and we you can monitor this slogs here and we'll see like if the action is getting triggered or not okay this action is getting triggered so this is our action and few of the processes are planning here checking out the source setup node version install dependencies and this deployed to azard app service right so the deployment is in progress also we can monitor the logs also here these are the live logs which is coming there no we'll keep baiting like a few of the it takes like couple of minutes and after that the deployment is completed it also takes like time some time to reflect here the data right now it will be there have been no data so I don't know whether this URL is not this is not correct we don't have any URL yet so if you see here like there is something like the few of the logs are coming okay you see the deployment is in progress and the app service vation URL is this but it will take little time like uh it takes like couple of minutes to reflect the exact things there we'll wait for that okay okay so so we'll call our API which is uh okay it is deployed now we'll try to call this API so if you see the result is coming so we have successfully deployed our noj application to aure app service this is very easy and straightforward way we can you can create multiple jobs as well you just need to upload the artifact and download it so it's based on your requirement so if you like my video please like it share it subscribe it and share it amongst your friends thank you have a quick day
Info
Channel: Integration Ninjas
Views: 2,131
Rating: undefined out of 5
Keywords: microsoft, microsoft azure, azure cloud, aws cloud, google cloud, cicd setup, cicd integration, nodejs, rest api development, graphql api development, nodejs express api, cloud deployment guide, azure tutorial, deployment guide, cicd with github, github runners, github workflows, github pages, github copilot, gitlab ci, gitlab pipeline, jenkins ci, jenkins cicd setup, github vs jenkins, bitbucket pipeline, azure actions, azure container registry, azure resource group
Id: h987jU2X0MA
Channel Id: undefined
Length: 16min 5sec (965 seconds)
Published: Fri Dec 22 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.