{"id":21315523,"url":"https://github.com/rajsoni03/devops-training-ggits","last_synced_at":"2025-10-14T13:03:10.959Z","repository":{"id":112055349,"uuid":"389919469","full_name":"Rajsoni03/DevOps-Training-GGITS","owner":"Rajsoni03","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-15T04:19:49.000Z","size":7015,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-12T01:31:53.207Z","etag":null,"topics":["aws","chef","devops","ec2","git","github","httpd-server","notes"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rajsoni03.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-27T09:14:13.000Z","updated_at":"2023-08-14T20:39:51.000Z","dependencies_parsed_at":"2023-05-04T11:35:47.132Z","dependency_job_id":null,"html_url":"https://github.com/Rajsoni03/DevOps-Training-GGITS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rajsoni03/DevOps-Training-GGITS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rajsoni03%2FDevOps-Training-GGITS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rajsoni03%2FDevOps-Training-GGITS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rajsoni03%2FDevOps-Training-GGITS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rajsoni03%2FDevOps-Training-GGITS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rajsoni03","download_url":"https://codeload.github.com/Rajsoni03/DevOps-Training-GGITS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rajsoni03%2FDevOps-Training-GGITS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018555,"owners_count":26086583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","chef","devops","ec2","git","github","httpd-server","notes"],"created_at":"2024-11-21T18:21:15.998Z","updated_at":"2025-10-14T13:03:10.952Z","avatar_url":"https://github.com/Rajsoni03.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DevOps-Training-GGITS\n\n## DevOps Pipeline\n\nStep 1- Developer -- Code -Git/ GitHub\u003cbr\u003e\nStep 2- Build (.exe)  (Tools - Jenkins/Maven)\u003cbr\u003e\nStep 3- Testing (Selenium)\u003cbr\u003e\nStep 4- Quality Assurance\u003cbr\u003e\nStep 5- Deploy (Tools - Chef/Docker/Puppet) \u003cbr\u003e\nStep 6- Maintenance + Employee Training\u003cbr\u003e\nStep 7- Monitoring\u003cbr\u003e\n\n## Git and GitHub\n\u003cimg src=\"Screenshot/1.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/2.png?raw=true\" width=\"700\"\u003e\n\n## Create New Repository on GitHub\n\nStep 1 : - Click on + icon show in top right corner \u003cbr\u003e\nStep 2 : - Select New Repository option \u003cbr\u003e\n\n\u003cimg src=\"Screenshot/3.png?raw=true\" width=\"700\"\u003e\n\nStep 3 : - Name the Repository\n\n\u003cimg src=\"Screenshot/4.png?raw=true\" width=\"700\"\u003e\n\nStep 4 : - Click on Create Repository button\n\n\u003cimg src=\"Screenshot/5.png?raw=true\" width=\"700\"\u003e\n\nStep 5 : - Copy the URL.\n\n\u003cimg src=\"Screenshot/6.png?raw=true\" width=\"700\"\u003e\n\nYour new repository has been created successfully.\n\n\n\n## Install Git on EC2 Instance\n\nLogin with ec2-user \n\n```shell\n# switch to superuser \nsudo su \n\n# update the packages\nyum update -y\n\n# install git\nyum install git -y\n\n# check git version\nwhich git\n```\n\n## Git Configuration\n\n```shell\n# Set Configuration\ngit config --global user.name \"FirstName LastName\"\ngit config --global user.email user@gmail.com\n\n# Check Configuration\ngit config --list\n```\n\n\n## Create Project Directory and File on EC2 Instance\n\n```shell\n# create directory \nmkdir Project\n\n# move inside Project directory\ncd Project\n\n# craete new file \ncat \u003e myFile.txt \nMy name is _____.\n```\n(press `Ctrl + D` to save file and quit)\n\n## Manage Project Versions in Local Repository\n\n```shell\n# initialise the local directory with git\ngit init \n\n# Staging the changes\ngit add myFile.txt\nor \ngit add . \n\n# check all files in staging area\ngit status\n\n# Save the changes on local repository\ngit commit -m \"File-v.1.0\"\n\n# checks commit history\ngit log\n```\n\u003cimg src=\"Screenshot/7.jpg?raw=true\" width=\"700\"\u003e\n\n## Push Project to GitHub (Remote Repository\n\n```shell\n# Connect local repository to GitHub repository\ngit remote add origin GitHub_Repo_URL\n\n# Push to GitHub\ngit push -u origin master\n```\n\n## Important Terms \u0026 Definitions\n\n\u003cb\u003eWorking Space - \u003c/b\u003e It is where the code is written \u0026 is called the workspace.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eStaging Area - \u003c/b\u003e When code needs to be committed, it is added to the staging area. In other words we can say when the code needs to be finalized it comes in staging area. This process is called \"Add\".\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eLocal Repo - \u003c/b\u003e When the code is final, we commit the code from staging area to local repository. Local repo is present inside the Linux machine.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eRemote Repo - \u003c/b\u003e A remote repo is a git repository hosted on the internet or some other network.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eCommit ID and Commit - \u003c/b\u003eCommit ID is the metadata  stored with the file, it is 40 alphanumeric characters. Bringing the file from staging area to Local repository is called \"Commit\", it means that all the code that has been written is finally saved.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eCheeksum - \u003c/b\u003e It is a numeric value attached with the file, when the file is updated the checksum value changes hence we get to know that the file/data/code has been updated.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eVersion ID - \u003c/b\u003e Reference to identify each change, when the user updates the file the version ID depicts about who did so.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eTag - \u003c/b\u003e With the commit ID a tag can also be attached which contains a message of what has been updated lastly.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eSnapshot - \u003c/b\u003e The changes that are made in file is snapshot, changes that are made in a particular time.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003ePush - \u003c/b\u003e What all has been committed in local repository now is pushed to Central Repository(GitHub/GitLab or any other) this is called push.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003ePull - \u003c/b\u003e Pull operation copes the changes from a remote repository to a local machine. Pull operation is also used as synchronization between the two repositories\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBranch - \u003c/b\u003e Code is same so only one repository is created but when we want to work in parallel, 'branch' is created in which changes are personal to that branch only and finally it is clubbed together with other branches.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eCheckout - \u003c/b\u003e This command Is used to switch in between the branches and check for the updated files or any new commits to it.\u003cbr\u003e\u003cbr\u003e\n\n\n## Chef\n\nChef is a Configuration Management Tool.\nChef Architecture has 3 Components\n\n- Workstation (Where we write the code)\n  - CookBook\n  - Recipe\n- Chef Server (Where we store the code)\n  - Knife\n- Chef Client (Node)  (Where we apply the code)\n  - Ohai\n\n\u003cimg src=\"Screenshot/8.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/9.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/10.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/11.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/12.png?raw=true\" width=\"700\"\u003e\n\n\n## Installation of Chef on AWS EC2\n\n- Goto www.chef.io using windows machine\n- Click on Download button on top right corner\n- Click on Chef Workstation\n- Select your OS for download ( select Amazon Linux for EC2) \n\n\u003cimg src=\"Screenshot/13.png?raw=true\" width=\"700\"\u003e\n\n- Click on download and fill the information form (if there are)\n- If the downloading is started, pause them\n- Press `Ctrl + j` for go to downloads in chrome\n- Right click on link and **copy link address** (url)\n\n\u003cimg src=\"Screenshot/14.png?raw=true\" width=\"700\"\u003e\n\n- Open your EC2 terminal using putty\n- login with ec2-user\n\n```shell\n# switch to root user \nsudo su\n\n# download chef workstation in linux\nwget \u003cPaste Chef URL\u003e \n```\n\n\u003cimg src=\"Screenshot/15.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# check the downloaded file\nls\n```\n\n\u003cimg src=\"Screenshot/16.png?raw=true\" width=\"700\"\u003e\n\n\n\n```shell\n# install the chef package\nyum install \u003cpaste the above chef-workstation path\u003e\nor \nyum install \u003cpaste the above chef-workstation path\u003e -y\n```\n\n\u003cimg src=\"Screenshot/17.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# Check chef version\nwhich chef\nchef -v\n```\n\n\u003cimg src=\"Screenshot/18.png?raw=true\" width=\"700\"\u003e\n\n\n## Create Cookbook\n\n```shell\n# Create a directory\nmkdir cookbooks\n\n# change directory \ncd cookbooks\n\n# list directory \nls\n\n# create a new cookbook\nchef generate cookbook test-cookbook1\n```\n\n\u003cimg src=\"Screenshot/19.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# install tree package \nyum install tree -y\n\n# show the tree structure of the directory\ntree\n```\n\n\u003cimg src=\"Screenshot/20.png?raw=true\" width=\"700\"\u003e\n\u003cimg src=\"Screenshot/21.png?raw=true\" width=\"700\"\u003e\n\n\n## Create Recipe\n\n```shell\n# change directory \ncd test-cookbook1\n\n# create new recipe\nchef generate recipe test-recipe1\n\n# show the tree structure of the directory\ntree\n```\n\n\u003cimg src=\"Screenshot/22.png?raw=true\" width=\"700\"\u003e\n\n## Write Code in Recipe\n\nThe code is written in ruby language.\nThe file extension/format of the ruby file is rb.\n \nTo edit the code in CLI, there are 3 types of code editor.\n- vi\n- vim\n- nano\n\n```shell\n# open recipe file in vi editor\nvi ./recipes/test-recipe1.rb\n```\n\n\u003cimg src=\"Screenshot/23.png?raw=true\" width=\"700\"\u003e\n\n- Press i for **INSERT MODE**\n\n\u003cimg src=\"Screenshot/24.png?raw=true\" width=\"700\"\u003e\n\n- Add the following code in Recipe file\n\n```ruby\nfile '/myfile' do\ncontent 'Welcome to DevOps - Chef configuration Management Tool - GGITS'\naction:create\nend\n```\n\n\u003cimg src=\"Screenshot/25.png?raw=true\" width=\"700\"\u003e\n\n- Press `Esc` to exit from **INSERT MODE**\n\n\u003cimg src=\"Screenshot/26.png?raw=true\" width=\"700\"\u003e\n\n- Type **:wq** and press `Enter` to save and exit.\n\n\u003cimg src=\"Screenshot/27.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# read the Recipe file using cat\ncat ./recipes/test-recipe1.rb\n```\n\n\u003cimg src=\"Screenshot/28.png?raw=true\" width=\"700\"\u003e\n\n## Run the Recipe\n\n```shell\n# execute the recipe file\nchef exec ruby -c ./recipes/test-recipe1.rb\n```\n\n\u003cimg src=\"Screenshot/29.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# run the Recipe on all nodes\nchef-client -zr \"recipe[test-cookbook1::test-recipe1]\"\nend\n```\n\n\u003cimg src=\"Screenshot/30.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# check the files in root \nls /\n```\n\n\u003cimg src=\"Screenshot/31.png?raw=true\" width=\"700\"\u003e\nIf the Recipe is successfully executed then you will see the myfile is created in root directory.\u003cbr\u003e\n\n```shell\n# read myfile using cat \ncat /myfile\n```\n\n\u003cimg src=\"Screenshot/32.png?raw=true\" width=\"700\"\u003e\n(We wrote this message in test-recipe.rb file.)\n\n\n## Install and Run Apache Web Server on EC2 using Chef\n\n```shell\n# list directory\nls\n\n# change directory\ncd cookbooks\n```\n\n\u003cimg src=\"Screenshot/33.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# create new cookbook\nchef generate cookbook apache-cookbook\n\n# change directory\ncd apache-cookbook\n```\n\n\u003cimg src=\"Screenshot/34.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# create new recipe\nchef generate recipe apache-recipe\n```\n\n\u003cimg src=\"Screenshot/35.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# show directory \ntree\n```\n\n\u003cimg src=\"Screenshot/36.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# open recipe in vi editor\nvi ./recipes/apache-recipe.rb\n```\n\nadd following code in recipe\n```ruby\npackage 'httpd' do\naction :install\nend\n\nfile '/var/www/html/index.html' do\ncontent '\u003ch1\u003eHello World!\u003c/h1\u003e\u003ch3\u003eThis is My First Website\u003c/h3\u003e'\naction :create\nowner 'root'\ngroup 'root'\nend\n\nservice 'httpd' do\naction [:enable, :start]\nend\n```\n\n\u003cimg src=\"Screenshot/37.png?raw=true\" width=\"700\"\u003e\npress `Es`c then press **:wq** and press `Enter` to save and exit\n\n```shell\n# execute the recipe\nchef exec ruby -c ./recipes/apache-recipe.rb\n```\n\u003cimg src=\"Screenshot/38.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# run the recipe \nchef-client -zr \"recipe[apache-cookbook::apache-recipe]\"\n```\n\n\u003cimg src=\"Screenshot/39.png?raw=true\" width=\"700\"\u003e\n\n\n## AWS EC2 Security Setup\n\nSTEP 1 : - Select EC2 instance then select Security Column\n\n\u003cimg src=\"Screenshot/40.png?raw=true\" width=\"700\"\u003e\n\nSTEP 2 : - Click on Security Group ID\n\n\u003cimg src=\"Screenshot/41.png?raw=true\" width=\"700\"\u003e\n\nSTEP 3 : - Click on Edit inbound rules\n\n\u003cimg src=\"Screenshot/42.png?raw=true\" width=\"700\"\u003e\n\nSTEP 4 : - Change Type from HTTPS to HTTP and save rules\n\n\u003cimg src=\"Screenshot/43.png?raw=true\" width=\"700\"\u003e\n\n## Open Web Page\n\nSTEP 1 : - Copy Public IPv4 address of your EC2 instance\n\n\u003cimg src=\"Screenshot/44.png?raw=true\" width=\"700\"\u003e\n\nSTEP 2 : - Paste the address on web browser \n\n\u003cimg src=\"Screenshot/45.png?raw=true\" width=\"700\"\u003e\n\nYou're web-page is successfully deployed.\n\n\n## Update Website\n\n```shell\n# open recipe using vi\nvi ./recipes/apache-recipe.rb\n```\n\n\u003cimg src=\"Screenshot/46.png?raw=true\" width=\"700\"\u003e\n\n```shell\n# execute and run recipe\nchef exec ruby -c ./recipes/apache-recipe.rb\nchef-client -zr \"recipe[apache-cookbook::apache-recipe]\"\n```\n\n\u003cimg src=\"Screenshot/47.png?raw=true\" width=\"700\"\u003e    \n\n\u003cimg src=\"Screenshot/48.png?raw=true\" width=\"700\"\u003e                                                        \n\n\n## Attributes of Chef\n\n```shell\nohai\n\nohai ipaddress\n\nohai memory\n\nohai memory/total\n```\n\n## Show the Attributes of Chef using Recipe\n\nSTEP 1:- Create a new Recipe\n\n```shell\ncd cookbooks\n \ncd apache-cookbook\n\nchef generate recipe attributes-recipe\n```\n\n\u003cimg src=\"Screenshot/49.png?raw=true\" width=\"700\"\u003e\n\nSTEP 2 :- Edit the recipe\n\n```shell\nvi ./recipes/attributes-recipe.rb\n```\n\n```shell\n# execute and run recipe\nchef exec ruby -c ./recipes/apache-recipe.rb\nchef-client -zr \"recipe[apache-cookbook::apache-recipe]\"\n```\n\nSTEP 3 :- Add the following code in recipe\n\n```ruby\nfile '/basicfile' do\ncontent \"This is a file to get and learn attributes\nHOSTNAME: #{node['hostname']}\nIPADDRESS: #{node['ipaddress']}\nMEMORY: #{node['memory']['total']}\"\nowner 'root'\ngroup 'root'\naction :create\nend\n```\n\n\u003cimg src=\"Screenshot/50.png?raw=true\" width=\"700\"\u003e   \n\nSTEP 4 :- Execute and run the recipe\n\n```shell\nchef exec ruby -c ./recipes/attributes-recipe.rb\nchef-client -zr \"recipe[apache-cookbook::attributes-recipe]\"\n```\n\n\u003cimg src=\"Screenshot/51.png?raw=true\" width=\"700\"\u003e  \n\n\n## Chef Server (Attaching Chef Server to WorkStation)\n\n\nSTEP 1:- Open https://manage.chef.io \u003cbr\u003e\n\n\nSTEP 2:- Create your account \u003cbr\u003e\n\n\nSTEP 3:- Go to starter kit  \u003cbr\u003e\n\n\u003cimg src=\"Screenshot/52.png?raw=true\" width=\"700\"\u003e \n\nSTEP 4:- Download and Extract the file.\n\n\u003cimg src=\"Screenshot/53.png?raw=true\" width=\"700\"\u003e  \n\nSTEP 5:- After extracting the file we will have file named chef-repo and we have to copy this file to our Linux system to do that\n\nSTEP 6:- Download WinSCP Applicatrion in windos machine. With this we can transfer files from our local windows machine to Linux machine.\nWinSCP Link - https://winscp.net/eng/download.php\n\nSTEP 7:- Install it (just click next ...next while installing)\n\nSTEP 8:- Open WinSCP, this screen will come up\n\n\u003cimg src=\"Screenshot/54.png?raw=true\" width=\"700\"\u003e  \n\nSTEP 9:- Fill these empty fields \n- Host name = PUBLIC IPv4 DNS OF LINUX MACHINE\n- User name = ec2-user\n\n\u003cimg src=\"Screenshot/55.png?raw=true\" width=\"700\"\u003e  \n\nSTEP 10:- Go to Advance option.\n- Go to Authentication\n- Give the same private key as your Linux machine (that ppk private key)\n\n\u003cimg src=\"Screenshot/56.png?raw=true\" width=\"700\"\u003e  \n\nSTEP 11:- After selecting the private key, click and just Login\n\n\u003cimg src=\"Screenshot/57.png?raw=true\" width=\"700\"\u003e \n\nSTEP 12:- Now two windows will open left one will be for windows and right one for Linux. From window of windows go to chef-repo folder drag that folder to Linux machine.\n\n\u003cimg src=\"Screenshot/58.png?raw=true\" width=\"700\"\u003e \n\nSTEP 13:- Now we can go to Linux CLI and check if the chef-repo file is there by typing ls command\n\n```shell\ncd chef-repo\n\nls -a\n\ncd .chef\n\nls \n\ncat config.rb \n```\n(chef server url will come up along with some other info)\n\n\u003cimg src=\"Screenshot/59.png?raw=true\" width=\"700\"\u003e \n\nSTEP 14:- Now we can connect our workstation by using knife command\n\n```shell\nknife ssl check \n```\n\u003cb\u003essl - secure socket layer\u003c/b\u003e\n\n\u003cimg src=\"Screenshot/60.png?raw=true\" width=\"700\"\u003e \n\nThis means your workstation is successfully connected to Chef Server\n\n\n## Create New Chef Node\n\n\u003cb\u003e*Important*\u003c/b\u003e\u003cbr\u003e\nNote the Availability Zone of your Work Station Machine (We create Node Machine at same Availability Zone)\n\n\u003cimg src=\"Screenshot/61.png?raw=true\" width=\"700\"\u003e \n\nSTEP 1:- Create new AWS Linux Machine \u003cbr\u003e\n\nSTEP 2:- Select Availability Zone same as workstation machine\n\n\u003cimg src=\"Screenshot/62.png?raw=true\" width=\"700\"\u003e \n\nSTEP 3:- Write the default executable code (It execute while instance is initialling)\n\n\u003cimg src=\"Screenshot/63.png?raw=true\" width=\"700\"\u003e \n\nSTEP 4:- Add Tag\n\n\u003cimg src=\"Screenshot/64.png?raw=true\" width=\"700\"\u003e \n\nSTEP 5:- Configure Security Group\n\n\u003cimg src=\"Screenshot/65.png?raw=true\" width=\"700\"\u003e \n\nSTEP 6:- Create New key pair\n\n\u003cimg src=\"Screenshot/66.png?raw=true\" width=\"700\"\u003e\n\n## Connect Nodes to Chef Server\n\nSTEP 1:- Login in workstation machine with \u003cb\u003eec2-user\u003c/b\u003e\n\n```shell\n# switch to super user\nsudo su\n\n# list directory\nls\n\n# Change directory\ncd cookbooks\n\n# list directory\nls\n```\n\n\u003cimg src=\"Screenshot/67.png?raw=true\" width=\"700\"\u003e \n\nSTEP 2:- Move apache-cookbook to chef-repo/cookbooks\n\n\u003cimg src=\"Screenshot/68.png?raw=true\" width=\"700\"\u003e \n\n```shell\n# go to perent directory\ncd ..\n\n# move apache-cookbook and test-cookbook1\nmv cookbooks/apache-cookbook chef-repo/cookbooks/\nmv cookbooks/test-cookbook1 chef-repo/cookbooks/\n\n# delete old cookbooks directory\nrm -rf cookbooks\n\n# list directory\nls\n```\n\n\u003cimg src=\"Screenshot/69.png?raw=true\" width=\"700\"\u003e \n\n```shell\n# check chef-repo/cookbooks\ncd chef-repo\ncd cookbooks\nls\n```\n\n\u003cimg src=\"Screenshot/70.png?raw=true\" width=\"700\"\u003e \n\nSTEP 3:- Copy Node-key.pem file to Chef workstation using WinSCP software\n\n\u003cimg src=\"Screenshot/71.png?raw=true\" width=\"700\"\u003e \n\n\n```shell\n# Check the key\ncd .. \nls\n```\n\n\u003cimg src=\"Screenshot/72.png?raw=true\" width=\"700\"\u003e \n\nSTEP 4 :- Bootstrapping (Connecting Node to Chef Server using Knife)\n\n```shell\nknife bootstrap \u003cnode private IP\u003e --ssh-user ec2-user --sudo -i Node-key.pem -N Node1\n```\n\n\u003cimg src=\"Screenshot/73.png?raw=true\" width=\"700\"\u003e \n\u003cimg src=\"Screenshot/74.png?raw=true\" width=\"700\"\u003e \n\n\n```shell\n# Show all nodes\nknife node list\n```\n\n\u003cimg src=\"Screenshot/75.png?raw=true\" width=\"700\"\u003e \n\n\nSTEP 5:- Set Cookbook to Run List of Chef Node\n\n```shell\n# Set Cookbook \nknife node run_list set Node1 \"recipe[apache-cookbook::apache-recipe]\"\n\n# Check the run_list of the Node\nknife node show Node1\n```\n\n\u003cimg src=\"Screenshot/76.png?raw=true\" width=\"700\"\u003e \n\nSTEP 6:- Upload the cookbook to Node \n\n```shell\nknife cookbook upload apache-cookbook\n```\n\n\u003cimg src=\"Screenshot/77.png?raw=true\" width=\"700\"\u003e \n\n\n## Cherf Node Setup\n\nSTEP 1:- Convert Node-key.pem to Node-key.ppk using putty-gen\u003cbr\u003e\n\nSTEP 2:- Login to node machine with ec2-user\n\n```shell\n# switch to super user\nsudo su\n\n# run the pull request\nchef-client \n```\n\nSTEP 3:- Automate the pull request process\n\n```shell\n# open crontab file using vi editor\nvi /etc/crontab\n```\n\nAdd the following line\n```shell\n* * * * * root chef-client \n```\n\n\u003cimg src=\"Screenshot/78.png?raw=true\" width=\"700\"\u003e \n\nSave and quit from editor using \u003cbr\u003e:wq\u003c/b\u003e\n\n## Check the Web page\n\nSTEP 1:- Copy Node's Public IPv4 address \n\n\u003cimg src=\"Screenshot/79.png?raw=true\" width=\"700\"\u003e \n\nStep 2:- Paste on Web Browser \n\n\u003cimg src=\"Screenshot/80.png?raw=true\" width=\"700\"\u003e \n\n\n## Automate Chef Node While Creating/Launching\n\nAdd the default command in \u003cb\u003eConfiguration Instance Details Step\u003c/b\u003e\n\n```shell\n#!/bin/bash\nsudo su\nyum update -y\necho \"* * * * * root chef-client\"  \u003e\u003e  /etc/crontab\n```\n\n\u003cimg src=\"Screenshot/81.png?raw=true\" width=\"700\"\u003e \n\n\n## Update the Web Page\n\nGoto Chef Work Station Terminal\u003cbr\u003e\n\nSTEP 1:- Edit the Recipe\n\n```shell\n# Open apache-recipe in vi editor\nvi apache-cookbook/recipes/apache-recipe.rb\n```\n\n\u003cimg src=\"Screenshot/82.png?raw=true\" width=\"700\"\u003e \n\nSTEP 2 :- Upload the cookbook to Node\n\n```shell\nknife cookbook upload apache-cookbook\n```\n\n\u003cimg src=\"Screenshot/83.png?raw=true\" width=\"700\"\u003e \n\nSTEP 3:- Check the Website\n\n\u003cimg src=\"Screenshot/84.png?raw=true\" width=\"700\"\u003e \n\n\n## Interview Questions\n\n- Q.1  Why DevOps? Where you used DevOps?\n- Q.2  Which s/w you used in DevOps?\n- Q.3  Which tool u use?\n- Q.4  Difference b/w Development and Operations.\n- Q.5  Git / GitLab / GitHub?\n- Q.6  Which platform you use in DevOps?\n- Q.7  Why infinite loop in DevOps?\n- Q.8  Where you use Git Bash?\n- Q.9  Configuration Management and Types of Version Control Systems ?\n- Q.10  Chef workstation / Chef server/ Chef nodes/ Chef client / knife / recipe / bootstrapping,\n- Q.11  Operational tool in DevOps?\n- Q.12  Have you do testing in the DevOps project?\n- Q.13  Agile description / Scrum Framework?\n- Q.14  CI/CD (*Imp)\n- Q.15  Learn more about cloud computing (*Imp)?\n- Q.16  LINUX Command\n  - package install command\n  - file system\n  - remove command\n  - learn more basics command\n\n\n## Final Project (Connect Chef-Server and Nodes to GitHub Repository and Automate them)\n\n\u003cimg src=\"Screenshot/108.png?raw=true\" width=\"700\"\u003e \n\nSTEP 1:- Create a New Folder in your Windows machine.\n\n\u003cimg src=\"Screenshot/85.png?raw=true\" width=\"700\"\u003e \n\nSTEP 2 :- Create a index.html file in the folder.\n\n\u003cimg src=\"Screenshot/86.png?raw=true\" width=\"700\"\u003e \n\nSTEP 3 :- Open index.html file in any text editor and write the html code.\n\n\u003cimg src=\"Screenshot/87.png?raw=true\" width=\"700\"\u003e \n\nSTEP 4 :- Create New GitHub Repository\n\n\u003cimg src=\"Screenshot/88.png?raw=true\" width=\"700\"\u003e \n\nSTEP 5 :- Open Git Bash in same folder.\n\n\u003cimg src=\"Screenshot/89.png?raw=true\" width=\"700\"\u003e \n\nSTEP 6 :- Connect local repository to GitHub repository and push the code.\n```bash\ngit init\n\ngit add .\n\ngit commit -m \"index.html file added\"\n\ngit remote add origin \u003cgithub_repo_ssh_url\u003e\n\ngit push -u origin master\n```\n\n\u003cimg src=\"Screenshot/90.png?raw=true\" width=\"700\"\u003e \n\nSTEP 7 :- Check GitHub Repository\n\n\u003cimg src=\"Screenshot/91.png?raw=true\" width=\"700\"\u003e \n\nSTEP 8 :- Open EC2 instance terminal with ec2-user\n\n```shell\n# switch to super user\nsudo su\n\n# goto apache-cookbook directory\ncd chef-repo/cookbooks/apache-cookbook/\n\n# open apache recipe in vi editor\nvi recipes/apache-recipe.rb\n```\n\nSTEP 9 :- Deleting existing html file \u003cbr\u003e\n\nAdd the following ruby code in apache-recipe.rb file\n\n```ruby\nfile '/var/www/html/index.html' do \naction :delete\nend\n```\n\n\u003cimg src=\"Screenshot/92.png?raw=true\" width=\"700\"\u003e \n\nSTEP 10 :- Test the recipe in chef server\n\n```shell\n# Execute the recipe\nchef exec ruby -c ./recipes/apache-recipe.rb \n\n# deploy the recipe\nchef-client -zr \"recipe[apache-cookbook::apache-recipe]\"\n```\n\n\u003cimg src=\"Screenshot/93.png?raw=true\" width=\"700\"\u003e \n\nSTEP 11 :- Deploy the cookbook to chef nodes\n\n```shell\n# goto parent directory \ncd ..\n\n# Upload the apache-cookbook \nknife cookbook upload apache-cookbook\n```\n\n\u003cimg src=\"Screenshot/94.png?raw=true\" width=\"700\"\u003e \n\nit will delete index.html file from all connected nodes\u003cbr\u003e\u003cbr\u003e\n\nSTEP 12 :- Connect Chef to GitHub \n\n```shell\n# goto apache-cookbook directory\ncd chef-repo/cookbooks/apache-cookbook/\n\n# open apache recipe in vi editor\nvi recipes/apache-recipe.rb\n```\n\nAdd the following ruby code in apache-recipe.rb file\n\n```ruby\npackage 'httpd' do\naction :install\nend\n\npackage 'git' do\naction :install\nend\n\nbash 'git_pull' do\nuser 'root'\ncwd '/var/www/html'\ncode \u003c\u003c-EOH\ngit init\ngit remote add origin \u003cYOUR_GITHUB_REPO_URL\u003e\ngit pull origin master\nEOH\nend\n\nservice 'httpd' do\naction [:enable, :start]\nend\n```\n\n\u003cimg src=\"Screenshot/95.png?raw=true\" width=\"700\"\u003e \n\nSTEP 13 :- Test the recipe in chef server\n\n```shell\n# Execute the recipe\nchef exec ruby -c ./recipes/apache-recipe.rb \n\n# deploy the recipe\nchef-client -zr \"recipe[apache-cookbook::apache-recipe]\"\n```\n\n\u003cimg src=\"Screenshot/96.png?raw=true\" width=\"700\"\u003e \n\n\nSTEP 14 :- Copy Chef-server IPv4 and Check the web-page \n\n\u003cimg src=\"Screenshot/97.png?raw=true\" width=\"700\"\u003e \n\u003cimg src=\"Screenshot/98.png?raw=true\" width=\"700\"\u003e \nWe successfully connected our chef server to GitHub repository.\u003cbr\u003e \u003cbr\u003e\n\n\nSTEP 15 : - deploy the recipe to chef node machines\n\n```shell\n# goto parent directory \ncd ..\n\n# Upload the apache-cookbook\nknife cookbook upload apache-cookbook\n```\n\n\u003cimg src=\"Screenshot/99.png?raw=true\" width=\"700\"\u003e \n\nSTEP 16 :- Copy Chef-Node IPv4 and Check the web-page\n\n\u003cimg src=\"Screenshot/100.png?raw=true\" width=\"700\"\u003e \n\n\u003cimg src=\"Screenshot/101.png?raw=true\" width=\"700\"\u003e \n\n\nSTEP 17 :- Now we want to automate the process of pull the code from GitHub and uploading the cookbook to chef nodes.\u003cbr\u003e\n\nOpen chef workstation terminal\n\n```shell\n# open crontab file\nvi /etc/crontab\n```\n\nAdd the following command \n\n```shell\n* * * * * root \"cd /var/www/html \u0026\u0026 git pull origin master \u0026\u0026 cd /home/ec2-user/chef-repo/cookbooks knife cookbook upload apache-cookbook\"\n```\n\n\u003cimg src=\"Screenshot/102.png?raw=true\" width=\"700\"\u003e \n\nSTEP 18 :- Test the automation.\u003cbr\u003e\n\nUpdate the html file in your local machine\n\n\u003cimg src=\"Screenshot/103.png?raw=true\" width=\"700\"\u003e \n\nCommit changes and push to GitHub\n\n\u003cimg src=\"Screenshot/104.png?raw=true\" width=\"700\"\u003e\n\nCopy your node IPv4 and paste in web browser \n \n\u003cimg src=\"Screenshot/105.png?raw=true\" width=\"700\"\u003e \n\nNow our chef is successfully connected to GitHub and deployment is fully automated. \u003cbr\u003e\u003cbr\u003e\n\n\nSTEP 19:- Edit Html code with your creativity and push to GitHub. Your website is automatically updated within a minute.\n\n\u003cimg src=\"Screenshot/106.png?raw=true\" width=\"700\"\u003e \n\nHTML code link - https://github.com/Rajsoni03/DevOps-Training-GGITS/blob/master/index.html\n\n\u003cimg src=\"Screenshot/107.png?raw=true\" width=\"700\"\u003e \n\nCongratulations Your Project is Successfully Automated.\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajsoni03%2Fdevops-training-ggits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajsoni03%2Fdevops-training-ggits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajsoni03%2Fdevops-training-ggits/lists"}