Skip to content

Commit afc70ad

Browse files
authored
Merge pull request #225 from codeharborhub/dev-1
added new docs for devops-beg... doc
2 parents 03bf927 + 0fd2145 commit afc70ad

File tree

7 files changed

+432
-0
lines changed

7 files changed

+432
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
sidebar_position: 1
3+
title: "What is DevOps?"
4+
sidebar_label: "1. Introduction"
5+
description: "Start your journey into the world of DevOps. Learn the culture, the lifecycle, and why it is the backbone of modern software engineering."
6+
---
7+
8+
Welcome to the **DevOps for Absolute Beginners** track! If you've ever wondered how companies like Google, Netflix, or Amazon deploy code thousands of times a day without breaking their websites, the answer is **DevOps**.
9+
10+
## 🧐 What exactly is DevOps?
11+
12+
The word "DevOps" is a combination of **Development** (Dev) and **Operations** (Ops).
13+
14+
Historically, developers wrote code and "threw it over the wall" to the operations team to run it. If it broke, the teams would blame each other. DevOps breaks down this wall, creating a shared responsibility for the entire lifecycle of an application.
15+
16+
### The 3 Pillars of DevOps:
17+
1. **Culture:** Collaboration between teams instead of silos.
18+
2. **Automation:** Replacing manual, repetitive tasks with code (Scripts, CI/CD).
19+
3. **Measurement:** Using data and monitoring to improve performance and reliability.
20+
21+
## The DevOps Roadmap
22+
23+
In this path at **CodeHarborHub**, we aren't just learning tools; we are learning how to build a "Software Factory." We will cover:
24+
25+
* **Programming for DevOps:** Using Python, Go, and JS to automate tasks.
26+
* **Linux Foundations:** Mastering the command line (the home of DevOps).
27+
* **Containers & Orchestration:** Learning Docker and Kubernetes.
28+
* **CI/CD Pipelines:** Automating the journey from code to production.
29+
* **Cloud Computing:** Managing infrastructure on AWS, Azure, or GCP.
30+
31+
## Why Learn DevOps?
32+
33+
* **High Demand:** DevOps Engineers are among the highest-paid roles in tech.
34+
* **Speed:** Help teams move from "one release per month" to "one release per hour."
35+
* **Reliability:** Build systems that automatically fix themselves when they crash.
36+
37+
## Explore the Modules
38+
39+
Click on any of the modules below to start your DevOps journey:
40+
41+
<DocCardList />
42+
43+
:::tip
44+
DevOps is a marathon, not a sprint. Don't worry about mastering every tool at once. Focus on understanding the **process** first, and the tools will follow naturally!
45+
:::
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Programming Language",
3+
"position": 2,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Master the 'Trinity' of DevOps coding: Python for automation, Go for cloud-native tooling, and JavaScript for serverless and CI/CD workflows."
7+
}
8+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
sidebar_position: 5
3+
title: "Choosing the Right Tool"
4+
sidebar_label: "5. Which Language?"
5+
description: "Learn how to decide between Python, Go, and JavaScript for your DevOps tasks and infrastructure automation."
6+
---
7+
8+
In the **CodeHarborHub** DevOps journey, you've now seen the "Big Three": **Python**, **Go**, and **JavaScript**. But in a real production environment, you will often face a choice: "Which one should I use for this task?"
9+
10+
Choosing the wrong language can lead to slow deployments, hard-to-maintain scripts, or "dependency hell" on your servers.
11+
12+
## The Decision Matrix
13+
14+
Use this quick reference guide to pick your weapon based on the task:
15+
16+
| If the task is... | Use this language | Because... |
17+
| :--- | :--- | :--- |
18+
| **Cloud Automation** (AWS/GCP) | **Python** | Boto3 and Cloud SDKs are most mature in Python. |
19+
| **High-Performance CLI** | **Go** | Fast execution and single-binary deployment. |
20+
| **CI/CD Pipelines** | **JavaScript** | Native support in GitHub Actions and fast startup. |
21+
| **System Administration** | **Python** | Pre-installed on Linux; great for file/OS manipulation. |
22+
| **Infrastructure as Code** | **TypeScript** | AWS CDK and Pulumi have excellent TS support. |
23+
| **Kubernetes Tooling** | **Go** | Native integration with the K8s API. |
24+
25+
## Deep Dive: Three Common Scenarios
26+
27+
### Scenario A: The "One-Off" Cleanup Script
28+
* **Task:** You need a script that runs every night to delete temp files older than 30 days.
29+
* **Winner:** **Python**.
30+
* **Reason:** You can write this in 10 lines of code. It doesn't need to be fast, and you don't need to compile it. It’s "Quick and Dirty."
31+
32+
### Scenario B: The Team-Wide CLI Tool
33+
* **Task:** You are building a tool that all 50 developers in your company will use to "spin up" local dev environments.
34+
* **Winner:** **Go**.
35+
* **Reason:** You don't want to help 50 people debug their Python versions or Node installations. You just want to give them one binary file that "just works."
36+
37+
### Scenario C: The Deployment Pipeline
38+
* **Task:** You need to write a custom check that runs every time someone pushes code to GitHub to verify their documentation.
39+
* **Winner:** **JavaScript**.
40+
* **Reason:** GitHub Actions run in a Node.js environment by default. Using JS makes the pipeline start 5x faster than pulling a heavy Python image.
41+
42+
## The "CodeHarborHub" Rule of Thumb
43+
44+
When in doubt, follow this hierarchy of choice:
45+
46+
1. **Can I do it in Bash?** If it’s 3 lines or less, use a Shell script.
47+
2. **Is it for AWS/Automation?** Use **Python**.
48+
3. **Does it need to be shared as a Tool?** Use **Go**.
49+
4. **Is it for a Pipeline or Lambda?** Use **JavaScript**.
50+
51+
## Moving Beyond the Code
52+
53+
Remember: As a DevOps Engineer, your goal is **less code, more automation.** Before you start writing a 500-line Python script, ask yourself: *"Does a tool like Terraform, Ansible, or a GitHub Action already do this for me?"*
54+
55+
The best DevOps code is the code you **didn't** have to write.
56+
57+
## Summary Checklist
58+
* [x] I can explain the strengths of Python, Go, and JS.
59+
* [x] I understand when to prioritize a "Single Binary" (Go) over a "Script" (Python).
60+
* [x] I know that JavaScript is the best choice for Pipeline-specific logic.
61+
* [x] I understand that "Idempotency" and "Simplicity" are more important than the language choice.
62+
63+
:::success Programming Module Complete!
64+
You have successfully mastered the "Trinity" of DevOps programming. You are no longer just a coder; you are an **Automation Architect**.
65+
:::
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
sidebar_position: 3
3+
title: "Go: The Language of the Cloud"
4+
sidebar_label: "3. Go for Cloud Tooling"
5+
description: "Learn why Docker, Kubernetes, and Terraform are built in Go, and how it differs from Python for DevOps."
6+
---
7+
8+
If Python is the "Swiss Army Knife" of DevOps, **Go** is the "Industrial Power Tool." While Python is great for quick scripts, **Go** is used to build the massive platforms that run the modern internet (Docker, Kubernetes, Terraform, and Prometheus).
9+
10+
## Why Go for DevOps?
11+
12+
As a DevOps Engineer at **CodeHarborHub**, you will eventually hit a limit with Python. Go solves three major problems:
13+
14+
### 1. Static Binaries (The "Zero Dependency" Rule)
15+
In Python, to run a script on a server, you must install Python, pip, and all your libraries (`requirements.txt`).
16+
In **Go**, you "compile" your code into a single, standalone file (a Binary). You can drop that file onto a bare Linux server, and it will run instantly with **zero** installation.
17+
18+
### 2. High Performance & Concurrency
19+
Go was designed at Google to handle thousands of tasks at once. Its "Goroutines" allow you to perform massive infrastructure tasks (like checking the health of 5,000 servers) in parallel without crashing.
20+
21+
### 3. Type Safety
22+
Go is "Statically Typed." This means if you try to pass a `String` where a `Number` is expected, the code won't even compile. This prevents 50% of the bugs that usually happen in Python scripts at 3:00 AM.
23+
24+
## Go vs. Python: When to switch?
25+
26+
| Feature | Python | Go (Golang) |
27+
| :--- | :--- | :--- |
28+
| **Speed** | Slower (Interpreted) | Very Fast (Compiled) |
29+
| **Deployment** | Needs Runtime/Env | Single Binary file |
30+
| **Concurrency** | Complex (GIL) | Built-in (Goroutines) |
31+
| **Best For** | Data, AI, Simple Scripts | CLI Tools, Microservices |
32+
33+
## Building a Simple CLI Tool
34+
35+
In DevOps, we often build **CLI (Command Line Interface)** tools. Here is a simple Go tool that checks if a website is up.
36+
37+
```go
38+
package main
39+
40+
import (
41+
"fmt"
42+
"net/http"
43+
"time"
44+
)
45+
46+
func main() {
47+
url := "https://codeharborhub.github.io"
48+
49+
// Perform an HTTP GET request
50+
resp, err := http.Get(url)
51+
52+
if err != nil {
53+
fmt.Printf("❌ Error: %s is down!\n", url)
54+
return
55+
}
56+
57+
if resp.StatusCode == 200 {
58+
fmt.Printf("✅ Success: %s is healthy (Status 200)\n", url)
59+
} else {
60+
fmt.Printf("⚠️ Warning: %s returned status %d\n", url, resp.StatusCode)
61+
}
62+
}
63+
```
64+
65+
### To "Ship" this tool:
66+
67+
You run `go build -o health-check`. You now have a file called `health-check` that you can send to any teammate, and it will work\!
68+
69+
## The Ecosystem: "The Go Stack"
70+
71+
Almost every major DevOps tool you will use at **CodeHarborHub** is written in Go:
72+
73+
* **Docker:** The container engine.
74+
* **Kubernetes (K8s):** The container orchestrator.
75+
* **Terraform:** Infrastructure as Code.
76+
* **Hugo:** The static site generator (Faster than Docusaurus\!).
77+
* **Prometheus:** Monitoring and alerting.
78+
79+
## Summary Checklist
80+
81+
* [x] I understand that Go compiles to a **Single Binary**.
82+
* [x] I know that Go is much faster than Python for heavy tasks.
83+
* [x] I can explain why "Static Typing" helps prevent bugs.
84+
* [x] I recognize that major DevOps tools (Docker/K8s) are built in Go.
85+
86+
:::tip
87+
Don't be intimidated by Go's syntax! It is much simpler than C++ or Java. Most DevOps engineers learn just enough Go to build custom CLI tools or contribute small fixes to open-source projects like Terraform providers.
88+
:::
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
sidebar_position: 1
3+
title: "Coding for DevOps: The Scripting Mindset"
4+
sidebar_label: "1. Intro to DevOps Coding"
5+
description: "Learn the difference between Software Development and DevOps Scripting, and why the Trinity of Python, Go, and JS is essential."
6+
---
7+
8+
In the **Backend Development** path, you learned to write code for humans (APIs, Websites). In the **DevOps** path, you will learn to write code for **machines**.
9+
10+
As a DevOps Engineer at **CodeHarborHub**, your code acts as the "glue" that connects your source code, your servers, and your cloud providers.
11+
12+
## 🧐 Software Engineering vs. DevOps Scripting
13+
14+
What's the difference? It's all about the **Goal**.
15+
16+
| Feature | Software Engineering (Dev) | DevOps Coding (Ops) |
17+
| :--- | :--- | :--- |
18+
| **Target** | End Users (Customers) | Machines & Infrastructure |
19+
| **Output** | Applications / Features | Scripts / Automation / Tools |
20+
| **Focus** | User Experience (UX) | Reliability & Scalability |
21+
| **Execution** | Long-running (Servers) | Task-oriented (Jobs/Pipelines) |
22+
23+
## The "DevOps Trinity"
24+
25+
At **CodeHarborHub**, we focus on three specific languages. Each one has a unique "superpower" in the DevOps lifecycle.
26+
27+
<Tabs>
28+
<TabItem value="python" label="Python (The Glue)" default>
29+
**Why?** It's pre-installed on Linux and has the best libraries for AWS (`boto3`) and Data.
30+
**Best for:** Automation scripts, cron jobs, and AI-Ops.
31+
</TabItem>
32+
<TabItem value="go" label="Go (The Engine)">
33+
**Why?** It's fast and compiles to a single binary. It's what Docker and Kubernetes are built with.
34+
**Best for:** High-performance CLI tools and Cloud-native infrastructure.
35+
</TabItem>
36+
<TabItem value="js" label="JavaScript (The Pipe)">
37+
**Why?** It's the native language of GitHub Actions and Serverless functions (AWS Lambda).
38+
**Best for:** CI/CD workflows and Infrastructure as Code (CDK).
39+
</TabItem>
40+
</Tabs>
41+
42+
## Core Concepts for DevOps Coders
43+
44+
To be successful in this path, you must master these three patterns:
45+
46+
### 1. The CLI Pattern (Input/Output)
47+
Your scripts should take arguments (like `--env production`) and provide clear output (like `Success: Server Restarted`).
48+
49+
### 2. Idempotency (The "Safety" Rule)
50+
In DevOps, an **Idempotent** script is one that can be run 100 times but only makes a change the *first* time.
51+
* **Bad Script:** Adds a new line to a file every time it runs.
52+
* **Good Script:** Checks if the line exists first, and only adds it if it's missing.
53+
54+
### 3. Error Handling (The "Graceful" Failure)
55+
If a DevOps script fails halfway through, it could leave a server in a "broken" state. Your code must handle timeouts and network errors gracefully.
56+
57+
## Summary Checklist
58+
* [x] I understand that DevOps coding focuses on automation and tools.
59+
* [x] I can explain why Python, Go, and JS are the preferred languages.
60+
* [x] I understand the concept of **Idempotency**.
61+
* [x] I know that my "users" are often other scripts or CI/CD pipelines.
62+
63+
:::tip
64+
You don't need to be a "Master" of all three languages. Most DevOps engineers at **CodeHarborHub** are "Expert" in one (usually Python) and "Proficient" in the others. Pick one to start, and the rest will follow!
65+
:::
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
sidebar_position: 4
3+
title: "JavaScript: Pipelines & Serverless"
4+
sidebar_label: "4. JS for DevOps"
5+
description: "Learn why JavaScript is essential for GitHub Actions, AWS CDK, and modern Serverless DevOps."
6+
---
7+
8+
If you come from a **Full-Stack** background at **CodeHarborHub**, you already have a DevOps superpower. JavaScript isn't just for building UI; it is the native language of the modern "Automation Pipeline."
9+
10+
## Where does JS fit in DevOps?
11+
12+
In the DevOps world, JavaScript (and its safer brother, **TypeScript**) is used in three critical areas:
13+
14+
### 1. GitHub Actions (CI/CD)
15+
GitHub is the home of your code. **GitHub Actions** is the engine that tests and deploys that code. Almost all custom GitHub Actions are written in Node.js because it starts instantly and has a massive library ecosystem (NPM).
16+
17+
### 2. AWS CDK (Infrastructure as Code)
18+
Instead of writing messy YAML or JSON files to define your servers, the **AWS Cloud Development Kit (CDK)** lets you define your entire infrastructure using TypeScript classes.
19+
* *Example:* `new s3.Bucket(this, 'MyDevOpsBucket');`
20+
21+
### 3. Serverless Functions (AWS Lambda)
22+
When you need a tiny piece of code to run in response to an event (like a file being uploaded), **Node.js** is the most popular choice because of its "Event-Driven" nature.
23+
24+
## Building a GitHub Action (Scripting)
25+
26+
One common DevOps task is to automatically label Pull Requests or check for "TODO" comments. Here is a simple Node.js script that a DevOps engineer might run inside a CI/CD pipeline:
27+
28+
```javascript
29+
const fs = require('fs');
30+
31+
// A DevOps script to scan for "TODO" comments in the codebase
32+
const files = fs.readdirSync('./src');
33+
34+
files.forEach(file => {
35+
const content = fs.readFileSync(`./src/${file}`, 'utf8');
36+
if (content.includes('TODO:')) {
37+
console.warn(`⚠️ Warning: ${file} contains unfinished tasks!`);
38+
// In a real pipeline, we might fail the build here
39+
// process.exit(1);
40+
}
41+
});
42+
```
43+
44+
## Why JS over Python or Go?
45+
46+
| Feature | JavaScript (Node.js) | Python / Go |
47+
| :--- | :--- | :--- |
48+
| **Eco-system** | Largest (NPM) | Large / Growing |
49+
| **Speed** | Fast (Event Loop) | Slower / Faster |
50+
| **Cloud Native** | Best for Lambda/Actions | Great for Automation/CLI |
51+
| **Integration** | Native to Web/GitHub | Needs 3rd Party Wrappers |
52+
53+
## The DevOps JS Toolbox
54+
55+
As a DevOps engineer at **CodeHarborHub**, you should be familiar with these JS-based tools:
56+
57+
* **zx:** A library by Google that makes writing shell scripts in JavaScript as easy as writing them in Bash.
58+
* **Puppeteer:** Used for "Synthetic Monitoring" (Simulating a user clicking through your site to make sure it's not down).
59+
* **Pulumi:** An alternative to Terraform that lets you manage infrastructure using standard JavaScript.
60+
61+
## Summary Checklist
62+
63+
* [x] I understand that JS is the primary language for **GitHub Actions**.
64+
* [x] I know that **TypeScript** is preferred for Infrastructure as Code (CDK).
65+
* [x] I can explain why Node.js is a great fit for **Serverless** (Lambda).
66+
* [x] I understand that JS allows Frontend and DevOps teams to speak the same language.
67+
68+
:::tip
69+
If you are already a JavaScript developer, don't switch to Python immediately\! Start your DevOps journey by writing **GitHub Actions** and **AWS CDK** scripts in TypeScript. You’ll be surprised how much infrastructure you can manage with the skills you already have.
70+
:::

0 commit comments

Comments
 (0)