DevOps là gì?
DevOps là sự kết hợp của Development (Phát triển) và Operations (Vận hành). Đây không chỉ là một công cụ hay công nghệ, mà là một văn hóa, triết lý giúp các team phát triển phần mềm và vận hành hệ thống làm việc cùng nhau hiệu quả hơn.
Tại sao DevOps ra đời?
Trước DevOps, Development và Operations thường hoạt động riêng biệt:
| Traditional | DevOps |
|---|---|
| Dev viết code, “ném” cho Ops | Dev và Ops cùng làm việc |
| Blame game khi có lỗi | Shared responsibility |
| Deploy mỗi tháng/quý | Deploy hàng ngày |
| Manual processes | Automation mọi thứ |
💡 DevOps giải quyết vấn đề: “Nó hoạt động trên máy tôi!” - câu nói kinh điển khi Dev và Ops không sync với nhau.
DevOps Lifecycle (Vòng đời DevOps)
DevOps là một quy trình liên tục, không có điểm kết thúc:
┌─────────────────────────────────────────────────────────┐
│ DEVOPS LIFECYCLE │
├─────────────────────────────────────────────────────────┤
│ │
│ ┌──────┐ ┌──────┐ ┌───────┐ ┌────────┐ │
│ │ PLAN │ → │ CODE │ → │ BUILD │ → │ TEST │ │
│ └──────┘ └──────┘ └───────┘ └────────┘ │
│ ↑ ↓ │
│ │ CONTINUOUS │ │
│ │ INTEGRATION │ │
│ │ ↓ │
│ ┌──────────┐ ┌─────────┐ ┌────────────┐ │
│ │ MONITOR │ ← │ OPERATE │ ← │ DEPLOY │ │
│ └──────────┘ └─────────┘ └────────────┘ │
│ │
│ CONTINUOUS DELIVERY │
└─────────────────────────────────────────────────────────┘
8 Phases của DevOps
- Plan - Lập kế hoạch features, tasks
- Code - Viết code, version control (Git)
- Build - Compile, tạo artifacts
- Test - Unit tests, integration tests
- Release - Prepare cho deployment
- Deploy - Triển khai lên production
- Operate - Vận hành hệ thống
- Monitor - Theo dõi performance, logs
Nguyên tắc cốt lõi của DevOps
1. CALMS Framework
| Nguyên tắc | Mô tả |
|---|---|
| Culture | Văn hóa hợp tác, không đổ lỗi |
| Automation | Tự động hóa mọi thứ có thể |
| Lean | Loại bỏ lãng phí, cải tiến liên tục |
| Measurement | Đo lường mọi thứ |
| Sharing | Chia sẻ kiến thức, công cụ |
2. Three Ways
┌─────────────────────────────────────────────────┐
│ First Way: FLOW Dev → Ops │
│ Second Way: FEEDBACK Dev ← Ops │
│ Third Way: CONTINUOUS LEARNING │
└─────────────────────────────────────────────────┘
CI/CD - Trái tim của DevOps
Continuous Integration (CI)
Developers merge code thường xuyên (nhiều lần/ngày) và tự động build + test:
# Ví dụ CI workflow
1. Developer push code lên Git
2. CI server (Jenkins/GitHub Actions) tự động:
- Pull code
- Build project
- Run tests
- Thông báo kết quả
Continuous Delivery/Deployment (CD)
- Continuous Delivery: Code luôn sẵn sàng để deploy (manual approval)
- Continuous Deployment: Tự động deploy lên production
DevOps Tools Landscape
Version Control
- Git - Essential, không có thay thế
- GitHub/GitLab/Bitbucket - Hosting và collaboration
CI/CD
- GitHub Actions - Tích hợp sẵn với GitHub
- Jenkins - Open source, linh hoạt
- GitLab CI - Tích hợp trong GitLab
Containerization
- Docker - Container runtime phổ biến nhất
- Podman - Alternative không cần daemon
Container Orchestration
- Kubernetes - Container orchestration tiêu chuẩn
- AWS ECS/EKS - Managed container services
Infrastructure as Code
- Terraform - Multi-cloud IaC
- AWS CloudFormation - AWS native IaC
- Pulumi - IaC với programming languages
Configuration Management
- Ansible - Agentless, dễ học
- Chef/Puppet - Enterprise solutions
Monitoring & Logging
- Prometheus + Grafana - Metrics và visualization
- AWS CloudWatch - AWS native monitoring
- ELK Stack - Logging solution
Cloud DevOps - Tương lai của DevOps
Cloud DevOps kết hợp DevOps practices với Cloud Computing:
Lợi ích của Cloud DevOps
| Benefit | Description |
|---|---|
| Scalability | Scale up/down theo nhu cầu |
| Cost Efficiency | Pay-as-you-go |
| Global Reach | Deploy worldwide |
| Managed Services | Ít quản lý infrastructure |
AWS Services cho DevOps
┌──────────────────────────────────────────────────┐
│ AWS DevOps Services │
├──────────────────────────────────────────────────┤
│ CodeCommit → Git repository │
│ CodeBuild → Build service │
│ CodeDeploy → Deployment service │
│ CodePipeline→ CI/CD orchestration │
│ CloudWatch → Monitoring & Logging │
│ ECS/EKS → Container orchestration │
│ Lambda → Serverless compute │
└──────────────────────────────────────────────────┘
DevOps Engineer Skills
Kỹ năng kỹ thuật
Essential Skills (Cần có):
├── Linux/Unix administration
├── Scripting (Bash, Python)
├── Git version control
├── CI/CD pipelines
├── Docker containers
└── Cloud platform (AWS/Azure/GCP)
Advanced Skills (Nâng cao):
├── Kubernetes
├── Infrastructure as Code
├── Monitoring & Observability
├── Security (DevSecOps)
└── Networking
Kỹ năng mềm
- Communication - Làm việc với Dev và Ops
- Problem-solving - Debug production issues
- Automation mindset - “Automate everything”
- Continuous learning - Tech thay đổi liên tục
DevOps vs Related Roles
| Role | Focus |
|---|---|
| DevOps Engineer | CI/CD, automation, infrastructure |
| SRE (Site Reliability Engineer) | Reliability, SLOs/SLIs, incident response |
| Platform Engineer | Internal developer platform |
| Cloud Engineer | Cloud infrastructure |
Lộ trình học DevOps
Tháng 1-2: Fundamentals
- Linux command line
- Git version control
- Networking basics
Tháng 3-4: Containerization
- Docker
- Docker Compose
- Container registries
Tháng 5-6: CI/CD & IaC
- GitHub Actions/Jenkins
- Terraform
- Ansible
Tháng 7-8: Cloud & Orchestration
- AWS/Azure/GCP
- Kubernetes basics
- Monitoring
Thực hành: Setup môi trường DevOps
1. Cài đặt Git
# macOS
brew install git
# Ubuntu
sudo apt update && sudo apt install git
# Cấu hình
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
2. Cài đặt Docker
# macOS - Tải Docker Desktop từ docker.com
# Ubuntu
sudo apt update
sudo apt install docker.io
sudo usermod -aG docker $USER
# Logout và login lại
# Kiểm tra
docker --version
docker run hello-world
3. Tạo GitHub Account
Truy cập github.com và tạo account miễn phí.
DevOps Metrics (DORA Metrics)
Google nghiên cứu và định nghĩa 4 key metrics:
| Metric | Elite | High | Medium | Low |
|---|---|---|---|---|
| Deployment Frequency | Multiple/day | Weekly | Monthly | < Monthly |
| Lead Time for Changes | < 1 hour | < 1 week | < 1 month | > 1 month |
| Time to Restore Service | < 1 hour | < 1 day | < 1 week | > 1 week |
| Change Failure Rate | 0-15% | 16-30% | 31-45% | > 45% |
Bước tiếp theo
- ✅ Hiểu DevOps là gì và tại sao cần thiết
- ✅ Biết DevOps lifecycle và nguyên tắc
- 📖 Học Git - Version Control cơ bản
- 🚀 Tìm hiểu CI/CD Pipeline
💡 Pro tip: DevOps là journey, không phải destination. Bắt đầu từ việc nhỏ - automate một task bạn làm hàng ngày!
Bài tiếp theo: Version Control với Git - Nền tảng của mọi DevOps workflow.