Skip to content

Commit 4a0b391

Browse files
alanopsclaude
andcommitted
Initial commit: DevOps Learning Platform
- Set up Next.js frontend with TypeScript and Tailwind CSS - Implemented WebSocket backend for terminal sessions - Created interactive scenario selection interface - Built Docker-based isolated environments for practice - Added first scenarios: Keycloak CrashLoopBackOff and Terraform Drift - Configured CI/CD pipeline with GitHub Actions - Added comprehensive documentation and setup instructions Features: - Browser-based terminal using xterm.js - Real-time scenario execution in Docker containers - Progressive hint system - Multiple scenario categories (Kubernetes, Terraform, etc.) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2a78996 commit 4a0b391

33 files changed

Lines changed: 2058 additions & 1 deletion

.env.example

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Frontend Configuration
2+
NEXT_PUBLIC_WS_URL=http://localhost:3001
3+
4+
# Backend Configuration
5+
PORT=3001
6+
FRONTEND_URL=http://localhost:3000
7+
8+
# Database Configuration
9+
POSTGRES_HOST=postgres
10+
POSTGRES_PORT=5432
11+
POSTGRES_DB=devopslearn
12+
POSTGRES_USER=devops
13+
POSTGRES_PASSWORD=devopspass
14+
15+
# Docker Configuration
16+
DOCKER_NETWORK=devops-dojo-net
17+
18+
# Development Settings
19+
NODE_ENV=development
20+
LOG_LEVEL=debug

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint-and-type-check:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: |
24+
npm ci
25+
cd src/server && npm ci
26+
27+
- name: Run linting
28+
run: npm run lint
29+
30+
- name: Run type checking
31+
run: npm run typecheck
32+
33+
test:
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- uses: actions/checkout@v3
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: '18'
43+
cache: 'npm'
44+
45+
- name: Install dependencies
46+
run: |
47+
npm ci
48+
cd src/server && npm ci
49+
50+
- name: Run tests
51+
run: npm test
52+
53+
build-images:
54+
runs-on: ubuntu-latest
55+
needs: [lint-and-type-check, test]
56+
57+
steps:
58+
- uses: actions/checkout@v3
59+
60+
- name: Set up Docker Buildx
61+
uses: docker/setup-buildx-action@v2
62+
63+
- name: Build scenario base image
64+
run: docker build -t devopslearn/scenario-base:latest -f docker/Dockerfile.scenario-base .
65+
66+
- name: Build frontend image
67+
run: docker build -t devopslearn/frontend:latest -f docker/Dockerfile.frontend .
68+
69+
- name: Build backend image
70+
run: docker build -t devopslearn/backend:latest -f docker/Dockerfile.backend .
71+
72+
- name: Build scenario images
73+
run: |
74+
docker build -t devopslearn/scenario-keycloak-crashloop:latest \
75+
-f scenarios/kubernetes/keycloak-crashloop/Dockerfile \
76+
scenarios/kubernetes/keycloak-crashloop/
77+
78+
security-scan:
79+
runs-on: ubuntu-latest
80+
needs: build-images
81+
82+
steps:
83+
- uses: actions/checkout@v3
84+
85+
- name: Run Trivy vulnerability scanner
86+
uses: aquasecurity/trivy-action@master
87+
with:
88+
scan-type: 'fs'
89+
scan-ref: '.'
90+
format: 'sarif'
91+
output: 'trivy-results.sarif'
92+
93+
- name: Upload Trivy scan results
94+
uses: github/codeql-action/upload-sarif@v2
95+
if: always()
96+
with:
97+
sarif_file: 'trivy-results.sarif'

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Next.js
8+
.next/
9+
out/
10+
build/
11+
dist/
12+
13+
# Environment variables
14+
.env
15+
.env.local
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
19+
20+
# IDE
21+
.vscode/
22+
.idea/
23+
*.swp
24+
*.swo
25+
*~
26+
.DS_Store
27+
28+
# Docker
29+
*.log
30+
.docker/
31+
32+
# Testing
33+
coverage/
34+
.nyc_output/
35+
36+
# TypeScript
37+
*.tsbuildinfo
38+
39+
# Temporary files
40+
tmp/
41+
temp/
42+
43+
# OS generated files
44+
Thumbs.db

