Simple DevOps Project 3 DevOps project with Git Jenkins and Docker on AWS CICD on containers

Show video

Hello. Everyone, welcome, back to the Lexi technologies. In. This video I am going to show you how you can deploy a web, application. On your docker. Container, I hope. You guys followed, my previous, two videos on, simple. DevOps project, one and simple, devups project, two in. Those videos we have deployed our where, application. Web application, on yeah. Anya, VM our ec2, instance, but. This time we are going to make it as a containerized. Containerized. Nothing. But we are going to use Jenkins. To get it applied onto your dock container. I can. Use ansible, instead. Of Jenkins, as a deployment, tool I'm. Just going to show that so. I can able to do something like this but due to the some complications. I have. Removed ansible as a deployment, first. I will. Deploy. Through jenkins on through. Jenkins on your, docker container, once, it is successful, on next, video i am going to make how we, are going to deploy on. Darker. Our docker, container by using ansible. So. To demonstrate, this. Particular, demo. I need, get Jenkins. And, darker. I helped, repair the sequence. Of steps what you need to follow while. Are doing, this or. Demonstration. You, can follow the same steps, let's. Go back to the steps and we'll see what we have to set up to. Proceed further. This. Is a github repository where, I have updated the set, of instructions which we, should follow to set, up the our infrastructure. For DevOps, project, 3 initially. We need to launch an ec2 instance, for. A docker host this, easy to instance is your Amazon, Linux one because. It is quite easy to install and manage darker, on Amazon, Linux system, and second. Step is install, docker on ec2 instance and start services. Soyoung. Installed, our current service docker start its just install, and start, is third. Step is we are going to create a new user for new, user for a docker management, nothing, but administration. Purpose and add, that user to the darker group whenever. You install darker, you will you are going to get the, group, good a group, get created, the, group name is darker and we, create a user the. User name I am going to give it as a docker admin and set, the password for him and add, him to the docker, crew, then. A righty of file under. /opt. Darker. I'm treating. It as a /opt. Darker as my our default. Directory under, that one I will create a file called a docker file and we'll, copy these instructions. On to the doggerel I hope, you guys know how to write a docker file if you don't know please follow, my next video, where. I am going to make how you can write your docker file, in. Easiest, way and. The, next thing is you should log in to Jenkins console, and, we. Need to add a darker, server and execute, commands, to, execute, commands, from the Jenkins, so. Now I'm. Using Jenkins, as in my deployment, a tool that's why we should give, access.

To Our Jenkins, server to, execute. Commands on our docker horse for, that purpose you should set up he were a, docker. Server under publish, over a search so that your Jenkins, server can execute, some instructions, on ever docker host then. Only the containers, will get created, if, you are using ansible, you no need to do this type of because your, ansible, will. Take care of all this job. Next. We use create, a Jenkins, job you need to follow these instructions to. Create your job that, is source code management whereever, our hello. World project is exist. This. Is the project. Which I used for my previous projects, as well but I have done little bit modifications. To this one and if you need this docker file it is already updated in the same repository you, can go and pull it and. From. Next video I mean to say darker of. Simple. Divorce project, for I am, going to use a new project for, a better. Understanding, because, we are going to introduce on our q1 makes us from there. And. It is going, to run on the master, branch next. Thing is built, we, are going to use the root palm as a palm dot XML, and goals. And options clean install, package. And. Another, one is we are going to use the. Publish. Over ACH nothing but to send files or execute commands over ssh name you, want to execute these commands anywhere. What. I can say a remote. Host for, that purpose we are using these parameters. Under. This, one you need to see the source files very. Were powerful get, created, whenever. You run till. Here it is going to create your verify, that, we are forget created, under workspace. Under. Workspace, web app target. Then. The, where file the, where file name may be anything that's why I have given a star but, in my case the where file name is web app, right. Under, remove traffic's so, I want, to copy this, wire, file onto target, system, but, I don't want to get these two parent directories, of my Garf file that's, why you can use the remote prefix. Option, where, you can remove these two parent, directories, of your file so where file alone get copied into the remote. Directory nothing, but on remotes are worried it is going to get copied /opt. Under docker that's. Why I have, created this, docker, file under. Slash Wapiti, darker I will, explain this docker image, are in a while I mean, to say docker file in a while.

