Skip to content

Commit 772682a

Browse files
authored
Merge pull request #40 from wendev27/monitoring-and-observability
[Checkpoint 25] Add Prometheus, Grafana, Alerts, and Observability Labs
2 parents b5c032d + 2967f5d commit 772682a

4 files changed

Lines changed: 435 additions & 5 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ This repository was created to:
115115

116116
### Optional Advanced Topics
117117

118-
- [ ] Alerting fundamentals
119-
- [ ] Grafana alerts
120-
- [ ] Alert rules and thresholds
121-
- [ ] Notification channels
122-
- [ ] Incident response basics
118+
- [x] Alerting fundamentals
119+
- [x] Grafana alerts
120+
- [x] Alert rules and thresholds
121+
- [x] Notification channels (conceptually)
122+
- [x] Incident response basics (conceptually)
123123

124124
---
125125

Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
# 🌐 Checkpoint 20 — HTTPS and SSL Certificates
2+
3+
## 🎯 Objective
4+
5+
Understand how modern web applications securely communicate over the internet using HTTPS and SSL certificates.
6+
7+
This checkpoint focused on answering an important question:
8+
9+
> "How does a browser know that a website is authentic and secure?"
10+
11+
To answer that question, I explored:
12+
13+
- Nginx reverse proxies
14+
- HTTP and HTTPS
15+
- SSL certificates
16+
- Self-signed certificates
17+
- Certificate Authorities
18+
- Let's Encrypt
19+
- Automatic certificate renewal
20+
21+
---
22+
23+
# 📚 Topics Covered
24+
25+
- Nginx
26+
- Reverse Proxy
27+
- HTTP vs HTTPS
28+
- SSL Certificates
29+
- Self-signed certificates
30+
- Certificate Authorities (CA)
31+
- Let's Encrypt
32+
- Certbot
33+
- Automatic certificate renewal
34+
35+
---
36+
37+
# 🤔 Questions Explored
38+
39+
- How does Nginx route traffic to different services?
40+
- Why do applications use reverse proxies?
41+
- What is the difference between HTTP and HTTPS?
42+
- Why does Chrome trust Google but not localhost?
43+
- What is an SSL certificate?
44+
- Why are private keys secret?
45+
- Who issues trusted certificates?
46+
- How are certificates renewed in production?
47+
48+
---
49+
50+
# 🔬 Labs and Experiments
51+
52+
## Reverse Proxy Lab
53+
54+
Created:
55+
56+
```text
57+
labs/networking/reverse-proxy-lab/
58+
```
59+
60+
Project structure:
61+
62+
```text
63+
reverse-proxy-lab/
64+
├── backend/
65+
│ ├── app.js
66+
│ └── Dockerfile
67+
├── frontend/
68+
│ └── index.html
69+
├── ssl/
70+
│ ├── nginx.crt
71+
│ └── nginx.key
72+
├── compose.yaml
73+
├── nginx.conf
74+
└── README.md
75+
```
76+
77+
---
78+
79+
## Backend Service
80+
81+
Created a simple Node.js API:
82+
83+
```javascript
84+
const http = require('http');
85+
86+
const server = http.createServer((req, res) => {
87+
res.end('Hello from the backend API 🔥');
88+
});
89+
90+
server.listen(4000, () => {
91+
console.log('Backend running on port 4000');
92+
});
93+
```
94+
95+
---
96+
97+
## Nginx Reverse Proxy
98+
99+
Configured Nginx to route requests:
100+
101+
```nginx
102+
server {
103+
listen 80;
104+
105+
location / {
106+
proxy_pass http://frontend:80;
107+
}
108+
109+
location /api {
110+
proxy_pass http://backend:4000;
111+
}
112+
}
113+
```
114+
115+
Traffic flow:
116+
117+
```text
118+
Browser
119+
120+
Nginx
121+
122+
Frontend (/)
123+
124+
Browser
125+
126+
Nginx
127+
128+
Backend (/api)
129+
```
130+
131+
---
132+
133+
## HTTPS Configuration
134+
135+
Configured HTTPS using a self-signed SSL certificate:
136+
137+
```nginx
138+
server {
139+
listen 80;
140+
141+
return 301 https://localhost:8443$request_uri;
142+
}
143+
144+
server {
145+
listen 443 ssl;
146+
147+
ssl_certificate /etc/nginx/ssl/nginx.crt;
148+
ssl_certificate_key /etc/nginx/ssl/nginx.key;
149+
150+
location / {
151+
proxy_pass http://frontend:80;
152+
}
153+
154+
location /api {
155+
proxy_pass http://backend:4000;
156+
}
157+
}
158+
```
159+
160+
---
161+
162+
## SSL Certificate Generation
163+
164+
Generated local certificates using OpenSSL:
165+
166+
```bash
167+
openssl req -x509 -nodes -days 365 \
168+
-newkey rsa:2048 \
169+
-keyout ssl/nginx.key \
170+
-out ssl/nginx.crt
171+
```
172+
173+
Learned:
174+
175+
- `nginx.crt` contains the public certificate.
176+
- `nginx.key` contains the private key.
177+
- Private keys should never be committed to Git.
178+
179+
---
180+
181+
## Browser Security Warning
182+
183+
Observed the browser warning:
184+
185+
```text
186+
NET::ERR_CERT_AUTHORITY_INVALID
187+
```
188+
189+
Learned that:
190+
191+
- HTTPS encryption was working.
192+
- The browser could not verify the certificate issuer.
193+
- Self-signed certificates are not trusted by browsers.
194+
195+
---
196+
197+
## Certificate Authorities
198+
199+
Explored trusted Certificate Authorities:
200+
201+
- Let's Encrypt
202+
- DigiCert
203+
- Sectigo
204+
- GlobalSign
205+
206+
Learned that browsers trust websites because Certificate Authorities verify domain ownership and sign certificates.
207+
208+
---
209+
210+
## Automatic Certificate Renewal
211+
212+
Learned that production environments commonly use:
213+
214+
```text
215+
Nginx + Certbot + Let's Encrypt
216+
```
217+
218+
to automatically renew certificates every 90 days.
219+
220+
---
221+
222+
# 🧠 Key Concepts
223+
224+
## Reverse Proxy
225+
226+
A reverse proxy receives incoming traffic and forwards requests to the correct service.
227+
228+
Example:
229+
230+
```text
231+
localhost:8443/
232+
233+
Frontend container
234+
235+
localhost:8443/api
236+
237+
Backend container
238+
```
239+
240+
---
241+
242+
## HTTPS
243+
244+
HTTPS encrypts communication between the browser and the server.
245+
246+
```text
247+
Browser
248+
249+
Encrypted connection 🔒
250+
251+
Server
252+
```
253+
254+
---
255+
256+
## SSL Certificate
257+
258+
An SSL certificate proves the identity of a website.
259+
260+
```text
261+
Certificate (.crt)
262+
```
263+
264+
---
265+
266+
## Private Key
267+
268+
The private key is used to decrypt encrypted traffic.
269+
270+
```text
271+
Private Key (.key)
272+
```
273+
274+
Private keys must remain secret.
275+
276+
---
277+
278+
## Certificate Authority
279+
280+
Certificate Authorities verify ownership of domains and sign certificates that browsers trust.
281+
282+
---
283+
284+
# 💭 Reflection
285+
286+
Before this checkpoint, HTTPS felt like a feature that browsers automatically provided.
287+
288+
After building a reverse proxy and generating my own SSL certificates, I now understand that HTTPS depends on trust relationships between browsers, Certificate Authorities, reverse proxies, and servers.
289+
290+
I also learned that encryption and trust are different concepts:
291+
292+
- Encryption protects data.
293+
- Certificates verify identity.
294+
295+
Modern platforms such as Vercel, GitHub, and Google automate these processes, but the underlying infrastructure follows the same principles.
296+
297+
---
298+
299+
# 🚀 Next Checkpoint
300+
301+
☁️ Phase 6 — Cloud & Orchestration
302+
303+
Upcoming topics:
304+
305+
- Kubernetes
306+
- Pods
307+
- Deployments
308+
- Services
309+
- Ingress
310+
- Scaling
311+
- Cloud infrastructure
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Checkpoint 25 — Monitoring & Observability
2+
3+
## Completed
4+
5+
- [x] Application health checks
6+
- [x] Structured logging fundamentals
7+
- [x] Metrics collection with Prometheus
8+
- [x] Grafana dashboard creation
9+
- [x] Prometheus ↔ Grafana integration
10+
- [x] CPU monitoring
11+
- [x] Memory monitoring
12+
- [x] HTTP request monitoring
13+
- [x] Custom application metrics
14+
- [x] Alert rule creation
15+
- [x] Alert thresholds
16+
- [x] Alert state testing
17+
- [x] Container observability fundamentals
18+
- [x] Incident investigation workflow
19+
20+
---
21+
22+
## Learned Conceptually
23+
24+
- [x] Notification channels (Discord, Slack, Email, PagerDuty)
25+
- [x] Incident response basics
26+
- [x] On-call alert flow
27+
- [x] Escalation workflows
28+
29+
---
30+
31+
## Key Takeaways
32+
33+
- Metrics tell you what is happening.
34+
- Logs help explain why it happened.
35+
- Alerts notify humans when action is needed.
36+
- Dashboards provide visibility into system health.
37+
- Containers are ephemeral; persistent data requires volumes.
38+
- Monitoring is useful only when someone receives and acts on alerts.
39+
40+
---
41+
42+
## Architecture
43+
44+
Application
45+
46+
Prometheus
47+
48+
Grafana
49+
50+
Alerts
51+
52+
Notification Channels
53+
54+
Engineers

0 commit comments

Comments
 (0)