Makefile

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.PHONY: help install dev build start stop clean test lint scenario-build
2+
3+
help:
4+
@echo "DevOps Learning Platform - Available commands:"
5+
@echo " make install - Install dependencies"
6+
@echo " make dev - Start development environment"
7+
@echo " make build - Build production images"
8+
@echo " make start - Start production environment"
9+
@echo " make stop - Stop all services"
10+
@echo " make clean - Clean up containers and volumes"
11+
@echo " make test - Run tests"
12+
@echo " make lint - Run linting"
13+
@echo " make scenario-build - Build all scenario images"
14+
15+
install:
16+
npm install
17+
cd src/server && npm install
18+
19+
dev:
20+
docker-compose up -d
21+
@echo "Frontend: http://localhost:3000"
22+
@echo "Backend: http://localhost:3001"
23+
24+
build:
25+
docker-compose build
26+
$(MAKE) scenario-build
27+
28+
start:
29+
docker-compose up -d --build
30+
31+
stop:
32+
docker-compose down
33+
34+
clean:
35+
docker-compose down -v
36+
docker rmi $$(docker images -q 'devopslearn/*') 2>/dev/null || true
37+
38+
test:
39+
npm test
40+
cd src/server && npm test
41+
42+
lint:
43+
npm run lint
44+
npm run typecheck
45+
46+
scenario-build:
47+
@echo "Building scenario base image..."
48+
docker build -t devopslearn/scenario-base:latest -f docker/Dockerfile.scenario-base .
49+
@echo "Building Keycloak CrashLoop scenario..."
50+
docker build -t devopslearn/scenario-keycloak-crashloop:latest -f scenarios/kubernetes/keycloak-crashloop/Dockerfile scenarios/kubernetes/keycloak-crashloop/
51+
@echo "Scenario images built successfully!"
52+
53+
logs:
54+
docker-compose logs -f
55+
56+
ps:
57+
docker-compose ps