I'm, Going, to explain, this, or darker, file, how. It works in here well. Then. You. Are going to execute commands, these are the commands which we are going to execute in the. Execute. Command option so first what we do in, case any previous. Docker. Containers. Are running we will stop those containers, and then. Terminate, those containers, by using darker, RM and. Terminate. The images, if any images, exist with the velocity demo, because. The name we have given for container. And the images, they will exceed mo so delete. That image. Sorry delete that container, under deliver that image then. Go, to CD, / opt, darker and. Build. The new image, from, the bar. File, under the, from. The O with, the new wire file I'm going to say so, now it is going to darker build - T will exceed mo this is the. Darker. File name under dot means in the current location there is a darker file use, the redeker file to create your docker image, called relaxi demo that is the meaning. Of this one now, we will see what is there in the darker file I'm just scrolling, up if you see in the darker file you are going to pull the Tomcat. And/or. Tomcat. Version 8 I mean to say version. 8 the Java version 8. Image. From the public, github. Repository. Then. Maintainer. It is an optional parameter I'm, just giving Biloxi Tech at gmail.com. Next. Thing we are going to copy the web, app dot RAR file onto the target. Container, into this location, this, is the default location of, your tomcat. Container, so, under, this one whatever application. Is there under this location, whatever application, is there it, takes that application. And get. It sorrowed. And if. You see here in my copy command, I'm giving dot slash web web, app dot ah well, nothing. But dot. Nothing but we are under /opt. Docker, under this location, it looks, the webapp, dart of our file, that's. Why if you see in my. This. Option, I'm copying my, web app dot where file onto the remoter directory slash, Wapiti darker, because it looks for /opt. Darker, in my, docker file looks for /opt. Darker, once. You have done that one, next. To thing is send, files are execute.

Commands, Over SSH. Here, you are going to use the name as a docker, host and the execute command this. Is the command, to create your, docker container, out of docker image, so. What will happen here is first, you have your darker file from, docker, file you are creating, your docker image over here from. Docker image, you are creating, yet docker, container, over here so. That is the sequence you should follow and this, docker container, sorry docker image, always. Take the latest, of your back file because whenever. You want, to come to this step before that one it should build the latest image, okay, this is where clean, install, package, comes into the picture. So. Here you have created a container, and. Before. Executing, the job, I'm not executed, I will create the job with these parameters then. Login to your docker, host on check you, cannot find any images, or containers, and they, execute the job once you have executed the job new, image, with the name of relaxi demo it creates, a new image and also, it creates a new container, with the name of relaxi demo. Then. You. Can able to access the application, whatever is running on biloxi demo by using the darker. Container, public. Docker. Host public, IP address : 8 0 9 0 why, I have given 8 0 9 0 is, I am, exposing, my application. -. Be nothing but port and 8, 0 9 0 is, the host type port. Number this is the container port number our, Tomcat, application, within the container it runs on 8 0 at 0 but, if you want to access it from outside, you should use the age 0 9 0. Right. Let's. Go and follow. These steps and create a ec2. Instance and, do. Install. The darker under further steps, I'm. Going back to my. What. I can say easy, to install, AWS. Console, here. My Jenkins, server is running let me launch a new server this. Server is, amazing, Linux server. And. I'm. Not changing any. Parameters. Name. I am going to you. Docker. Host. Why. I am giving docker, host is here I am going to create. A docker containers, on on, this node and, security. Group I am using the existing security group, no. Changes. Launch. It i'm using the devops. That's. It will, wait for a while and, connect. To this instance.

