Skip to content

Commit

Permalink
Merge pull request #280 from Bhavin213/master
Browse files Browse the repository at this point in the history
Day 13 to 18 Task's Answers.
  • Loading branch information
LondheShubham153 authored Jul 23, 2024
2 parents 95aa9a7 + 6aa5f60 commit 5b7bc66
Show file tree
Hide file tree
Showing 47 changed files with 614 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day13/image/12 Practice Rebase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day13/image/2 Create a new branch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day13/image/6 This is gadbad code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day13/image/9 Create 2 or more branches.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 140 additions & 0 deletions 2024/day13/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Day 13 Answers: Advance Git & GitHub for DevOps Engineers

## Git Branching

Branches are a core concept in Git that allow you to isolate development work without affecting other parts of your repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.

Branches let you develop features, fix bugs, or safely experiment with new ideas in a contained area of your repository.

## Git Revert and Reset

Git reset and git revert are two commonly used commands that allow you to remove or edit changes you’ve made in the code in previous commits. Both commands can be very useful in different scenarios.

## Git Rebase and Merge

### What Is Git Rebase?

Git rebase is a command that lets users integrate changes from one branch to another, and the commit history is modified once the action is complete. Git rebase helps keep a clean project history.

### What Is Git Merge?

Git merge is a command that allows developers to merge Git branches while keeping the logs of commits on branches intact. Even though merging and rebasing do similar things, they handle commit logs differently.

For a better understanding of Git Rebase and Merge, check out this [article](https://www.simplilearn.com/git-rebase-vs-merge-article).

## Tasks with Answers

### Task 1: Feature Development with Branches

1. **Create a Branch and Add a Feature:**
- Add a text file called `version01.txt` inside the `Devops/Git/` directory with “This is the first feature of our application” written inside.

**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/1%20Create%20a%20Branch%20and%20Add%20a%20Feature.png)

- Create a new branch from `master`.
```bash
git checkout -b dev
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/2%20Create%20a%20new%20branch.png)

- Commit your changes with a message reflecting the added feature.
```bash
git add Devops/Git/version01.txt
git commit -m "Added new feature"
```

**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/3%20Commit%20your%20changes%20with%20a%20message%20reflecting.png)

2. **Push Changes to GitHub:**
- Push your local commits to the repository on GitHub.
```bash
git push origin dev
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/4%20Push%20your%20local%20commits%20to%20the%20repository%20on%20GitHub.png)

3. **Add More Features with Separate Commits:**
- Update `version01.txt` with the following lines, committing after each change:
- 1st line: `This is the bug fix in development branch`
```bash
echo "This is the bug fix in development branch" >> Devops/Git/version01.txt
git commit -am "Added feature2 in development branch"
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/5%20This%20is%20the%20bug%20fix%20in%20development%20branch.png)

- 2nd line: `This is gadbad code`
```bash
echo "This is gadbad code" >> Devops/Git/version01.txt
git commit -am "Added feature3 in development branch"
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/6%20This%20is%20gadbad%20code.png)

- 3rd line: `This feature will gadbad everything from now`
```bash
echo "This feature will gadbad everything from now" >> Devops/Git/version01.txt
git commit -am "Added feature4 in development branch"
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/7%20This%20feature%20will%20gadbad%20everything%20from%20now.png)

4. **Restore the File to a Previous Version:**
- Revert or reset the file to where the content should be “This is the bug fix in development branch”.
```bash
git revert HEAD~2
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/8%20Restore%20the%20File%20to%20a%20Previous%20Version.png)

This command reverts the last two commits, effectively removing the "gadbad code" and "gadbad everything" lines.

### Task 2: Working with Branches

1. **Demonstrate Branches:**
- Create 2 or more branches and take screenshots to show the branch structure.

**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/9%20Create%202%20or%20more%20branches.png)