README.md

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,150 @@
1-
# devopslearn
1+
# DevOps Learning Platform - Learn by Fixing Broken Things
2+
3+
A hands-on learning platform for DevOps engineers based on real-world troubleshooting scenarios. Inspired by the "debugging in public" philosophy, this platform provides broken infrastructure scenarios that users must diagnose and fix.
4+
5+
## 🎯 Features
6+
7+
- **Interactive Terminal**: Browser-based terminal for hands-on practice
8+
- **Real Scenarios**: Based on actual production issues and community suggestions
9+
- **Progressive Hints**: Get help when stuck without spoiling the learning experience
10+
- **Isolated Environments**: Each scenario runs in its own Docker container
11+
- **Multiple Categories**: Kubernetes, CI/CD, Databases, Terraform, Monitoring, and Security
12+
13+
## 🚀 Quick Start
14+
15+
### Prerequisites
16+
17+
- Docker and Docker Compose
18+
- Node.js 18+ (for local development)
19+
- Make (optional, for using Makefile commands)
20+
21+
### Installation
22+
23+
1. Clone the repository:
24+
```bash
25+
git clone https://github.com/yourusername/devopslearn.git
26+
cd devopslearn
27+
```
28+
29+
2. Install dependencies:
30+
```bash
31+
make install
32+
# or manually:
33+
npm install
34+
cd src/server && npm install
35+
```
36+
37+
3. Start the development environment:
38+
```bash
39+
make dev
40+
# or manually:
41+
docker-compose up -d
42+
```
43+
44+
4. Access the platform:
45+
- Frontend: http://localhost:3000
46+
- Backend: http://localhost:3001
47+
48+
## 📚 Available Scenarios
49+
50+
### Kubernetes
51+
- **Keycloak in CrashLoopBackOff**: Fix authentication service that won't start
52+
- **DNS Resolution Failures**: Troubleshoot cluster networking issues
53+
- **Istio Service Mesh Issues**: Debug service mesh configuration
54+
55+
### CI/CD
56+
- **Jenkins to GitHub Actions Migration**: Complete a migration with broken configs
57+
- **Secret Management Gone Wrong**: Fix exposed secrets and implement proper handling
58+
- **Failed Production Deployment**: Recover from a failed deployment
59+
60+
### Database Recovery
61+
- **RDS Instance Failure**: Handle AWS RDS failures
62+
- **Database Corruption Recovery**: Recover from data corruption
63+
- **Performance Bottleneck Detection**: Identify and fix slow queries
64+
65+
### Infrastructure (Terraform)
66+
- **Terraform State Drift**: Reconcile state with actual resources
67+
- **Accidental Resource Deletion**: Recover from accidental deletions
68+
- **IAM Permission Issues**: Fix AWS permission problems
69+
70+
### Monitoring & Observability
71+
- **Grafana Dashboard Creation**: Build effective monitoring dashboards
72+
- **Prometheus Auto-discovery Fix**: Fix service discovery issues
73+
- **Log Rotation Nightmare**: Handle massive log files
74+
75+
### Security & Secrets
76+
- **Certificate Expiry Crisis**: Handle expired certificates
77+
- **Exposed Secrets in Git**: Clean up and rotate exposed credentials
78+
- **HashiCorp Vault Lockout**: Recover from Vault access issues
79+
80+
## 🛠️ Development
81+
82+
### Project Structure
83+
```
84+
devopslearn/
85+
├── src/
86+
│ ├── components/ # React components
87+
│ ├── pages/ # Next.js pages
88+
│ ├── server/ # WebSocket backend
89+
│ └── styles/ # CSS styles
90+
├── scenarios/ # Scenario configurations
91+
│ ├── kubernetes/
92+
│ ├── cicd/
93+
│ ├── database/
94+
│ └── ...
95+
├── docker/ # Docker configurations
96+
├── public/ # Static assets
97+
└── tests/ # Test files
98+
```
99+
100+
### Adding New Scenarios
101+
102+
1. Create scenario directory:
103+
```bash
104+
mkdir -p scenarios/category/scenario-name
105+
```
106+
107+
2. Add scenario files:
108+
- `Dockerfile`: Container configuration
109+
- `setup.sh`: Scenario initialization script
110+
- `manifests/`: Configuration files
111+
- `solution/`: Solution files and guide
112+
113+
3. Register in frontend (`src/pages/index.tsx`)
114+
115+
4. Build scenario image:
116+
```bash
117+
docker build -t devopslearn/scenario-name:latest scenarios/category/scenario-name/
118+
```
119+
120+
### Commands
121+
122+
```bash
123+
make help # Show all available commands
124+
make dev # Start development environment
125+
make build # Build all images
126+
make test # Run tests
127+
make lint # Run linting
128+
make clean # Clean up containers
129+
```
130+
131+
## 🤝 Contributing
132+
133+
1. Fork the repository
134+
2. Create a feature branch
135+
3. Add your scenario or feature
136+
4. Submit a pull request
137+
138+
### Scenario Ideas Welcome!
139+
140+
We're always looking for new scenarios based on real-world problems. Submit your ideas via issues or pull requests.
141+
142+
## 📝 License
143+
144+
MIT License - see LICENSE file for details
145+
146+
## 🙏 Acknowledgments
147+
148+
- Inspired by the DevOps community's "learning by breaking things" philosophy
149+
- Based on suggestions from r/devops community members
150+
- Built with Next.js, TypeScript, Docker, and xterm.js

0 commit comments

Comments
 (0)