Simple DevOps Project - Create a Game using Docker and Deploy to AWS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone Welcome to Cloud Jam in this video we are going to do a devops project where we will be creating a game using Docker container and then deploy it on AWS in this devops project we will learn how to create Docker file Docker images Docker containers and then how to deploy a containerized application on AWS watch this video till the end complete the project if you complete the project and showcase this on your resume or your LinkedIn there are high chances that you can get your devops job faster so watch this video and complete the project with me before we start with the video If you haven't subscribed to Cloud champ Please Subscribe I post videos on AWS cloud and other devops tools so please subscribe and let's start with the video let me give you an idea of what are we going to create in this devops project so you might have heard about a game named as 2048 so this game two zero four eight you might have played we are going to create this project on Docker so we're going to use this GitHub repository I'm going to paste the link in the description so you can go check it out so this is repository by Gabriel we are going to use this repository to create a game on Docker container and then we will be using the elastic Beanstalk service in AWS to deploy this Docker container on AWS if you haven't seen my elastic Beanstalk video go check it out you can find it here in written so let me show you what this game might look like so that for those who don't have the idea can get the understanding of what are we going to create so I'm going to go to this website I don't know whose website this is but this is what we are going to create similar to this so this is a 2048 game very matchy numbers so 2 plus 2 becomes 4 and 4 plus 4 8 till you get the number 2048 so this is what we are going to create so let's start to get started with this we are going to use the repository as mentioned and they will be using this repository to create our own Docker image and then Docker container so now that you have the understanding of this project let's go and create it I'm going to open my terminal and create a folder so name it 2048 the name of the game and inside this folder I'm going to create a Docker file so I'm going to go in this folder open my vs code if you're running if you're on Windows you need to follow different steps to create a folder you cannot use mkdir command but that's for Linux inside this I'm going to create a Docker file make sure when you get the name for the file D is capital and that stuff all is going to be small so Docker file and we are going to create a Docker file for our game so I'm going to use the base image as Ubuntu 24 sorry 22 so Ubuntu and 20 20 22. so let me show you the image on Docker half so this is the official Docker image for Ubuntu 222 sorry this is Ubuntu and we have different versions so we're going to use this image which is 22.04 so whenever you want to use an image you need to type from and then the name of the image so Ubuntu colon 22.04 if you want to know all these different commands on Docker you can go and check out my LinkedIn I post a different post on Docker or all devops tools I have a post where I Define or explain all the different Docker instructions so from means to specify a base image run environment copy expose add we are going to use some of this instructions in our Docker file so you need to have good understanding of what this is I'm also going to post the link for this post in my description so you can go check it out you can follow me on LinkedIn so yes so now we are going to use the base image as Ubuntu next we need to run a command so run apt hyphen get update which means update all the packages on my Ubuntu machine next we again need to run a command so run curl sorry run apt hyphen get install utility so we're going to install equal zip and nginx nginx is a web server which will be used to host our game on the browser so install hyphen y nginx then we also need zip to unzip our repository M curl utility then once we install all this we are going to Echo a message which is we are going to Echo Daemon off you need to do this configuration in our nginx so slash Etc nginx slash nginx.com so we are going to run this uh once we install nginx our ZIP and curl we are going to do this configuration which is D1 of in the nginx file next we need to curl hypheno slash VAR slash www HTML slash master dot zip hyphen l the repository let me give you let me paste the link here so here in this on line seven we are trying to curl the repository on this path which is master.zip inside VAR www HTML folder so we are trying to install all the things in this GitHub I showed me earlier so this repository we are trying to get the files on our this path you don't need to clone it you can just run this without cloning you'll find you'll see all the files here so here we have it in zip folder we need to unzip it as well so in the next command we are going to unzip this master.zip so CD slash one slash www HTML which means I'm going to go in this directory next Once I am inside this directory I need to unzip master dot zip folder so master.zip where we have all the contents for our GitHub the repository and once we unzip it then move all the content so move two zero four eight hyphen master and and all the contents inside this tour path which is current path so copy all the extracted files in this path of inside HTML folder so once I do that I'm going to uh also remove the previous master.zip as folder here so RM rf2048 hyphen master and master dot zip so master dot zip once you do this we are going to now expose the port 80 what do you mean by Expose if you want to know you can go and check my LinkedIn post which I was talking about so this is so where is the LinkedIn post again all right so you can see here Xpose main specifies the port to be exposed on Docker container so this game is going to be hosted on web browser so it is going to be exposed on Port HTTP or HTTP which is going to be Port 80. so we're going to use expose we have used from to specify the base image run to execute any command and now we are using Xpose to specify the port on which we are going to run this application so I'm going to run expose port 80. next Once I do that with my application is almost ready I just need to run a command to start my nginx or to do a configuration so CMD and then inside square bracket I'm going to do slash user slash S bin slash nginx and I'm going to do hyphen C so you can see comma same thing slash so this path here which is its Etc nginx conf all right so I'm going to paste this this is ready we have our Docker file ready now let's try to create an image out of this and see if we are going to get the application as desired so make sure you create this Docker file let me explain it to you again so here we're using from to get the base image so base image is Ubuntu and the version is 22 then we are running the command to update all the packages in our Ubuntu machine we are running command to install nginx zip and curl so this three utilities are required once you install this nginx you need to do this configuration which is D1 off in the nginx conf file after you do this configuration you are going to curl to get the repository content in your VAR slash ww HTML folder this content is going to be in master.zip or Zip Zip extension so we need to use uh and we need to use zip to unzip the content so we are going to unzip all the content in this path and then delete the folder so once you delete the folder you're going to expose the game on Port 80 and then we are going to run this command to start RK so I'm going to save this and open my terminal so for you to understand now we are going to run some Docker commands right now we have the file using this file we are going to create an image and out of the image we are going to create a container so Docker file when you build it you create an image when you run the image you create a container right so let's go and build an image out of this Docker file we have a Docker file created we are going to create an image out of this so when you have a Docker file you can build an image out of this and with the image you can run a container so Docker file Docker image Docker container so let's go and create a image for the docker file we have created so I'm going to run the dot command to create an image so it is docker build and I'm going to add a parameter which is hyphen T to give a name for this image so I'm going to name this as 2048 iPhone game and then dot this dot means create an image out of the docker file which is in the current directory if you are not in the directory which has a Docker file you need to get the exact path but I am right now I am in the current directory so I'm going to run Docker build hyphen T name of the file image and Dot so this command is going to create an image for this Docker file and name it as 2048 so I'm going to press enter and it will execute all these commands one by one so press enter and it has used the first image as Ubuntu 22 then it's going to update all the packages in my Ubuntu image so it's updating all the packages and next it will install the utilities and following it will execute all the commands one by one so you can see it has updated all the packages now it has installed nginx curl and zip once it has installed that it's going to do this configuration in the nginx cons folder and then it will download the GitHub repository content unzip it expose it and then do this configuration so let's wait for this image to be created and then we are going to run a container out of this image so you can see it has also installed all the GitHub content from this repository which is the game actually next it's going to expose Pro DT and then run the last command so it says successfully built image and it also gave it a name as 2048 so I'm going to run Docker images command to see if my image is actually there or not so Docker images and you should see an image so you can see an image is here which is 2048k and it's created 21 seconds ago all of these are different images that I've used but you don't need to you just need to focus on this if you follow the video you should have a Docker image created like this so now that we have the image let's go and run a container to test out that we have what we actually wanted so I'm going to do I'm going to clear this out first now that we have our Docker image created from our Docker file let's go run a command to create a container out of this so I'm going to run Docker run hyphen D hyphen P Port 80 colon Port 80 and then either the name or the ID of my image so I'm going to copy the ID and paste it here so I'm we are telling Docker to run a container on Port 80 and this container is Created from this Docker file so we should have our game created so I'm going to press enter and we should get some ID like this once this you get this which means your container is running to test it out I am going to go to my localhost so I am going to open my browser here and I'll type load kill host Port 80 which is actually uh without Pro TT but you can see a game is created on here which means our Docker container is running you can play this game but right now this Docker container is in your Local Host so no one else is going to access it apart from you so this is why we are going to host this on AWS Cloud but I hope if you're following this video and you are here which means you have a container running which is hosting your app or your game so let's go and create or host this on the cloud using elastic Beanstalk so to do that I am going to open my console so I'm going to run AWS command console open your AWS console you should have an AWS account for this and you can use my you can watch the elastic Beanstalk video which I posted some time some days ago to understand what we are going to do here so elastic bean stock is a service in AWS that lets you create applications on different platforms like python node gojs Docker everything so we're going to use this service to create our game so I'm going to name this as 2048 and then I'm going to get this environment as demo game or demo project all right I'm going to choose the platform as Docker as this is a Docker container so I'm going to choose this Docker and we are going to leave the settings as as it is so recent recent version and in the application code I am going to choose upload your code option so upload your code and then I'm going to push my Docker file here so I'm going to choose file go to my repository which is this 2048 and this is the docker file which we used to create our application or to create the game so I'm going to push this Docker image here and it says file successfully uploaded once it is done you can choose to configure more options if you want to configure some details accordingly if you want to add like high availability if you want to have load balances but for the sake of this project I'm going to go with the free tier option because we don't want the bill to be increased so I'm going to go with a free tier option and then click on create app option here once you click on create app elastic Beanstalk is going to automatically provision all the infrastructure you don't have to manage anything you just need to push your code and elastic beam stock will create your infrastructure like it will create your instances your containers images load balances Auto scaling group everything that is necessary for this application to run will be created by elastic bean stock so we will wait for some time to this to bring all the infrastructure up once the infrastructure is up we should see our application running on the cloud so if you see here this is what we got and right now it is in localhost but we will get we will get a C name created by elastic Beanstalk which we can map to a to a domain and then we can have our own website hosting this game you can also create your own application so this is an excellent project to do let's wait for some time because right now it says environment is starting it has created elastic IP it creates a security group for us as well so let's wait for some time and it says instance deployment completed successfully so elastic bean stock is an amazing service to use if you just want to have your application hosted without managing any infrastructure AWS is going to do that for you so right now it says application available on this path and it says successfully launched so let's wait and here it says okay so you can click on this C name to get the application so right now we have a application running on Docker on Amazon Linux Ami so I'm going to click on this and we should have our application running if you have a screen like this which means you have successfully deployed your application on Docker using elastic bean stock service so I'm going to play this game now and I hope if you follow the video you have the same output as me if you have any questions any doubt you can let me know in the comment section and if you got the output or the project created you can showcase this on your LinkedIn you take a screenshot or a video and then post it on LinkedIn because when you post it on LinkedIn be visible to all the recruiters and they will get to know that you have knowledge of Docker and AWS so you can showcase this on your LinkedIn on your resume but make sure to tag me or on your LinkedIn and also make sure to follow me on LinkedIn I hope this was informative if you have if you understood the video please subscribe to my channel and once you are done make sure you delete this you need to delete the application and the environment in the elasticbin start or is you might get charged so once you are done and you have showcased it on the LinkedIn on your resume make sure you delete the infrastructure if you don't want to get charged for more videos like this please subscribe to Cloud Channel and thank you have a good day bye
Info
Channel: Cloud Champ
Views: 14,814
Rating: undefined out of 5
Keywords: devops projects for practice, devops project, docker projects for beginners, docker projects for practice, docker project tutorial, aws projects, aws project step by step, aws projects for interview, devops projects for resume, devops projects, cloud projects for students, cloud projects for beginners, 20 real time devops projects, devops project ideas, Live DevOps Project for Resume, devops real time projects, devops online project, simple devops projects, aws devops, devops
Id: XeoZstvyew8
Channel Id: undefined
Length: 17min 51sec (1071 seconds)
Published: Sun Jan 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.