So. My Dockers are over is almost get launched, and i'm taking the public IP of my, daugher host and it's. A Shh. Connect. To your IP. R connective. Our, docker. Server, under, the default username is easy to - user. Ok, and. I. Have logged. In once, you have logged in I became a root, yum, install, darker. -. Why I am, installing, docker, on this node. Once. The target installation. Is completed, I am, going to start the docker services. Service. Darker. Status. Currently. It is not running, I'm. Going, to start these services. Once. It is started, let. Me act, create. A new user user, add. Darker. Add me, I'm. Setting, the password for. Doc, or admin. Okay. I set, a simple, password for her to. Remember easily, next, to add this user to group. So. To add. This, user to, group we. Should execute. A command, called user mod, and. Easy. Darker. This is the group name under this is the and, darker. Grew darker. At me okay. Now I have create, a darker, admin. After. Following these, steps third, step next thing is we are going to CD. Slabs opt, darker, so. Series, /opt. There. Is no darker. Directory, mkd here your darker. Created. A darker directory, and. Go to docker, and. VA. Docker. File in docker file D must be caps, then. Only that is the syntax, to. Understand, I'm. Taking. The our image. Sorry. Docker, file instructions. And just going. To paste it over here, now. I'm. Saving. This file. File. Has been saved, and, let me open and see okay. It's, copied, her I. Just. Copied, fine. Next. To thing, login. To your Jenkins, server I have, already logged, into my Jenkins, server this is my Jenkins, dashboard, and go, to the manage, Jenkins. Configure. Systems. Under. Configure, systems, you can see publish. Over SSH, yep here. You need to add new server the. New server, name I am. NOT I'm. Going to cue docker. Host. And the next thing is the IP address of you were a darker, host I'm, going, to give the private IP address, so I can. Use for longer time, even. Though the public IP address keep on changing next. To the username. Darker. Admin, this is the purpose I have created and, the. Remote directly, nothing, is required and, advanced. Under. Here you should, provide, the. Password. So. User. Name ok, nothing to change, and. The password, and, providing. Under. Test the connection. Oops. So. We should, sorry here I should cover the password, not. Here. Okay. So. Darker. Admin, and. Replace, the connection. Failure. To connect, in Israel's SSH. Config. Darker. Host. IP. Replace, dark Rodney. Ok. Because I need to enable the password-based. Authentication. Via. /u. TCS sh, sh. T. Underscore, config. Password-based. Authentication, is, not enable. I have. A neighborhood. Next. Thing, service. Is be, restored. Now. Let. Me. Try. To test. This one this time it is successful, way, because, by. Default it won't allow the password-based, authentication. Right. Next. I think I'll, play save, this one I have. Served it. Next. To create a new, item I'm creating. A new job and I'm. Going to name it as they're darker. Project. Three, I'm. Naming, it as a darker, project, three and it is a mavin, project, let's. Go. Next. To thing we should select the source code management all, these instructions, are provided in, the document, in, the source code management, you. Should copy, let, me. Drag. Into another one so. This, is the URL of your, github. No. Extra, spaces, and. Credentials. Are not needed because, it is a public repository, if, it is a private repository. You should add the credentials. Anyway. Next, thing is it is master, of course. Master. Of branch next. To build palm, dot xml. Clean. Install. Package. Okay. So those, are the instructions. We. Want oq that is clean install package. In. Case of tightrope. Next. To post build steps you should select, that. Send. Files, are execute, commands, over SSH. Here. You need to choose not, ansible, server over top or host because, I am going to run this one on docker. Host and, source. File I, course I have given here the, source file wood beams under, ever workspace, its, create a new. Directory that. A new directory, will be web daughter targets. So. The Raptor dart target, and remove. Prefix, I don't require these extra, additional. Parent. Directories, so, I'm removing it and the, remote directory I want to copy these server file, onto my. /opt. Because, here I have created my docker file and if, you see my docker file looks for the dart slash web app dot where file in the current location, so, no image, is there so for whenever. This job executed. It should create this image under, this location, so, that the dockerfile are sorry. Docker build command, get success success. Otherwise. It is going to fail. Let's. Go back again, so.

