File tree Expand file tree Collapse file tree
labs/networking/reverse-proxy-lab Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ FROM node:24
2+
3+ WORKDIR /app
4+
5+ COPY app.js .
6+
7+ CMD ["node" , "app.js" ]
Original file line number Diff line number Diff line change 1+ const http = require ( 'http' ) ;
2+
3+ const server = http . createServer ( ( req , res ) => {
4+ res . end ( 'Hello from the backend API 🔥' ) ;
5+ } ) ;
6+
7+ server . listen ( 4000 , ( ) => {
8+ console . log ( 'Backend running on port 4000' ) ;
9+ } ) ;
Original file line number Diff line number Diff line change 1+ services :
2+ frontend :
3+ image : nginx
4+ volumes :
5+ - ./frontend:/usr/share/nginx/html
6+
7+ backend :
8+ build : ./backend
9+
10+ nginx :
11+ image : nginx
12+ ports :
13+ - ' 8080:80'
14+ volumes :
15+ - ./nginx.conf:/etc/nginx/conf.d/default.conf
16+ depends_on :
17+ - frontend
18+ - backend
Original file line number Diff line number Diff line change 1+ < h1 > Welcome to WenDev Reverse Proxy Lab 🚀</ h1 >
Original file line number Diff line number Diff line change 1+ 📦 Phase 1 — Foundations Cheat Sheet
2+
3+ resources/phase-1-foundations-cheatsheet.md
4+
5+ 🧠 Phase 1: Foundations
6+ Linux
7+ pwd
8+ ls
9+ cd
10+ mkdir
11+ rm
12+ cp
13+ mv
14+ cat
15+ bat
16+ find
17+ fd
18+ Package Management
19+ Debian / Ubuntu
20+ sudo apt update
21+ sudo apt upgrade
22+ sudo apt install nginx
23+ sudo apt remove nginx
24+ Git
25+ Create repository
26+ git init
27+ Save changes
28+ git add .
29+ git commit -m "feat: message"
30+ Push changes
31+ git push origin main
32+ Branches
33+ git checkout -b feature/auth
34+ git switch main
35+ git merge feature/auth
36+ Networking basics
37+ Application
38+ ↓
39+ Port
40+ ↓
41+ IP Address
42+ ↓
43+ Internet
44+
45+ Common ports:
46+
47+ Service Port
48+ HTTP 80
49+ HTTPS 443
50+ Node.js 3000
51+ Express 4000
52+ PostgreSQL 5432
53+ MongoDB 27017
54+ Security basics
55+ Never commit secrets.
56+ Use environment variables.
57+ Hash passwords.
58+ Validate input.
59+ Follow OWASP.
Original file line number Diff line number Diff line change 1+ 🐳 Phase 2 — Containerization Cheat Sheet
2+
3+ resources/phase-2-containerization-cheatsheet.md
4+
5+ 🐳 Phase 2: Docker
6+ Build image
7+ docker build -t my-app .
8+ List images
9+ docker images
10+ Run container
11+ docker run my-app
12+ Run with ports
13+ docker run -p 8080:3000 my-app
14+
15+ Meaning:
16+
17+ Host:8080 → Container:3000
18+ Running containers
19+ docker ps
20+ Stop container
21+ docker stop <container-id >
22+ Remove container
23+ docker rm <container-id >
24+ Remove image
25+ docker rmi my-app
26+ Dockerfile
27+ FROM node:24
28+
29+ WORKDIR /app
30+
31+ COPY . .
32+
33+ RUN npm install
34+
35+ CMD [ "npm", "start"]
36+ Docker Compose
37+ services:
38+
39+ frontend:
40+ build: ./frontend
41+
42+ backend:
43+ build: ./backend
44+
45+ database:
46+ image: postgres
47+ Container networking
48+ Browser
49+
50+ ↓
51+
52+ Host port (8080)
53+
54+ ↓
55+
56+ Container port (3000)
57+
58+ ↓
59+
60+ Application
61+ Mental model
62+ One app
63+
64+ ❌ One giant server
65+
66+ ✅ Multiple containers
67+
68+ Frontend
69+ Backend
70+ Database
71+ Redis
72+ Nginx
73+
74+ docker logs <container-id >
75+
76+ docker exec -it <container-id > bash
77+
78+ docker inspect <container-id >
79+
80+ docker network ls
81+
82+ docker network inspect <network-name >
83+
84+ docker compose up --build
85+
86+ docker compose down
Original file line number Diff line number Diff line change 1+ 🚀 Phase 3 — CI/CD Cheat Sheet
2+
3+ resources/phase-3-cicd-cheatsheet.md
4+
5+ 🚀 Phase 3: CI/CD
6+ Pipeline flow
7+ Developer pushes code
8+
9+ ↓
10+
11+ GitHub Actions
12+
13+ ↓
14+
15+ Run tests
16+
17+ ↓
18+
19+ Build application
20+
21+ ↓
22+
23+ Build Docker image
24+
25+ ↓
26+
27+ Push image to Docker Hub
28+
29+ ↓
30+
31+ Deploy
32+ GitHub Actions structure
33+ .github/
34+
35+ └── workflows/
36+
37+ └── hello.yaml
38+
39+ Basic workflow
40+ name: Node CI
41+
42+ on: push
43+
44+ jobs:
45+
46+ test:
47+
48+ runs-on: ubuntu-latest
49+
50+ steps:
51+
52+ - uses: actions/checkout@v4
53+
54+ - uses: actions/setup-node@v4
55+
56+ - run: npm install
57+
58+ - run: npm test
59+
60+ Build Docker image
61+
62+ - name: Build Docker image
63+
64+ run: |
65+ docker build -t my-app .
66+ Login to Docker Hub
67+
68+ - name: Login to Docker Hub
69+
70+ uses: docker/login-action@v3
71+
72+ with:
73+ username: ${{ secrets.DOCKER_USERNAME }}
74+ password: ${{ secrets.DOCKER_TOKEN }}
75+ Push image
76+
77+ - name: Push image
78+
79+ run: |
80+ docker tag my-app username/my-app
81+ docker push username/my-app
82+ GitHub Secrets
83+
84+ Store:
85+
86+ ✅ Docker token
87+
88+ ✅ API keys
89+
90+ ✅ Supabase keys
91+
92+ ✅ MongoDB URI
93+
94+ ✅ AWS credentials
95+
96+ ❌ Never commit secrets into Git.
97+
98+ CI vs CD
99+ CI (Continuous Integration)
100+ Push code
101+
102+ → Test
103+
104+ → Build
105+
106+ → Verify
107+ CD (Continuous Deployment)
108+ Push code
109+
110+ → Test
111+
112+ → Build
113+
114+ → Deploy automatically
115+ 🧠 Biggest lesson from Phases 1–3
116+ Code alone is not enough.
117+
118+ A real system needs:
119+
120+ Code
121+
122+ - Git
123+ - Linux
124+ - Containers
125+ - Pipelines
126+ - Deployment
127+
128+ # avoid showing
129+
130+ pwd
131+ ls
132+ tree .
133+ docker ps
134+ docker images
135+ docker network ls
136+ docker compose ps
137+ git status
138+ git log
Original file line number Diff line number Diff line change 1+ 🔐 Security Sharing Guidelines
2+ ✅ Usually safe to share
3+ pwd
4+ ls
5+ tree .
6+ docker ps
7+ docker images
8+ docker network ls
9+ docker compose ps
10+ git status
11+ git log
12+
13+ Examples:
14+
15+ Docker containers
16+ Docker images
17+ Port mappings
18+ CI/CD screenshots
19+ Git history
20+ Project structure
21+ ⚠️ Review before sharing
22+ ls -la ~
23+ tree ~
24+ find ~
25+
26+ These may expose:
27+
28+ ~ /.ssh
29+ ~ /.aws
30+ ~ /.config
31+ ~ /.git-credentials
32+ .env
33+ ❌ Never share
34+ cat ~ /.ssh/\*
35+ cat ~ /.git-credentials
36+ cat .env
37+ env
38+ printenv
39+
40+ Never expose:
41+
42+ API keys
43+ JWT secrets
44+ MongoDB URIs
45+ Supabase keys
46+ AWS credentials
47+ Docker tokens
48+ SSH private keys
You can’t perform that action at this time.
0 commit comments