Build an end-to-end DevOps automation system integrating all course concepts
This capstone project integrates all 19 previous lessons into a comprehensive, production-ready DevOps automation platform. You'll build a complete system that automates infrastructure provisioning, application deployment, monitoring, security, and disaster recovery.
Why This Final Project Matters:
Project Architecture:
This platform includes:
Technologies Integrated:
1# Infrastructure: boto3, azure-sdk, google-cloud
2# Containers: docker, kubernetes
3# CI/CD: jenkins, github actions
4# Monitoring: prometheus_client, elasticsearch
5# Security: safety, bandit, secrets scanning
6# API: fastapi, jwt authenticationLet's build the complete DevOps automation platform!
The complete DevOps platform follows a microservices architecture with clear separation of concerns and robust integration patterns.
1. Architecture Overview:
1āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
2ā API Gateway Layer ā
3ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
4ā ā FastAPI + JWT Auth + Rate Limiting + RBAC ā ā
5ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
6āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
7 ā
8 āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāā
9 ā ā ā
10āāāāāāāāāāā¼āāāāāāāāāā āāāā¼āāāāāāāāāāā āāā¼āāāāāāāāāāāāāāā
11ā Infrastructure ā ā CI/CD ā ā Monitoring ā
12ā Manager ā ā Orchestratorā ā System ā
13ā ā ā ā ā ā
14ā ⢠AWS/Azure/GCP ā ā ⢠Jenkins ā ā ⢠Prometheus ā
15ā ⢠Terraform ā ā ⢠GitHub ā ā ⢠Grafana ā
16ā ⢠CloudFormation ā ā ⢠GitLab ā ā ⢠Alerting ā
17āāāāāāāāāāā¬āāāāāāāāāā āāāā¬āāāāāāāāāāā āāā¬āāāāāāāāāāāāāāā
18 ā ā ā
19 āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāā
20 ā
21 āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāā
22 ā ā ā
23āāāāāāāāāāā¼āāāāāāāāāā āāāā¼āāāāāāāāāāā āāā¼āāāāāāāāāāāāāāā
24ā Container ā ā Security ā ā Disaster ā
25ā Orchestration ā ā Scanner ā ā Recovery ā
26ā ā ā ā ā ā
27ā ⢠Docker ā ā ⢠Trivy ā ā ⢠Backups ā
28ā ⢠Kubernetes ā ā ⢠OWASP ZAP ā ā ⢠Failover ā
29ā ⢠Helm ā ā ⢠Secrets ā ā ⢠DR Testing ā
30āāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāā2. Core Components:
1from dataclasses import dataclass
2from typing import Dict, List, Optional
3from enum import Enum
4
5class ComponentStatus(Enum):
6 HEALTHY = "healthy"
7 DEGRADED = "degraded"
8 UNHEALTHY = "unhealthy"
9
10@dataclass
11class InfrastructureConfig:
12 """Infrastructure configuration"""
13 cloud_provider: str # aws, azure, gcp
14 region: str
15 vpc_cidr: str
16 cluster_name: str
17 node_count: int
18 node_type: str
19
20@dataclass
21class ApplicationConfig:
22 """Application deployment configuration"""
23 name: str
24 version: str
25 image: str
26 replicas: int
27 environment: Dict[str, str]
28 resources: Dict[str, str]
29
30class DevOpsPlatform:
31 """
32 Complete DevOps automation platform
33 Integrates all course concepts into unified system
34 """
35
36 def __init__(self, config_path: str):
37 self.infra_manager = InfrastructureManager()
38 self.container_orchestrator = KubernetesOrchestrator()
39 self.cicd_pipeline = CICDPipeline()
40 self.monitoring_system = MonitoringSystem()
41 self.security_scanner = SecurityScanner()
42 self.dr_manager = DisasterRecoveryManager()
43
44 def deploy_full_stack(
45 self,
46 infra_config: InfrastructureConfig,
47 app_config: ApplicationConfig
48 ) -> Dict:
49 """
50 Deploy complete application stack
51
52 Workflow:
53 1. Provision infrastructure (clouds + networking)
54 2. Deploy Kubernetes cluster
55 3. Configure monitoring and logging
56 4. Set up security policies
57 5. Deploy application
58 6. Configure DR and backups
59 7. Run health checks and tests
60 """
61 # Will implement in practical example
62 pass3. Integration Patterns:
Service Discovery:
1class ServiceRegistry:
2 """
3 Service discovery and registration
4 Enables components to find each other
5 """
6
7 def register_service(
8 self,
9 service_name: str,
10 endpoint: str,
11 health_check: str
12 ):
13 # Register service with Consul/etcd
14 pass
15
16 def discover_service(self, service_name: str) -> str:
17 # Look up service endpoint
18 passEvent-Driven Communication:
1from typing import Callable
2import asyncio
3
4class EventBus:
5 """
6 Event bus for component communication
7 Decouples components with async messaging
8 """
9
10 def __init__(self):
11 self.subscribers: Dict[str, List[Callable]] = {}
12
13 def subscribe(self, event_type: str, handler: Callable):
14 if event_type not in self.subscribers:
15 self.subscribers[event_type] = []
16 self.subscribers[event_type].append(handler)
17
18 async def publish(self, event_type: str, data: Dict):
19 if event_type in self.subscribers:
20 await asyncio.gather(*[
21 handler(data)
22 for handler in self.subscribers[event_type]
23 ])
24
25# Usage
26event_bus = EventBus()
27
28async def on_deployment_complete(data: Dict):
29 # Trigger monitoring setup
30 await monitoring.setup_for_deployment(data['deployment_id'])
31 # Trigger security scan
32 await security.scan_deployment(data['image'])
33
34event_bus.subscribe('deployment.complete', on_deployment_complete)4. Configuration Management:
1import os
2from pathlib import Path
3import yaml
4from typing import Any
5
6class ConfigManager:
7 """
8 Centralized configuration management
9 Supports multiple environments and secret management
10 """
11
12 def __init__(self, config_dir: str = "./config"):
13 self.config_dir = Path(config_dir)
14 self.env = os.getenv('ENVIRONMENT', 'development')
15 self.config = self._load_config()
16
17 def _load_config(self) -> Dict[str, Any]:
18 # Load base config
19 base_config = self._load_yaml('base.yaml')
20
21 # Load environment-specific config
22 env_config = self._load_yaml(f'{self.env}.yaml')
23
24 # Merge configs (env overrides base)
25 return {**base_config, **env_config}
26
27 def _load_yaml(self, filename: str) -> Dict:
28 config_file = self.config_dir / filename
29 if not config_file.exists():
30 return {}
31 with open(config_file) as f:
32 return yaml.safe_load(f)
33
34 def get(self, key: str, default: Any = None) -> Any:
35 keys = key.split('.')
36 value = self.config
37 for k in keys:
38 if isinstance(value, dict):
39 value = value.get(k)
40 else:
41 return default
42 return value if value is not None else default
43
44# Usage
45config = ConfigManager()
46aws_region = config.get('aws.region', 'us-east-1')
47cluster_size = config.get('kubernetes.cluster.size', 3)5. State Management:
1import json
2from typing import Any
3from datetime import datetime
4
5class StateManager:
6 """
7 Manage platform state across operations
8 Enables idempotent operations and recovery
9 """
10
11 def __init__(self, state_backend: str = "local"):
12 self.state_backend = state_backend # local, s3, consul
13 self.state = self._load_state()
14
15 def _load_state(self) -> Dict[str, Any]:
16 if self.state_backend == "local":
17 try:
18 with open('.devops-state.json') as f:
19 return json.load(f)
20 except FileNotFoundError:
21 return {}
22 # Implement S3/Consul backends
23 return {}
24
25 def save_state(self):
26 if self.state_backend == "local":
27 with open('.devops-state.json', 'w') as f:
28 json.dump(self.state, f, indent=2)
29
30 def update(self, key: str, value: Any):
31 self.state[key] = {
32 'value': value,
33 'timestamp': datetime.now().isoformat(),
34 'version': self.state.get(key, {}).get('version', 0) + 1
35 }
36 self.save_state()
37
38 def get(self, key: str, default: Any = None) -> Any:
39 return self.state.get(key, {}).get('value', default)
40
41# Usage
42state = StateManager()
43state.update('infrastructure.vpc_id', 'vpc-123456')
44state.update('kubernetes.cluster_endpoint', 'https://...')
45vpc_id = state.get('infrastructure.vpc_id')Key Architecture Principles:
Implement end-to-end workflows that automate the entire application lifecycle from infrastructure provisioning to production deployment and monitoring.
1. Full Deployment Workflow:
1from typing import Dict, Any
2import asyncio
3from datetime import datetime
4
5class DeploymentWorkflow:
6 """
7 End-to-end deployment automation workflow
8 Integrates all platform components
9 """
10
11 def __init__(self, platform: DevOpsPlatform):
12 self.platform = platform
13 self.logger = logging.getLogger(__name__)
14
15 async def deploy_application(
16 self,
17 app_name: str,
18 version: str,
19 environment: str
20 ) -> Dict[str, Any]:
21 """
22 Complete application deployment workflow
23
24 Steps:
25 1. Pre-deployment validation
26 2. Infrastructure provisioning/validation
27 3. Build and test application
28 4. Security scanning
29 5. Deploy to Kubernetes
30 6. Configure monitoring
31 7. Run smoke tests
32 8. Update DNS/load balancers
33 9. Post-deployment validation
34 """
35
36 deployment_id = f"{app_name}-{version}-{int(datetime.now().timestamp())}"
37 self.logger.info(f"š Starting deployment: {deployment_id}")
38
39 try:
40 # Step 1: Pre-deployment validation
41 await self._validate_prerequisites(app_name, environment)
42
43 # Step 2: Ensure infrastructure exists
44 await self._ensure_infrastructure(environment)
45
46 # Step 3: Build application
47 build_result = await self._build_application(app_name, version)
48 image_uri = build_result['image_uri']
49
50 # Step 4: Security scan
51 scan_result = await self._security_scan(image_uri)
52 if scan_result['critical_vulns'] > 0:
53 raise Exception(f"Critical vulnerabilities found: {scan_result['critical_vulns']}")
54
55 # Step 5: Deploy to Kubernetes
56 deploy_result = await self._deploy_to_kubernetes(
57 app_name, version, image_uri, environment
58 )
59
60 # Step 6: Configure monitoring
61 await self._setup_monitoring(app_name, environment)
62
63 # Step 7: Run smoke tests
64 await self._run_smoke_tests(app_name, environment)
65
66 # Step 8: Update traffic routing
67 await self._update_routing(app_name, environment)
68
69 # Step 9: Post-deployment validation
70 await self._validate_deployment(app_name, environment)
71
72 self.logger.info(f"ā
Deployment successful: {deployment_id}")
73
74 return {
75 'deployment_id': deployment_id,
76 'status': 'success',
77 'app_name': app_name,
78 'version': version,
79 'environment': environment,
80 'image_uri': image_uri,
81 'timestamp': datetime.now().isoformat()
82 }
83
84 except Exception as e:
85 self.logger.error(f"ā Deployment failed: {e}")
86 # Rollback on failure
87 await self._rollback_deployment(app_name, environment)
88 raise
89
90 async def _validate_prerequisites(self, app_name: str, environment: str):
91 """Validate all prerequisites before deployment"""
92 self.logger.info("š Validating prerequisites...")
93
94 # Check configuration exists
95 if not self.platform.config.get(f'apps.{app_name}'):
96 raise Exception(f"No configuration found for {app_name}")
97
98 # Check credentials
99 if environment == 'production':
100 if not self._has_production_approvals(app_name):
101 raise Exception("Production deployment requires approval")
102
103 # Check cluster health
104 cluster_status = await self.platform.k8s.get_cluster_health()
105 if cluster_status != 'healthy':
106 raise Exception(f"Cluster unhealthy: {cluster_status}")
107
108 self.logger.info("ā
Prerequisites validated")
109
110 async def _ensure_infrastructure(self, environment: str):
111 """Ensure required infrastructure exists"""
112 self.logger.info("šļø Ensuring infrastructure...")
113
114 # Check if VPC exists
115 vpc_id = self.platform.state.get(f'{environment}.vpc_id')
116 if not vpc_id:
117 # Provision VPC
118 vpc_result = await self.platform.infra.provision_vpc(environment)
119 vpc_id = vpc_result['vpc_id']
120 self.platform.state.update(f'{environment}.vpc_id', vpc_id)
121
122 # Check if Kubernetes cluster exists
123 cluster_endpoint = self.platform.state.get(f'{environment}.cluster_endpoint')
124 if not cluster_endpoint:
125 # Provision cluster
126 cluster_result = await self.platform.k8s.provision_cluster(
127 environment=environment,
128 vpc_id=vpc_id
129 )
130 self.platform.state.update(
131 f'{environment}.cluster_endpoint',
132 cluster_result['endpoint']
133 )
134
135 self.logger.info("ā
Infrastructure ready")
136
137 async def _build_application(self, app_name: str, version: str) -> Dict:
138 """Build application container image"""
139 self.logger.info(f"šØ Building {app_name}:{version}...")
140
141 # Trigger CI/CD pipeline
142 build_result = await self.platform.cicd.trigger_build(
143 app_name=app_name,
144 version=version,
145 git_ref=f"v{version}"
146 )
147
148 # Wait for build to complete
149 while build_result['status'] == 'building':
150 await asyncio.sleep(10)
151 build_result = await self.platform.cicd.get_build_status(
152 build_result['build_id']
153 )
154
155 if build_result['status'] != 'success':
156 raise Exception(f"Build failed: {build_result['error']}")
157
158 self.logger.info(f"ā
Build complete: {build_result['image_uri']}")
159 return build_result
160
161 async def _security_scan(self, image_uri: str) -> Dict:
162 """Scan container image for vulnerabilities"""
163 self.logger.info(f"š Scanning {image_uri}...")
164
165 scan_result = await self.platform.security.scan_image(image_uri)
166
167 self.logger.info(
168 f"Vulnerabilities found: "
169 f"Critical={scan_result['critical_vulns']}, "
170 f"High={scan_result['high_vulns']}, "
171 f"Medium={scan_result['medium_vulns']}"
172 )
173
174 return scan_result
175
176 async def _deploy_to_kubernetes(
177 self,
178 app_name: str,
179 version: str,
180 image_uri: str,
181 environment: str
182 ) -> Dict:
183 """Deploy application to Kubernetes"""
184 self.logger.info(f"āøļø Deploying to Kubernetes ({environment})...")
185
186 # Create/update deployment
187 deploy_result = await self.platform.k8s.deploy_application(
188 name=app_name,
189 image=image_uri,
190 version=version,
191 namespace=environment,
192 replicas=self.platform.config.get(f'apps.{app_name}.replicas', 3),
193 resources=self.platform.config.get(f'apps.{app_name}.resources', {})
194 )
195
196 # Wait for rollout to complete
197 await self.platform.k8s.wait_for_rollout(
198 name=app_name,
199 namespace=environment,
200 timeout=300
201 )
202
203 self.logger.info("ā
Kubernetes deployment complete")
204 return deploy_result
205
206 async def _setup_monitoring(self, app_name: str, environment: str):
207 """Configure monitoring for application"""
208 self.logger.info("š Setting up monitoring...")
209
210 # Create Prometheus ServiceMonitor
211 await self.platform.monitoring.create_service_monitor(
212 app_name=app_name,
213 namespace=environment,
214 metrics_path='/metrics',
215 interval='30s'
216 )
217
218 # Create Grafana dashboard
219 await self.platform.monitoring.create_dashboard(
220 app_name=app_name,
221 environment=environment
222 )
223
224 # Configure alerts
225 await self.platform.monitoring.create_alerts(
226 app_name=app_name,
227 environment=environment,
228 rules=[
229 {
230 'alert': 'HighErrorRate',
231 'expr': f'rate(http_requests_total{{job="{app_name}",status=~"5.."}}[5m]) > 0.05',
232 'for': '5m',
233 'severity': 'critical'
234 },
235 {
236 'alert': 'PodCrashLooping',
237 'expr': f'rate(kube_pod_container_status_restarts_total{{pod=~"{app_name}.*"}}[15m]) > 0',
238 'for': '5m',
239 'severity': 'warning'
240 }
241 ]
242 )
243
244 self.logger.info("ā
Monitoring configured")
245
246 async def _run_smoke_tests(self, app_name: str, environment: str):
247 """Run smoke tests to validate deployment"""
248 self.logger.info("š§Ŗ Running smoke tests...")
249
250 # Get service endpoint
251 service_url = await self.platform.k8s.get_service_url(
252 name=app_name,
253 namespace=environment
254 )
255
256 # Run basic health check
257 import aiohttp
258 async with aiohttp.ClientSession() as session:
259 async with session.get(f"{service_url}/health") as resp:
260 if resp.status != 200:
261 raise Exception(f"Health check failed: {resp.status}")
262
263 # Run additional smoke tests from config
264 smoke_tests = self.platform.config.get(f'apps.{app_name}.smoke_tests', [])
265 for test in smoke_tests:
266 async with aiohttp.ClientSession() as session:
267 async with session.request(
268 method=test['method'],
269 url=f"{service_url}{test['path']}"
270 ) as resp:
271 if resp.status not in test.get('expected_status', [200]):
272 raise Exception(f"Smoke test failed: {test['path']}")
273
274 self.logger.info("ā
Smoke tests passed")
275
276 async def _update_routing(self, app_name: str, environment: str):
277 """Update traffic routing to new version"""
278 self.logger.info("š Updating traffic routing...")
279
280 if environment == 'production':
281 # Blue-green deployment: gradually shift traffic
282 await self.platform.k8s.update_ingress(
283 app_name=app_name,
284 strategy='blue-green',
285 canary_weight=10 # Start with 10% traffic
286 )
287
288 # Monitor metrics for 5 minutes
289 await asyncio.sleep(300)
290
291 # If no errors, shift 100% traffic
292 await self.platform.k8s.update_ingress(
293 app_name=app_name,
294 strategy='blue-green',
295 canary_weight=100
296 )
297 else:
298 # Dev/staging: immediate cutover
299 await self.platform.k8s.update_ingress(
300 app_name=app_name,
301 strategy='replace'
302 )
303
304 self.logger.info("ā
Traffic routing updated")
305
306 async def _validate_deployment(self, app_name: str, environment: str):
307 """Validate deployment was successful"""
308 self.logger.info("āļø Validating deployment...")
309
310 # Check all pods are running
311 pods_status = await self.platform.k8s.get_pods_status(
312 app_name=app_name,
313 namespace=environment
314 )
315
316 running_pods = sum(1 for p in pods_status if p['status'] == 'Running')
317 expected_pods = self.platform.config.get(f'apps.{app_name}.replicas', 3)
318
319 if running_pods < expected_pods:
320 raise Exception(f"Only {running_pods}/{expected_pods} pods running")
321
322 # Check metrics are being collected
323 metrics_available = await self.platform.monitoring.check_metrics_available(
324 app_name=app_name
325 )
326 if not metrics_available:
327 self.logger.warning("ā ļø Metrics not yet available")
328
329 self.logger.info("ā
Deployment validated")
330
331 async def _rollback_deployment(self, app_name: str, environment: str):
332 """Rollback failed deployment"""
333 self.logger.warning(f"āŖ Rolling back {app_name} in {environment}...")
334
335 try:
336 await self.platform.k8s.rollback_deployment(
337 name=app_name,
338 namespace=environment
339 )
340 self.logger.info("ā
Rollback complete")
341 except Exception as e:
342 self.logger.error(f"ā Rollback failed: {e}")2. Infrastructure Management Workflow:
1class InfrastructureWorkflow:
2 """Manage complete infrastructure lifecycle"""
3
4 async def provision_environment(
5 self,
6 environment: str,
7 region: str
8 ) -> Dict:
9 """
10 Provision complete environment infrastructure
11 - VPC with public/private subnets
12 - EKS/AKS/GKE cluster
13 - RDS/CloudSQL database
14 - ElastiCache/Redis
15 - S3/Blob storage
16 - IAM roles and policies
17 """
18 self.logger.info(f"šļø Provisioning {environment} environment...")
19
20 # Use Terraform/Pulumi for IaC
21 terraform_vars = {
22 'environment': environment,
23 'region': region,
24 'cluster_size': 3,
25 'node_type': 't3.medium',
26 'db_instance_type': 'db.t3.medium'
27 }
28
29 result = await self.platform.infra.apply_terraform(
30 workspace=environment,
31 variables=terraform_vars
32 )
33
34 return resultKey Workflow Principles:
Implement comprehensive monitoring, alerting, and operational automation for production systems.
1. Complete Monitoring Stack:
1from prometheus_client import Counter, Histogram, Gauge, generate_latest
2from typing import Dict, List
3import asyncio
4
5class MonitoringSystem:
6 """
7 Complete monitoring and observability system
8 Integrates metrics, logs, traces, and alerts
9 """
10
11 def __init__(self, config: ConfigManager):
12 self.config = config
13 self._init_metrics()
14
15 def _init_metrics(self):
16 """Initialize Prometheus metrics"""
17
18 # Deployment metrics
19 self.deployments_total = Counter(
20 'devops_deployments_total',
21 'Total number of deployments',
22 ['app', 'environment', 'status']
23 )
24
25 self.deployment_duration = Histogram(
26 'devops_deployment_duration_seconds',
27 'Deployment duration in seconds',
28 ['app', 'environment']
29 )
30
31 # Infrastructure metrics
32 self.cluster_nodes = Gauge(
33 'devops_cluster_nodes',
34 'Number of cluster nodes',
35 ['environment', 'status']
36 )
37
38 self.infrastructure_cost = Gauge(
39 'devops_infrastructure_cost_dollars',
40 'Estimated monthly infrastructure cost',
41 ['environment', 'service']
42 )
43
44 # Security metrics
45 self.vulnerabilities_found = Gauge(
46 'devops_vulnerabilities_total',
47 'Number of vulnerabilities found',
48 ['severity', 'app']
49 )
50
51 # Operational metrics
52 self.backup_age_hours = Gauge(
53 'devops_backup_age_hours',
54 'Age of latest backup in hours',
55 ['database', 'environment']
56 )
57
58 async def setup_for_deployment(self, deployment_id: str):
59 """Set up monitoring for new deployment"""
60 # Implementation from practical example
61 pass
62
63 def record_deployment(
64 self,
65 app: str,
66 environment: str,
67 status: str,
68 duration: float
69 ):
70 """Record deployment metrics"""
71 self.deployments_total.labels(
72 app=app,
73 environment=environment,
74 status=status
75 ).inc()
76
77 if status == 'success':
78 self.deployment_duration.labels(
79 app=app,
80 environment=environment
81 ).observe(duration)2. Automated Incident Response:
1class IncidentResponse:
2 """
3 Automated incident detection and response
4 """
5
6 def __init__(self, platform: DevOpsPlatform):
7 self.platform = platform
8 self.alert_rules = self._load_alert_rules()
9
10 async def handle_alert(self, alert: Dict):
11 """Handle incoming alert"""
12 alert_name = alert['labels']['alertname']
13 severity = alert['labels']['severity']
14
15 self.logger.warning(
16 f"šØ Alert triggered: {alert_name} (severity: {severity})"
17 )
18
19 # Auto-remediation based on alert type
20 if alert_name == 'PodCrashLooping':
21 await self._handle_pod_crash(alert)
22 elif alert_name == 'HighMemoryUsage':
23 await self._handle_high_memory(alert)
24 elif alert_name == 'DiskSpaceLow':
25 await self._handle_disk_space(alert)
26
27 # Always notify on-call team
28 await self._notify_oncall(alert)
29
30 async def _handle_pod_crash(self, alert: Dict):
31 """Auto-remediate crashing pods"""
32 pod_name = alert['labels']['pod']
33 namespace = alert['labels']['namespace']
34
35 # Get pod logs
36 logs = await self.platform.k8s.get_pod_logs(
37 pod=pod_name,
38 namespace=namespace,
39 tail=100
40 )
41
42 # Check for common issues
43 if 'OutOfMemoryError' in logs:
44 # Increase memory limit
45 await self.platform.k8s.update_resources(
46 deployment=pod_name.split('-')[0],
47 namespace=namespace,
48 memory_limit='512Mi' # Increase from 256Mi
49 )
50 elif 'Connection refused' in logs:
51 # Check dependent services
52 await self._check_dependencies(pod_name, namespace)
53
54 async def _handle_high_memory(self, alert: Dict):
55 """Auto-scale on high memory usage"""
56 deployment = alert['labels']['deployment']
57 namespace = alert['labels']['namespace']
58
59 # Scale up if not at max
60 current_replicas = await self.platform.k8s.get_replica_count(
61 deployment=deployment,
62 namespace=namespace
63 )
64
65 max_replicas = self.platform.config.get(
66 f'apps.{deployment}.max_replicas',
67 10
68 )
69
70 if current_replicas < max_replicas:
71 await self.platform.k8s.scale_deployment(
72 deployment=deployment,
73 namespace=namespace,
74 replicas=current_replicas + 2
75 )
76 self.logger.info(
77 f"š Scaled {deployment} from {current_replicas} "
78 f"to {current_replicas + 2} replicas"
79 )3. Cost Optimization:
1class CostOptimization:
2 """Automated cost optimization"""
3
4 async def optimize_infrastructure(self, environment: str):
5 """Run cost optimization analysis"""
6
7 # Find idle resources
8 idle_resources = await self._find_idle_resources(environment)
9
10 # Recommend instance right-sizing
11 sizing_recommendations = await self._analyze_instance_sizing(environment)
12
13 # Identify unused volumes
14 unused_volumes = await self._find_unused_volumes(environment)
15
16 # Auto-apply low-risk optimizations
17 savings = 0
18 for resource in idle_resources:
19 if resource['idle_days'] > 7:
20 await self._terminate_resource(resource)
21 savings += resource['monthly_cost']
22
23 return {
24 'total_savings': savings,
25 'recommendations': sizing_recommendations,
26 'actions_taken': len(idle_resources)
27 }Key Operational Capabilities:
Production-ready capstone project integrating all 19 lessons: Infrastructure as Code, Container Orchestration, CI/CD, Monitoring, Security, and DR automation in a unified platform.
1#!/usr/bin/env python3
2"""
3š Complete DevOps Automation Platform - Capstone Project
4Topic: End-to-End DevOps Automation (Integrates All 19 Lessons)
5Author: DevOps Platform Engineering Team
6Dependencies: pip install boto3 kubernetes docker prometheus-client fastapi
7
8**What This Demonstrates:**
9- Lesson 1-9: Foundation (system admin, networking, IaC, containers)
10- Lesson 10-11: Kubernetes + CI/CD automation
11- Lesson 12-13: Multi-cloud automation (AWS, Azure, GCP)
12- Lesson 14-15: Monitoring + logging systems
13- Lesson 16: Security automation and scanning
14- Lesson 17-18: Performance testing + disaster recovery
15- Lesson 19: API development for DevOps
16"""
17
18import json
19import time
20import hashlib
21from dataclasses import dataclass, asdict
22from typing import Dict, List, Optional, Any
23from datetime import datetime, timedelta
24from enum import Enum
25import logging
26import sys
27
28# Configure production logging
29logging.basicConfig(
30 level=logging.INFO,
31 format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
32 handlers=[
33 logging.FileHandler('devops-platform.log'),
34 logging.StreamHandler(sys.stdout)
35 ]
36)
37logger = logging.getLogger(__name__)
38
39
40# ============================================================================
41# DOMAIN MODELS
42# ============================================================================
43
44class EnvironmentType(Enum):
45 """Environment types"""
46 DEVELOPMENT = "development"
47 STAGING = "staging"
48 PRODUCTION = "production"
49
50
51class ComponentStatus(Enum):
52 """Component health status"""
53 HEALTHY = "healthy"
54 DEGRADED = "degraded"
55 UNHEALTHY = "unhealthy"
56 UNKNOWN = "unknown"
57
58
59class DeploymentStatus(Enum):
60 """Deployment status"""
61 PENDING = "pending"
62 BUILDING = "building"
63 TESTING = "testing"
64 DEPLOYING = "deploying"
65 SUCCESS = "success"
66 FAILED = "failed"
67 ROLLED_BACK = "rolled_back"
68
69
70@dataclass
71class InfrastructureConfig:
72 """Infrastructure configuration (Lesson 7: IaC)"""
73 cloud_provider: str # aws, azure, gcp
74 region: str
75 vpc_cidr: str = "10.0.0.0/16"
76 cluster_name: str = "devops-cluster"
77 node_count: int = 3
78 node_type: str = "t3.medium"
79
80
81@dataclass
82class ApplicationConfig:
83 """Application deployment config (Lesson 10-11: K8s + CI/CD)"""
84 name: str
85 version: str
86 image: str
87 replicas: int = 3
88 cpu_request: str = "100m"
89 cpu_limit: str = "500m"
90 memory_request: str = "128Mi"
91 memory_limit: str = "512Mi"
92 environment: Dict[str, str] = None
93
94 def __post_init__(self):
95 if self.environment is None:
96 self.environment = {}
97
98
99@dataclass
100class SecurityScanResult:
101 """Security scan results (Lesson 16: Security)"""
102 critical_vulns: int = 0
103 high_vulns: int = 0
104 medium_vulns: int = 0
105 low_vulns: int = 0
106 scan_timestamp: str = ""
107 passed: bool = False
108
109
110@dataclass
111class MonitoringConfig:
112 """Monitoring configuration (Lesson 14-15: Monitoring + Logging)"""
113 metrics_enabled: bool = True
114 logging_enabled: bool = True
115 alerting_enabled: bool = True
116 retention_days: int = 30
117
118
119# ============================================================================
120# CONFIGURATION MANAGER (Lesson 1-2: System Admin + Automation)
121# ============================================================================
122
123class ConfigManager:
124 """
125 Centralized configuration management
126 Integrates lessons on system administration and automation
127 """
128
129 def __init__(self):
130 self.config = {
131 'platform': {
132 'name': 'DevOps Automation Platform',
133 'version': '1.0.0'
134 },
135 'environments': {
136 'dev': {'region': 'us-east-1', 'nodes': 2},
137 'staging': {'region': 'us-west-2', 'nodes': 3},
138 'production': {'region': 'us-west-2', 'nodes': 5}
139 },
140 'monitoring': {
141 'prometheus': True,
142 'grafana': True,
143 'alertmanager': True
144 },
145 'security': {
146 'vulnerability_scanning': True,
147 'compliance_checks': True,
148 'secret_management': True
149 }
150 }
151 logger.info("š§ ConfigManager initialized")
152
153 def get(self, key: str, default: Any = None) -> Any:
154 """Get configuration value using dot notation"""
155 keys = key.split('.')
156 value = self.config
157 for k in keys:
158 if isinstance(value, dict):
159 value = value.get(k)
160 if value is None:
161 return default
162 else:
163 return default
164 return value
165
166
167# ============================================================================
168# STATE MANAGER (Lesson 7: Infrastructure as Code)
169# ============================================================================
170
171class StateManager:
172 """
173 Platform state management for idempotent operations
174 Enables infrastructure tracking and recovery
175 """
176
177 def __init__(self, state_file: str = '.devops-state.json'):
178 self.state_file = state_file
179 self.state = self._load_state()
180 logger.info("š¾ StateManager initialized")
181
182 def _load_state(self) -> Dict[str, Any]:
183 """Load state from file"""
184 try:
185 with open(self.state_file, 'r') as f:
186 return json.load(f)
187 except FileNotFoundError:
188 return {}
189
190 def save(self):
191 """Save state to file"""
192 with open(self.state_file, 'w') as f:
193 json.dump(self.state, f, indent=2)
194
195 def update(self, key: str, value: Any):
196 """Update state value"""
197 self.state[key] = {
198 'value': value,
199 'timestamp': datetime.now().isoformat(),
200 'version': self.state.get(key, {}).get('version', 0) + 1
201 }
202 self.save()
203
204 def get(self, key: str, default: Any = None) -> Any:
205 """Get state value"""
206 return self.state.get(key, {}).get('value', default)
207
208
209# ============================================================================
210# INFRASTRUCTURE MANAGER (Lessons 7, 12-13: IaC + Multi-Cloud)
211# ============================================================================
212
213class InfrastructureManager:
214 """
215 Multi-cloud infrastructure management
216 Integrates AWS (Lesson 12), Azure & GCP (Lesson 13)
217 """
218
219 def __init__(self, config: ConfigManager, state: StateManager):
220 self.config = config
221 self.state = state
222 logger.info("šļø InfrastructureManager initialized")
223
224 def provision_vpc(self, environment: str) -> Dict:
225 """Provision VPC/VNet (simulated for demo)"""
226 logger.info(f"š” Provisioning VPC for {environment}...")
227
228 vpc_id = f"vpc-{hashlib.md5(environment.encode()).hexdigest()[:8]}"
229
230 # Simulate VPC creation
231 time.sleep(0.5)
232
233 result = {
234 'vpc_id': vpc_id,
235 'cidr': '10.0.0.0/16',
236 'region': self.config.get(f'environments.{environment}.region', 'us-east-1'),
237 'subnets': {
238 'public': ['10.0.1.0/24', '10.0.2.0/24'],
239 'private': ['10.0.10.0/24', '10.0.11.0/24']
240 }
241 }
242
243 logger.info(f"ā
VPC provisioned: {vpc_id}")
244 return result
245
246 def health_check(self) -> str:
247 """Check infrastructure health"""
248 # In production: check actual cloud resources
249 return ComponentStatus.HEALTHY.value
250
251
252# ============================================================================
253# KUBERNETES ORCHESTRATOR (Lesson 10: Kubernetes Automation)
254# ============================================================================
255
256class KubernetesOrchestrator:
257 """
258 Kubernetes deployment and management automation
259 """
260
261 def __init__(self, config: ConfigManager, state: StateManager):
262 self.config = config
263 self.state = state
264 self.deployments: Dict[str, Dict] = {}
265 logger.info("āøļø KubernetesOrchestrator initialized")
266
267 def provision_cluster(self, environment: str, vpc_id: str) -> Dict:
268 """Provision Kubernetes cluster (simulated)"""
269 logger.info(f"āøļø Provisioning Kubernetes cluster for {environment}...")
270
271 cluster_endpoint = f"https://k8s-{environment}-{hashlib.md5(vpc_id.encode()).hexdigest()[:8]}.example.com"
272
273 time.sleep(0.5)
274
275 result = {
276 'cluster_name': f"cluster-{environment}",
277 'endpoint': cluster_endpoint,
278 'version': '1.28',
279 'nodes': self.config.get(f'environments.{environment}.nodes', 3)
280 }
281
282 logger.info(f"ā
Cluster provisioned: {result['cluster_name']}")
283 return result
284
285 def deploy_application(
286 self,
287 name: str,
288 image: str,
289 version: str,
290 namespace: str,
291 replicas: int,
292 resources: Dict
293 ) -> Dict:
294 """Deploy application to Kubernetes"""
295 logger.info(f"š Deploying {name}:{version} to {namespace}...")
296
297 deployment_id = f"{name}-{version}-{int(time.time())}"
298
299 # Simulate deployment
300 time.sleep(0.3)
301
302 deployment = {
303 'deployment_id': deployment_id,
304 'name': name,
305 'image': image,
306 'version': version,
307 'namespace': namespace,
308 'replicas': replicas,
309 'status': 'Running',
310 'created_at': datetime.now().isoformat()
311 }
312
313 self.deployments[deployment_id] = deployment
314
315 logger.info(f"ā
Deployment successful: {deployment_id}")
316 return deployment
317
318 def get_cluster_health(self) -> str:
319 """Check cluster health"""
320 # In production: actual kubectl health checks
321 return "healthy"
322
323 def health_check(self) -> str:
324 """Check Kubernetes orchestrator health"""
325 return ComponentStatus.HEALTHY.value
326
327
328# ============================================================================
329# CI/CD PIPELINE (Lesson 11: CI/CD Pipeline Development)
330# ============================================================================
331
332class CICDPipeline:
333 """
334 CI/CD automation with build, test, and deployment
335 """
336
337 def __init__(self, config: ConfigManager, state: StateManager):
338 self.config = config
339 self.state = state
340 self.builds: Dict[str, Dict] = {}
341 logger.info("š CICDPipeline initialized")
342
343 def trigger_build(self, app_name: str, version: str, git_ref: str) -> Dict:
344 """Trigger application build"""
345 build_id = f"build-{app_name}-{int(time.time())}"
346
347 logger.info(f"šØ Triggering build: {build_id}")
348
349 build = {
350 'build_id': build_id,
351 'app_name': app_name,
352 'version': version,
353 'git_ref': git_ref,
354 'status': 'building',
355 'started_at': datetime.now().isoformat()
356 }
357
358 self.builds[build_id] = build
359
360 # Simulate build process
361 time.sleep(0.5)
362
363 # Update to success
364 build['status'] = 'success'
365 build['image_uri'] = f"registry.example.com/{app_name}:{version}"
366 build['completed_at'] = datetime.now().isoformat()
367
368 logger.info(f"ā
Build successful: {build['image_uri']}")
369 return build
370
371 def get_build_status(self, build_id: str) -> Dict:
372 """Get build status"""
373 return self.builds.get(build_id, {'status': 'not_found'})
374
375 def health_check(self) -> str:
376 """Check CI/CD pipeline health"""
377 return ComponentStatus.HEALTHY.value
378
379
380# ============================================================================
381# SECURITY SCANNER (Lesson 16: Security Automation)
382# ============================================================================
383
384class SecurityScanner:
385 """
386 Security vulnerability scanning and compliance checks
387 """
388
389 def __init__(self, config: ConfigManager):
390 self.config = config
391 logger.info("š SecurityScanner initialized")
392
393 def scan_image(self, image_uri: str) -> SecurityScanResult:
394 """Scan container image for vulnerabilities"""
395 logger.info(f"š Scanning image: {image_uri}")
396
397 # Simulate security scan
398 time.sleep(0.4)
399
400 # Simulated results (production would use Trivy/Clair)
401 result = SecurityScanResult(
402 critical_vulns=0,
403 high_vulns=2,
404 medium_vulns=5,
405 low_vulns=10,
406 scan_timestamp=datetime.now().isoformat(),
407 passed=True # Pass if no critical vulnerabilities
408 )
409
410 logger.info(
411 f"š Scan complete: Critical={result.critical_vulns}, "
412 f"High={result.high_vulns}, Medium={result.medium_vulns}"
413 )
414
415 return result
416
417 def health_check(self) -> str:
418 """Check security scanner health"""
419 return ComponentStatus.HEALTHY.value
420
421
422# ============================================================================
423# MONITORING SYSTEM (Lessons 14-15: Monitoring + Logging)
424# ============================================================================
425
426class MonitoringSystem:
427 """
428 Comprehensive monitoring with Prometheus, Grafana, and alerting
429 """
430
431 def __init__(self, config: ConfigManager):
432 self.config = config
433 self.metrics: Dict[str, Any] = {}
434 logger.info("š MonitoringSystem initialized")
435
436 def create_service_monitor(
437 self,
438 app_name: str,
439 namespace: str,
440 metrics_path: str,
441 interval: str
442 ):
443 """Create Prometheus ServiceMonitor"""
444 logger.info(f"š Creating ServiceMonitor for {app_name} in {namespace}")
445 time.sleep(0.2)
446 logger.info("ā
ServiceMonitor created")
447
448 def create_dashboard(self, app_name: str, environment: str):
449 """Create Grafana dashboard"""
450 logger.info(f"š Creating Grafana dashboard for {app_name}")
451 time.sleep(0.2)
452 logger.info("ā
Dashboard created")
453
454 def create_alerts(self, app_name: str, environment: str, rules: List[Dict]):
455 """Create alert rules"""
456 logger.info(f"šØ Creating {len(rules)} alert rules for {app_name}")
457 time.sleep(0.2)
458 logger.info("ā
Alert rules created")
459
460 def check_metrics_available(self, app_name: str) -> bool:
461 """Check if metrics are being collected"""
462 return True
463
464 def health_check(self) -> str:
465 """Check monitoring system health"""
466 return ComponentStatus.HEALTHY.value
467
468
469# ============================================================================
470# DISASTER RECOVERY MANAGER (Lesson 18: DR Automation)
471# ============================================================================
472
473class DisasterRecoveryManager:
474 """
475 Automated backups and disaster recovery
476 """
477
478 def __init__(self, config: ConfigManager, state: StateManager):
479 self.config = config
480 self.state = state
481 logger.info("š DisasterRecoveryManager initialized")
482
483 def create_backup(self, resource_type: str, resource_id: str) -> Dict:
484 """Create backup"""
485 backup_id = f"backup-{resource_type}-{int(time.time())}"
486 logger.info(f"š¾ Creating backup: {backup_id}")
487
488 time.sleep(0.3)
489
490 backup = {
491 'backup_id': backup_id,
492 'resource_type': resource_type,
493 'resource_id': resource_id,
494 'timestamp': datetime.now().isoformat(),
495 'size_mb': 1024
496 }
497
498 logger.info(f"ā
Backup created: {backup_id}")
499 return backup
500
501
502# ============================================================================
503# COMPLETE DEVOPS PLATFORM (Integrates All Components)
504# ============================================================================
505
506class DevOpsPlatform:
507 """
508 Complete DevOps Automation Platform
509 Integrates all 19 lessons into unified system
510 """
511
512 def __init__(self):
513 logger.info("\n" + "="*70)
514 logger.info("š Initializing Complete DevOps Automation Platform")
515 logger.info("="*70)
516
517 # Initialize core systems
518 self.config = ConfigManager()
519 self.state = StateManager()
520
521 # Initialize components (all lessons)
522 self.infra = InfrastructureManager(self.config, self.state)
523 self.k8s = KubernetesOrchestrator(self.config, self.state)
524 self.cicd = CICDPipeline(self.config, self.state)
525 self.security = SecurityScanner(self.config)
526 self.monitoring = MonitoringSystem(self.config)
527 self.dr = DisasterRecoveryManager(self.config, self.state)
528
529 logger.info("ā
Platform initialized successfully\n")
530
531 def deploy_full_stack(
532 self,
533 app_name: str,
534 version: str,
535 environment: str
536 ) -> Dict:
537 """
538 Deploy complete application stack
539 Demonstrates end-to-end automation workflow
540 """
541 deployment_id = f"{app_name}-{version}-{environment}-{int(time.time())}"
542 start_time = time.time()
543
544 logger.info("\n" + "="*70)
545 logger.info(f"š DEPLOYING FULL STACK: {deployment_id}")
546 logger.info("="*70 + "\n")
547
548 try:
549 # Phase 1: Infrastructure (Lessons 7, 12-13)
550 logger.info("š Phase 1: Infrastructure Provisioning")
551 vpc_id = self.state.get(f'{environment}.vpc_id')
552 if not vpc_id:
553 vpc_result = self.infra.provision_vpc(environment)
554 vpc_id = vpc_result['vpc_id']
555 self.state.update(f'{environment}.vpc_id', vpc_id)
556
557 # Phase 2: Kubernetes Cluster (Lesson 10)
558 logger.info("\nš Phase 2: Kubernetes Cluster Setup")
559 cluster_endpoint = self.state.get(f'{environment}.cluster_endpoint')
560 if not cluster_endpoint:
561 cluster_result = self.k8s.provision_cluster(environment, vpc_id)
562 cluster_endpoint = cluster_result['endpoint']
563 self.state.update(f'{environment}.cluster_endpoint', cluster_endpoint)
564
565 # Phase 3: Build Application (Lesson 11)
566 logger.info("\nš Phase 3: CI/CD Build")
567 build_result = self.cicd.trigger_build(
568 app_name=app_name,
569 version=version,
570 git_ref=f"v{version}"
571 )
572 image_uri = build_result['image_uri']
573
574 # Phase 4: Security Scan (Lesson 16)
575 logger.info("\nš Phase 4: Security Scanning")
576 scan_result = self.security.scan_image(image_uri)
577 if not scan_result.passed:
578 raise Exception(f"Security scan failed: {scan_result.critical_vulns} critical vulnerabilities")
579
580 # Phase 5: Deploy to Kubernetes (Lesson 10)
581 logger.info("\nš Phase 5: Kubernetes Deployment")
582 deploy_result = self.k8s.deploy_application(
583 name=app_name,
584 image=image_uri,
585 version=version,
586 namespace=environment,
587 replicas=3,
588 resources={'cpu': '500m', 'memory': '512Mi'}
589 )
590
591 # Phase 6: Configure Monitoring (Lessons 14-15)
592 logger.info("\nš Phase 6: Monitoring Setup")
593 self.monitoring.create_service_monitor(
594 app_name=app_name,
595 namespace=environment,
596 metrics_path='/metrics',
597 interval='30s'
598 )
599 self.monitoring.create_dashboard(app_name, environment)
600 self.monitoring.create_alerts(
601 app_name=app_name,
602 environment=environment,
603 rules=[
604 {'alert': 'HighErrorRate', 'severity': 'critical'},
605 {'alert': 'HighLatency', 'severity': 'warning'}
606 ]
607 )
608
609 # Phase 7: Disaster Recovery (Lesson 18)
610 logger.info("\nš Phase 7: Backup Configuration")
611 backup_result = self.dr.create_backup(
612 resource_type='deployment',
613 resource_id=deploy_result['deployment_id']
614 )
615
616 duration = time.time() - start_time
617
618 # Final result
619 result = {
620 'deployment_id': deployment_id,
621 'status': DeploymentStatus.SUCCESS.value,
622 'app_name': app_name,
623 'version': version,
624 'environment': environment,
625 'vpc_id': vpc_id,
626 'cluster_endpoint': cluster_endpoint,
627 'image_uri': image_uri,
628 'k8s_deployment': deploy_result['deployment_id'],
629 'backup_id': backup_result['backup_id'],
630 'security_scan': asdict(scan_result),
631 'duration_seconds': round(duration, 2),
632 'timestamp': datetime.now().isoformat()
633 }
634
635 logger.info("\n" + "="*70)
636 logger.info("ā
DEPLOYMENT SUCCESSFUL!")
637 logger.info("="*70)
638
639 return result
640
641 except Exception as e:
642 logger.error(f"\nā Deployment failed: {e}")
643 return {
644 'deployment_id': deployment_id,
645 'status': DeploymentStatus.FAILED.value,
646 'error': str(e)
647 }
648
649 def get_platform_status(self) -> Dict:
650 """Get overall platform health status"""
651 return {
652 'infrastructure': self.infra.health_check(),
653 'kubernetes': self.k8s.health_check(),
654 'cicd': self.cicd.health_check(),
655 'monitoring': self.monitoring.health_check(),
656 'security': self.security.health_check(),
657 'overall': ComponentStatus.HEALTHY.value,
658 'timestamp': datetime.now().isoformat()
659 }
660
661
662# ============================================================================
663# MAIN DEMONSTRATION
664# ============================================================================
665
666def main():
667 """
668 Main entry point - Complete DevOps platform demonstration
669 """
670 print("\n" + "="*70)
671 print("š Complete DevOps Automation Platform - Capstone Project")
672 print("="*70)
673 print("\nIntegrating all 19 lessons:")
674 print(" ⢠Lessons 1-9: Foundation (System Admin, IaC, Docker, Config)")
675 print(" ⢠Lesson 10: Kubernetes Automation")
676 print(" ⢠Lesson 11: CI/CD Pipeline Development")
677 print(" ⢠Lessons 12-13: Multi-Cloud Automation (AWS, Azure, GCP)")
678 print(" ⢠Lessons 14-15: Monitoring & Log Management")
679 print(" ⢠Lesson 16: Security Automation")
680 print(" ⢠Lessons 17-18: Performance & Disaster Recovery")
681 print(" ⢠Lesson 19: API Development for DevOps")
682 print("="*70 + "\n")
683
684 try:
685 # Initialize platform
686 platform = DevOpsPlatform()
687
688 # Check platform health
689 status = platform.get_platform_status()
690 print("š PLATFORM STATUS:")
691 for component, health in status.items():
692 if component != 'timestamp':
693 print(f" {component:15s}: {health}")
694
695 # Deploy full stack application
696 result = platform.deploy_full_stack(
697 app_name='my-web-app',
698 version='1.2.3',
699 environment='production'
700 )
701
702 # Print results
703 print("\n" + "="*70)
704 print("š DEPLOYMENT RESULTS")
705 print("="*70)
706 print(f"Deployment ID: {result['deployment_id']}")
707 print(f"Status: {result['status']}")
708 print(f"Application: {result['app_name']}:{result.get('version', 'N/A')}")
709 print(f"Environment: {result.get('environment', 'N/A')}")
710 print(f"Duration: {result.get('duration_seconds', 0):.2f}s")
711
712 if result['status'] == DeploymentStatus.SUCCESS.value:
713 print(f"\nInfrastructure:")
714 print(f" VPC ID: {result['vpc_id']}")
715 print(f" Cluster: {result['cluster_endpoint']}")
716 print(f"\nDeployment:")
717 print(f" Image: {result['image_uri']}")
718 print(f" K8s Deployment: {result['k8s_deployment']}")
719 print(f" Backup ID: {result['backup_id']}")
720 print(f"\nSecurity Scan:")
721 scan = result['security_scan']
722 print(f" Critical: {scan['critical_vulns']}")
723 print(f" High: {scan['high_vulns']}")
724 print(f" Medium: {scan['medium_vulns']}")
725 print(f" Status: {'ā
PASSED' if scan['passed'] else 'ā FAILED'}")
726
727 print("="*70)
728 logger.info("\nš Capstone project demonstration completed successfully!")
729
730 except KeyboardInterrupt:
731 logger.info("\nā ļø Interrupted by user")
732 sys.exit(130)
733 except Exception as e:
734 logger.error(f"\nā Fatal error: {e}")
735 import traceback
736 traceback.print_exc()
737 sys.exit(1)
738
739
740if __name__ == "__main__":
741 main()š Complete Platform Breakdown:
1. Architecture Integration (All 19 Lessons):
1Platform Components:
2āāā ConfigManager (Lessons 1-2: System Admin)
3āāā StateManager (Lesson 7: Infrastructure as Code)
4āāā InfrastructureManager (Lessons 7, 12-13: IaC + Multi-Cloud)
5āāā KubernetesOrchestrator (Lesson 10: Kubernetes)
6āāā CICDPipeline (Lesson 11: CI/CD)
7āāā SecurityScanner (Lesson 16: Security)
8āāā MonitoringSystem (Lessons 14-15: Monitoring + Logging)
9āāā DisasterRecoveryManager (Lesson 18: DR Automation)2. Deployment Workflow (7 Phases):
Phase 1 - Infrastructure (Lessons 7, 12-13):
Phase 2 - Kubernetes (Lesson 10):
Phase 3 - CI/CD Build (Lesson 11):
Phase 4 - Security Scanning (Lesson 16):
Phase 5 - Kubernetes Deployment (Lesson 10):
Phase 6 - Monitoring (Lessons 14-15):
Phase 7 - Disaster Recovery (Lesson 18):
3. Production Features:
4. Real-World Applications:
5. Key Achievements:
This capstone integrates EVERY concept from all 19 lessons into a unified, production-ready platform that can:
š Congratulations! You've completed the entire DevOps Automation course!
Your progress is saved in this browser, on this device only.