Remote. Or directory, double. Slash you should use double. /opt. Docker, all, right next. To the commands, you, can just take these commands, so. Darker. Stop dr., Arum, darker. Image. RM, all, we, are running because in case these, images, are already exist. And, containers, are already existent, running. These. Commands, get failed nothing, but the last command get fair to. Overcome, that problem we, are just, make. Sure that if with. The velocity demo any image, is there please, remove, that image and. Also I'm, going to execute, the same again, one, more because, in this. Execution. It is going to create a talker file but I need your darker container, so. That Redeker container, I am going to create under docker host and the, execution. Command, would be. Something. Like this docker, run -, t - name. D nothing but to detach it more name, relaxy demo with the name. Of well exceed my attacker, container, get created. -, pH 0 9 0 and, H 0 H 0 by. Default it runs on eight zero zero that, is I'm exposing, an H 1 and 0 and it uses the image. Called well exceed mo so, the, image name under the container name I am giving, relaxi. Demo, sorry. Not. The space go, back to the space that's. It, apply, save. Before. Executing, our commands, just go on check. Darker. Images. No. Images, are there, darker. PS, it, will give the active, containers. Darker. PS - a active. And inactive containers. None, of those are there and in the current location we have only docker, file if, once, I execute, this darker, job, it's, creative, F dot where file under this location, and also, it. Creates image, by using your, our. Web, app dot where whatever lettuce we have created, and it. Creates a container, out of that, let's. Go and see I. Am. Building. This job and. It. Is going to hold, all the required packages, to. Build this code, and. To. Do that. So. Let's see what will happen. So. It. Is doing the test cases nothing. But if you have created. Any test cases it is going to test those test cases, next. To thing let it build is successful nothing. But it created a wire file if I go back and check LS, oops. Not, yet created let's. See. Unstable. There is some problem. Connecting. From host so, on so connection, with. Configuration. Docker, host disconnecting. While. Publishing. Ok. Doesn't have the permissions, because this. CD. / opt docker, is owned by the root. User so, see her own I am giving. The ownership on this one. To. My darker, admin. User. Docker. Admin docker admin, /. Wapiti. Docker, and I. Will give recursively. Right. Let. Us execute, the same job again, because. Due to permissions. It has failed. Well. Web app dot VR file onto my darker. Host its, failed due to a, permission. Issue. Okay. This time it, is successful. I think. It's coupled, and it is building the darker image let's. Go and see on the server, unless. You can see here web app dot rar file has been just. Created. And, the darker images. Now. You can see a darker, image created. Two seconds, before and, also darker. PS. Which. Will show you the active container, one, container, is up and running, let, me try to access because, you want to access you, need to take the host port, and. Port. Number eight sorry, host IP and of eight, zero nine zero is the port number and this, port number should, be open in the Eva. Security. Group if not please open, and then only try it otherwise, it won't work, so, I'm taking. The. Public IP of my rocker host. Okay. I'm. Taking, IP. Address. Followed. By eight zero nine zero, just. I'm checking it out whether, we could able to access our application or. Not so. This is the default page but my application, is configured, under default, location. Again you need to go to web app this is the how. I have configured, my application, you can see here hello. Welcome to Galaxy, technologies. Deployment. Through Jenkins, on docker container, these, are the changes I have done, right. So. This is how you, can able, to set up your ca Siri pipeline, by using the Jenkins and can. Deploy onto your docker container. Fine. And I'm. Going to do one more test because. I need to make sure that it is working seamlessly. Assumes. That assume. That somebody, has. Modified. The code whatever, is there in my github repo. Now, if I build you should get the latest, build. Code right then, only we can call it as a this is continuous. Deployment. For. That experiment, what I will do I will change, code, in my github and. I. Will, execute my Jenkins, job again, it. Will get deployed, and whatever modifications, I have done to my code it should reflect over here fine. So. Let's go back to my github. And. I'm. Going, to well. Exceed, tech under, the relaxed attack you could able to see the hello. World program, under. This web perhaps. And. This. Is the file Jenkins, dot a JSP, here. Whatever information, you have provided you, could see the same information, in the browser let's.

Add, Something. Happy. Happy. Learning. I'm. Going to. H. 2. There. W Thunder. Devups. Training. Okay. I'm. Closing, this I have, a dread I have. Modified the existing, code and added but, adding, a sort of modifying, the poor directly here is not advisable, what, you can do you can clone this repository, then. Modify. Your code and add that one to your local. Repository, then, push it into the remote repository, that is what advisable. Butter, for. A time. Being I am doing this one I will update the comments, as a. Modified. Index. Dot JSP. Commit. Changes. Now. Let, me execute the job again this time this. Time I, could. Able to see the new code again so, what. Does it do first, sure it will go and check whether any, relaxi, demo image and the containers, are running. It. Is going to remove these image and containers, and create, the new one by. Using the latest web, app dot VR file ok let's. See that's God disconnected. Let me reopen. Duplicate. Session. CD. /opt. Docker. Endless. - L date. So. Let's. Just create a new one again let's get let's. Just created, 1769. 1716. And the. Dark. PS. New. Container, also might be care to replied yep. 22, seconds, only, under. Darker, images. You. Can see the 31, seconds before a measure has been created, if, I reload my page I, could able to see the new application, new, deployment, let's, refresh, it. Yes. It's working. Okay. So. This is how you can enable the, continuous. CA C D pipeline, in case of no, our. Deployment. Tool is available in your environment. Okay. In. Next video what I will do whatever, commands. I am executing through, the darker, configure. Us or a darker job, sorry, Jenkins, job I will, put all these instructions in here. Amal. Playbook, in the, I mean. To say ansible. Playbook, and I will initiate just, ansible playbook, from my Jenkins, job that's, it so, all these instructions, will get executed, in the ansible. Fine. So, that is how you can. Able. To introduce the new. Components. Of new tools, in our CHCO. D pipeline. Anyway. Thanks, for watching this video I hope this, video helps, you to set. Up the, some. Of the real-time. Environments. And. I'm. Going, to see, you again in next video.

2018-10-24

Show video