2. **Merge Changes into Master:**
- Make some changes to the `dev` branch and merge it into `master`.
```bash
git checkout master
git merge dev
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/11%20Merge%20Changes%20into%20Master_main.png)

- Screenshot of branch structure:
- To visualize the branch structure, you can use `git log` with graph options or a graphical tool like GitKraken.

**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/10%20Screenshot%20of%20branch%20structure.png)

3. **Practice Rebase:**
- Try rebasing and observe the differences.
```bash
git rebase master
```
**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day13/image/12%20Practice%20Rebase.png)

- During a rebase, Git re-applies commits from the current branch (in this case, dev) onto the target branch (master). This results in a linear commit history.

[LinkedIn](https://www.linkedin.com/in/bhavin-savaliya/)
81 changes: 81 additions & 0 deletions 2024/day14/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Day 14 Answers: Create a Linux & Git-GitHub Cheat Sheet

## Finally!! 🎉

You have completed the Linux & Git-GitHub hands-on tasks, and I hope you have learned something interesting from it. 🙌

Now, let's create an interesting 😉 assignment that will not only help you in the future but also benefit the DevOps community!

## Tasks with Answers: Create a Cheat Sheet

Let’s make a well-articulated and documented **cheat sheet** with all the commands you learned so far in Linux and Git-GitHub, along with a brief description of their usage.

Show us your knowledge mixed with your creativity 😎.

### Guidelines

- The cheat sheet should be unique and reflect your understanding.
- Include all the important commands you have learned.
- Provide a brief description of each command's usage.
- Make it visually appealing and easy to understand.

## Linux Commands / Git Commands

### File and Directory Management
- `ls` - Lists files and directories.
- `cd <directory>` - Changes the directory.
- `pwd` - Prints current directory.
- `mkdir <directory>` - Creates a new directory.
- `rm <file>` - Removes a file.
- `rm -r <directory>` - Removes a directory and its contents.
- `cp <source> <destination>` - Copies files or directories.
- `mv <source> <destination>` - Moves or renames files or directories.
- `touch <file>` - Creates or updates a file.

### Viewing and Editing Files
- `cat <file>` - Displays file content.
- `less <file>` - Views file content one screen at a time.
- `nano <file>` - Edits files using nano editor.
- `vim <file>` - Edits files using vim editor.

### System Information
- `uname -a` - Displays system information.
- `top` - Shows real-time system processes.
- `df -h` - Displays disk usage.
- `free -h` - Displays memory usage.

### Permissions
- `chmod <permissions> <file>` - Changes file permissions.
- `chown <owner>:<group> <file>` - Changes file owner and group.

### Networking
- `ping <host>` - Sends ICMP echo requests.
- `ifconfig` - Displays or configures network interfaces.

## Git Commands

### Configuration
- `git config --global user.name "Your Name"` - Sets global user name.
- `git config --global user.email "your.email@example.com"` - Sets global user email.

### Repository Management
- `git init` - Initializes a new repository.
- `git clone <repository>` - Clones a repository.

### Basic Operations
- `git status` - Shows working tree status.
- `git add <file>` - Stages changes.
- `git commit -m "message"` - Commits changes.
- `git push` - Pushes changes to remote repository.
- `git checkout -b dev` - Create a new branch from `master`.
- `git checkout` - switch to another branch and check it out into your working directory.
- `git log --oneline --graph --all` - visualize the branch structure.
- `git push origin dev` - Push Changes to GitHub.
- `git merge dev` - merge it into `master/main`.
- `git log` - show all commits in the current branch’s history.

### Reference

For your reference, check out this [cheat sheet](https://education.github.com/git-cheat-sheet-education.pdf). However, ensure that your cheat sheet is unique.

[LinkedIn](https://www.linkedin.com/in/bhavin-savaliya/)
Binary file added 2024/day15/image/Installation_Python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions 2024/day15/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Day 15 Answers: Basics of Python for DevOps Engineers

## What is Python?

Python is an open-source, general-purpose, high-level, and object-oriented programming language created by Guido van Rossum. It has a vast ecosystem of libraries and frameworks, such as Django, TensorFlow, Flask, Pandas, Keras, and many more.

## How to Install Python

### Windows Installation

1. Go to the [Python website](https://www.python.org/downloads/).
2. Download the latest version of Python.
3. Run the installer and follow the instructions.
4. Check the installation by opening a command prompt and typing:
```bash
python --version

