Continuous Deployment of Docker Image in Azure Devops | Azure App service docker logs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends my name is Vinita and you are watching Azure day of Series in this session we are going to see that how we can deploy the docker image to Azure app Service as a release pipeline let me repeat you as a release pipeline from the release pipeline earlier what we have seen we have deployed it from the build from build pipeline itself right let me show you this diagram here what we have done we were doing the deployment and build part basically uh we were creating the image we were publish into the Azure content registry and then we were deploying it to the app service itself from the build pipeline but now uh what we will do we will create a release pipeline basically one more pipeline that will be different from the build Pipeline and then we will trigger that once we will have the artifact or we will have the image ready that we will be need to push it right and the diagram of that is here this is the diagram what we will do we will uh we will build basically we will create the image that will deploy to the content registry now uh we will have the artifact and then once we will have the artifact we will trigger the release pipeline and once this particle is pipeline will get triggered with the help of service connection we will deploy to app service other than this we will also see that how we can debug or in the sense how we can know that which version of image we are going to deploy we will see it by the log files we will see that how many ways we can access the log files right we can know okay what is happening we have deployed it now we will know that what is happening with our image how it is getting deployed which version of or which tag right which tag has been deployed to app service this is all we are going to see so let's start before starting let me just request you to subscribe my channel and if you like this video please like thank you let's start okay so uh this is my code which is available publicly available and I will provide this link as well in the description section and you can refer this code you can follow this code you can download it and you can use this code as for your reference right so this is the hello world application which is in Python and I am using Docker there and you can use it other than this we have this uh uh app service that I have already created even Docker Dev right and I have already published this particular image and how I have published it you can refer my previous video also you can refer this video as well in which we will just segregate the task okay so let me show you the Azure devops pipeline uh we will go to the pipelines here and here uh we will go to the CI uh basically this is we have two section where the pipelines as well as the leases from the pipelines only we do the build or I can say we will create the image from the code from the docker file and we will publish it to The Container registry ah let me show you what we had done till yet so uh we were building the image we were pushing it and then we will uh and then we were deploying it right so now what we will do we will disable this task let me disable this task so that once we will run this pipeline this will not deploy this will just publish it okay so let me disable this task as well as this task uh okay and let me rename this ding ding ding ding ding ding c i dot EML okay uh Docker demo CI Dot EML okay and now let me save it okay uh let me show you what we have deployed we have deployed this as a 2.0.10 so let me just update this code uh update this version for reference so that we will know that okay this is the correct version that we had deployed so what I will do I will go to the server.pi file and I am going to change something here this just for the reference so that we will be easily know okay now the new tag has been deployed right so let me edit this this is all I'm doing in main branch and let me save it this will directly commit into the main branch okay so now this is done what I will do now uh I will build it so let me tell you that this will just build it and this will publish okay and we also need to create a release for the reference but let me first show you that what exactly is doing uh okay let me just run it now I'm using the main branch and running it okay till the time this is running let me just browse container registry even ACR is a registry name and what we will do we will go to repositories this is the repositories and here the last tag that was published as 65 and here now build ID 66 so our tag will be 66. here so image has been created now it is pushing it okay so push done if we will click here we will see that okay the image name is Docker hello world flask main hyphen 66 66 okay so let me refresh it so now you can see our tag name is Branch name hyphen 66 right main hyphen 66. so now what we will do we will uh go to the release so till now we have just built it we have not deployed it because I have already shown you I have disabled those tasks so now what I will do I will go to the releases and here I need to create a release okay so basically I will click on new and new release pipeline basically this is how this release pipeline works this release pipeline as I told you this is separate from the relay pipeline section from the build Pipeline and here this will get triggered whenever we have new artifact or something new we need to trigger it we can either manually run it or we can trigger it for example if we had just created an image from here let me show you from here we have just created an image and we have posted and then automatically the release pipeline should run okay so how we will do it we will do it basically either by publishing the some artifact or via triggering as we have some new image inside the content registry right but what we will do in my demonstration I will show it via the artifact itself because that's a simple and easy step and we can easily know that which particular image we are going to push or publish to our app service we will do it with the help of build ID itself right so what we will do here when we will do the cell we need to select a template right I have just started it and here we need to select a template let me select Azure app service deployment ah still that means stage what I can do I can give the name as depth so here I will deploy it to the Dev app service right so this is done now as a Next Step what I need to do I need to add the artifact I will click here once I as I as I will click here I will have the options but at the source type right so here we have the different Source type we can either build or we have these Source type right when we are going to trigger it we can trigger it as well as Azure content registry as well whenever we have new image right so but what I will do I will simply do it with the help of build build artifact I have clicked here and now I need to select the source source as this is my source Docker demo ci.tml file right I will select it now let me show you one thing here it is stating that no version is available for Docker demo ci.aml or the latest version has no artifact what we have done till yet let me show you from here from the pipeline section we have just published it basically we have posted sorry we have pushed an image but we need to publish some artifact so that whenever a new artifact will be there this particular pipeline will get triggered right so what I need to do here I need to add up one more task that is uh publish publish artifact right and that task is publish build artifact I will select it now what are the artifact basically artifact you can see any document or any file or anything that you are going to place somewhere right so what we are going to do I am going to place a file because here we don't have dll in generally without without a Docker project what we do we generally build it and we build the dll and once we have the dll what we do we published all the dlls that we have created via compilation to this particular location with the help of this particular task but here we don't have any artifact we have already published it to Azure content registry so what we will do we need to select one artifact okay so I what I will do I will simply select this Docker file you can choose any one but either for reference because this is nothing is going to hamper if I will select this file as a ah as artifact and now this is the folder basically uh we will have the folder named drop and inside that we will have a file as Docker file right okay uh let me save and queue it now okay till the time this is happening let me show you the previous log of this particular pipeline so before this at the six minute ago I have run this so let me show you uh here if you will see that here you have the options to know that is there any artifact which has been published here we are getting that one consumed there is nothing that it has produced right but here the in the in our new uh pipeline or in our new updates what it will do it will also produce one artifact and then we will be able to know from here itself that okay I have produced some artifact and once that artifact will be there we will trigger this pipeline okay so this has been done and here you can see that we are getting the one population one consumed but in our previous one we were just getting one consumed okay so if I will click on the one published and I will see a drop folder here and if I will click here I will know that okay what I have published here I have published this Docker file right and if I'll click here this will get downloaded but I am not going to use that file this for just folder triggering part okay so here now let's come back to the release One release section uh Let me refresh this so that you will this we will not get no uh this message because now we have produced some artifact okay I am refreshing this page reload okay now uh Azure app service deployment as a template stages tab okay now add an artifact build artifact I will choose the build pipeline itself now you will get the you have the different message now you are getting the default version that you want to use is the latest right and here we have the message that the latest version of this particular build pipeline will be used so what we will do basically when this will run this will download the artifact that has been published via the build Pipeline and we will use that we generally use that in case of dll but here we are not going to use that we are just used for the triggering part and now we will go to the uh contain registry to push it let me show you okay now I am clicking on ADD and this is the trigger section if you want to have triggering automatically once we have the artifact what we need to do we need to enable it okay and if you want to further filter artifact with respect to any brand you can do from here I'm not going to do that now I am just simply going to use the any artifact which will be produced via build pipeline okay so here now what I will do I will simply okay now I need to choose the job here uh the template we have chosen as a deploy Azure app service but what we need to deploy it actually we need to deploy the uh Azure container let me search for Azure container a Azure web app for Content this task we need to use right so I will select this and I will remove this deploy Azure app service so I am going to use Azure web app for container deploy here we need to choose your subscription subscription we can choose anyone service connection manual automatic if you are looking to have that how exactly we can create we can create service connection please refer to my previous video I will also provide the link in description section I am going to choose this as a manual app name now we need to choose that we on which particular app service you want to deploy because I have shown you with respect to Dev so I'm going to choose this now uh here I need to choose the image name so what exactly the image name I'm going to choose okay so what I will do I will go to the pipeline section itself and I will prefer my previous uh build pipeline here that I have added it sorry not go to the ml1 I will go to the classic one I have already created the ml example in my previous video if you want to refer please refer that I will also provide the link right uh so I was talking about classic one so this is the classic one uh okay my bad I have given the different name I need to I don't need to give the yaml because this is not a yaml one this is the classic one right let me rename this please excuse me for this classic right save uh okay so now what I will do I will have the I will going to show you what exactly the image name we have provided here so we have provided the image name as even ACR dot Azure is azure uh CR dot IO slash image hyphen repository name and Branch name hyphen build ID because in this manner we have pushed it to the content registry right if you will go to the position image and you will find here that this time is name that we are going to push and in the same way we are deploying it so the same image name we need to use it Ctrl C right and here image name is I have pasted now we are done and let me save it and okay let me rename this as well so [Music] demo docker CD save okay okay uh so now we have the two ways to know that how exactly this working the one way we can manually trigger it by the crit release another way this will automatically get triggered once we will have the iot effect produced via the this particular pipeline okay so first example let me show you as a create release I have selected this particular release I am going to create release and I will select as a tab and then I'm going to the latest basically it is showing the last version of this particular sourceless let me create it let's see what will happen uh so let me go here and let me click on deploy deploy division progress you will see that this is showing as a ci.tml right so this is just a reference name that it has taken once we were creating it so now it is going to deploy it on the depth section till the time it is doing let me show you from here itself that I was going to show you a a um okay the version was 2 0 10 right and let me show you now the app service and here it is I'm showing you both side by side and if I will go to the logs ding ding ding ding ding ding here we have the log stream I will click here and this will show the latest log that what is happening right and now it is downloading the artifact once basically what it is doing let me click on the logs it is simply going to start so it will push the image or it will refer the image to this app service once this will refer it we will have the logs here as well that this is the new version I am going to use and in the same time we will have the different version that we have updated in our code right this still showing two zero ten okay uh so let me show you one more thing here the thing here is this is showing some error that it is showing that error in retrieving the artifact so what is the mistake we have done we have mistake is basically we have renamed the our artifact right so that's why this is not referring it so let me just uh cancel it yes and let me just go to it and basically this is a learning or you can say something new that you will know as a lie practical right let me edit it once again here let me add the artifact or I'm going to delete this previous artifact first delete add what I will do I will uh choose the this particular name right earlier because we have renamed it so that's why it was showing the error now I will choose this as a refer I will click on ADD now this is ready let me trigger it enable this now I am doing the same right now I am saving it okay now I'm running it once again uh this is just saving now I'll click on create release select on Tab latest artifact has selected as a classic let me create the list two has been created not deployed click on deploy this is because we seems we don't have any artifact let me uh go to the pipeline once again let me run it once again run pipeline now this will produce the artifact right and then this will get triggered till the time it is happening let's see what is going on in the logs right here we saw some error failed on this particular time so this was the showing of previous version but anyway okay we had the link here let me click on deploy I was missing something here so uh now there are two things happening this is the one that I have manually deployed and this is the one in which image is going getting building right so because this is in progress but two things cannot happen at the same time because uh I am using the free version right so at a particular time only one can run so this is happening this running it now this is done now this will start release is getting started in some time it has started right let me show you from the one more tab that what is happening here you will see that now we have the three releases one I have canceled it second one I have just run it and you will see that there is a one more that is third one release three and this has been automatically triggered once we've created the artifact once we created the build right and once this will get completed this will automatically run so now these things are in queue just try to learn this what is happening here okay so so so so so so so okay uh uh this is our release section that is going on and here you can refer this the tag name is main hyphen 67 right 67 is coming because we have belly two times so the it is picking the last one okay this is done now let me show you the logs of azure app Service First you okay now you can see that this has automatically updated and you can know that okay the latest version that has been deployed as main 67 I'm not doing anything this was just open in front of the log stream right and we saw that okay this is downloading the new version and is pushing it right now let me go to this here and let me just refresh it okay we have the new version got it so in this way we saw that how we can deploy it by the release section till the time uh okay now let me show you from here itself once again from the azure devops the laser section so we just saw there were three leases one two three now three is going to be happen automatically I have not done anything right and this time we will have the 68 let's see what was our build ID click on logs and yeah main hyphen 68 right this is done now let me just go here and in some time this will automatically refresh here as well right so we will have the uh uh image as Docker hello flask Main 68. ok uh sometime it may take some time to ref to refresh here okay let me show you one more thing here till the time is happening that how we can know that how we can know the logs because sometime it may happen this is the uh that we are not getting the latest logs from here right what we can do we have the one more option to check it let me show how we can do that what we will do we will click on the advanced tools right and here inside the advanced tools what we will do we will click on go and to know the deployment status here you can see that this is the we have a different link here we have the deployment with the app settings right so what I will do I will simply click on the bash you can also click from the deployment as well right if you click on the deployment here you will get the complete log right and inside the complete log you will know that uh at what time which uh basically what had happened what was the what was when it was last deployed so you can know everything from here so so so so so what I will do in the top you can find the build ID 68 right 68 I was referring so that has been deployed because this is a Json format if you want to know that how many deployment has been done here what you will do simply click on F12 once you will click on f2l you will have the dev tool open here you will click on the you already have the network and what you will do you will refresh your page this page and as a reference you will get the link here itself right sometime you may find that you are not getting this content here so what you need to do you need to click on all now click on the deployments and here this complete Json file will get passed you can know that uh you are getting last and deployment right so the upper and the first one is the top one if you will click here and you will find the complete log so this is just parsing it right this passing it in a good way here you are just uh you are not easily there for it but here you can know so here you can know okay the last one was 68 right release ID was 68. so you can easily know okay this one was last deployed and uh this is what I was referring here okay now it has automatically updated let's see what was the last latest version okay it is still showing the main 67 itself right so sometime it may take some time to reflect the changes here so that's why to know that what is the latest version that we had deployed you can refer it here as well right and this is one of the deployment section we were talking about the logging debugging in the starting right so what we will do let me show you one more thing here important thing here we will click on the bash inside the pledge now we are on the home section what we will do we will CD uh sorry if we will do LS this is the complete uh command prompt right and now you have entered into the app service you can know okay what is there what is the log file what is the exact scenario you can do most of the tasks with respect to logging right so here you have a folder of logs you have the folder of data so I was talking about the log so let me jump to log files LS here you can know that okay we have the two files uh these two logs we have available you can refer this is a it has created as per the dates so what I will do I will copy this and I will cat it paste enter so now you will get the complete log right so from here we can know that which image which with tag is configured to the app service so here you can see that the latest one is with 68 right so this was the way to know uh the latest version or latest image from the logs there's a one more way to know or to check the logs let me show how we can do that what we will do we will go here and we will click on go here and now we have seen where the batch till now we have one more option from here what we will do we will click on the current Docker log and here we will have the path right so the path the file name is the same that we have just seen from here let me show you from here uh this one right to 2022 912 right and this is the complete path so instead of going with the SSH or bash what we can do we can simply copy this path right Ctrl C and we can go to the browser and press enter so now you can see the complete log here once again and if you will scroll down and then you will find the lock right so there are multiple ways to know the logs if this happens like if you are not getting the latest log here right because we saw here we were not getting the latest log sometime it happens okay so yes so if we are done with this particular demonstration that how we can create let me show you from here how we can create how we can split the deployment to the app service from the build pipeline itself right so we are done let's meet with another video in our next session uh thank you bye
Info
Channel: Avin Techno
Views: 6,492
Rating: undefined out of 5
Keywords: AzureDevopsCD, DeckerContinuosDeployment, Azure App Service Logs
Id: MdTIIIWIxoc
Channel Id: undefined
Length: 32min 3sec (1923 seconds)
Published: Tue Sep 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.