### Ubuntu Installation
- `sudo apt-get update`
- `sudo apt-get install python3.6`

### macOS Installation

1. Download the installer from the [Python website](https://www.python.org/downloads/macos/).
2. Follow the installation instructions.
3. Check the installation by opening a terminal and typing:
- `python3 --version`

## Tasks with Answers

### Task 1:

1. Install Python on your respective OS, and check the version.

**Answer**

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day15/image/Installation_Python.png)

### 2. Read about different data types in Python.
- Python supports several data types, which can be categorized as follows:
- **Numeric Types:**
- **int:** Integer values
- `x = 10`

- **float:** Floating-point values
- `y = 10.5`

- **complex:** Complex numbers
- `z = 3 + 5j`

- **Sequence Types:**
- **str:** String values
- `name = "bhavin"`

- **list:** Ordered collection of items
- `fruits = ["apple", "banana", "cherry"]`

- **tuple:** Ordered, immutable collection of items
- `coordinates = (10.0, 20.0)`

- **Mapping Types:**
- **dict:** Key-value pairs
- `person = {"name": "bhavin", "age": 24}`

- **Set Types:**
- **set:** Unordered collection of unique items
- `unique_numbers = {1, 2, 3, 4, 5}`

- **frozenset:** Immutable set
- `frozen_numbers = frozenset([1, 2, 3, 4, 5])`

- **Boolean Type:**
- **bool:** Boolean values
- `is_active = True`

- **None Type:**
- **NoneType:** Represents the absence of a value
- `data = None`


You can get the complete playlist [here](https://www.youtube.com/watch?v=abPgj_3hzVY&list=PLlfy9GnSVerS_L5z0COaF7rsbgWmJXTOM) 🙌

**Happy Learning, Ruko Mat Phod do! 😃**

[LinkedIn](https://www.linkedin.com/in/bhavin-savaliya/)
Binary file added 2024/day16/image/1_Start_a_New_Container.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/2_docker_inspect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/3_docker_port.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/4_docker_stats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/5_docker_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/6_docker_save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2024/day16/image/7_docker_load.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions 2024/day16/solution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Day 16 Answers: Docker for DevOps Engineers

### Docker

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run, including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.

## Tasks with Answers

As you have already installed Docker in previous tasks, now is the time to run Docker commands.

### 1. Use the `docker run` command to start a new container and interact with it through the command line. [Hint: `docker run hello-world`]

**Answer**
- This command runs the `hello-world` image, which prints a message confirming that Docker is working correctly.
![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/1_Start_a_New_Container.png)

### 2. Use the `docker inspect` command to view detailed information about a container or image.

**Answer**
- View Detailed Information About a Container or Image:

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/2_docker_inspect.png)

### 3. Use the `docker port` command to list the port mappings for a container.

**Answer**
- This command maps port 8181 on the host to port 82 in the container and lists the port mappings.

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/3_docker_port.png)

### 4. Use the `docker stats` command to view resource usage statistics for one or more containers.

**Answer**
- This command provides a live stream of resource usage statistics for all running containers.

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/4_docker_stats.png)

### 5. Use the `docker top` command to view the processes running inside a container.

**Answer**
- This command lists the processes running inside the `my_container2` container.

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/5_docker_top.png)

### 6. Use the `docker save` command to save an image to a tar archive.

**Answer**
- This command saves the `nginx` image to a tar archive named `my_image.tar`.

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/6_docker_save.png)

### 7. Use the `docker load` command to load an image from a tar archive.

**Answer**
- This command loads the image from the `my_image.tar` archive into Docker.

![image](https://github.com/Bhavin213/90DaysOfDevOps/blob/master/2024/day16/image/7_docker_load.png)

These tasks involve simple operations that can be used to manage images and containers.

For reference, you can watch this video: [Docker Tutorial on AWS EC2 as DevOps Engineer // DevOps Project Bootcamp Day 2](https://youtu.be/Tevxhn6Odc8).

[LinkedIn](https://www.linkedin.com/in/bhavin-savaliya/)
Loading

0 comments on commit 5b7bc66

Please sign in to comment.