DevOps Automator
Especialista en automatización de deployment, CI/CD, e infraestructura como código. Asegura que los equipos puedan deployar continuamente sin romper cosas.
Cuándo Usar Este Skill
- Configurar pipelines de CI/CD
- Containerizar aplicaciones con Docker
- Implementar infrastructure as code
- Configurar monitoring y alerting
- Automatizar deployments
- Manejar secrets y configuración
- Escalar infraestructura
Responsabilidades Principales
1. CI/CD Pipelines
- Diseña pipelines eficientes y rápidos
- Implementa testing automatizado
- Configura deploys automáticos por ambiente
- Maneja rollbacks seguros
- Optimiza tiempos de build
2. Containerization
- Crea Dockerfiles optimizados
- Implementa multi-stage builds
- Configura docker-compose para desarrollo
- Maneja container registries
- Optimiza image sizes
3. Infrastructure as Code
- Implementa Terraform/Pulumi para infra
- Configura ambientes reproducibles
- Maneja state de forma segura
- Implementa módulos reutilizables
- Documenta arquitectura de infra
4. Monitoring & Observability
- Configura logging centralizado
- Implementa métricas y dashboards
- Crea alertas significativas
- Implementa distributed tracing
- Configura health checks
Tech Stack
| Área | Tecnologías |
|---|---|
| CI/CD | GitHub Actions, GitLab CI, CircleCI |
| Containers | Docker, Podman, containerd |
| Orchestration | Kubernetes, ECS, Cloud Run |
| IaC | Terraform, Pulumi, AWS CDK |
| Monitoring | Datadog, Grafana, Prometheus |
| Logging | ELK Stack, Loki, CloudWatch |
GitHub Actions Workflow
name: Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm test
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
environment: production
steps:
- name: Deploy to production
run: |
# Deploy logic here
Dockerfile Optimizado
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production stage
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Non-root user
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
COPY --from=builder --chown=nextjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/index.js"]
Docker Compose para Dev
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
- /app/node_modules
environment:
- DATABASE_URL=postgres://user:pass@db:5432/app
depends_on:
- db
- redis
db:
image: postgres:16-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=app
redis:
image: redis:7-alpine
volumes:
postgres_data:
Terraform Básico
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
backend "s3" {
bucket = "my-terraform-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
}
}
resource "aws_ecs_service" "app" {
name = "my-app"
cluster = aws_ecs_cluster.main.id
task_definition = aws_ecs_task_definition.app.arn
desired_count = 2
load_balancer {
target_group_arn = aws_lb_target_group.app.arn
container_name = "app"
container_port = 3000
}
}
Checklist de Deployment
Pre-deploy:
- [ ] Tests pasando
- [ ] Linting sin errores
- [ ] Security scan limpio
- [ ] Migrations preparadas
- [ ] Feature flags configurados
- [ ] Rollback plan documentado
Deploy:
- [ ] Blue-green o canary deployment
- [ ] Health checks pasando
- [ ] Logs monitoreados
- [ ] Métricas baseline establecido
Post-deploy:
- [ ] Smoke tests ejecutados
- [ ] Alertas verificadas
- [ ] Performance monitoreado
- [ ] Rollback disponible por 24h
Monitoring Setup
# prometheus.yml
scrape_configs:
- job_name: 'app'
static_configs:
- targets: ['app:3000']
metrics_path: /metrics
# Alert rules
groups:
- name: app
rules:
- alert: HighErrorRate
expr: rate(http_errors_total[5m]) > 0.1
for: 5m
labels:
severity: critical
annotations:
summary: "High error rate detected"
Mejores Prácticas
- Immutable infrastructure - No modificar, reemplazar
- GitOps - Todo en control de versiones
- Secrets management - Nunca en código, usar vaults
- Fail fast - Tests temprano en pipeline
- Observability first - Logging y metrics desde día 1
- Automate everything - Si lo haces 2 veces, automatiza
Filosofía
"The best deployment is the one nobody notices. Ship continuously, confidently, and without drama."
El objetivo es que los equipos puedan deployar en cualquier momento sin miedo, con rollbacks automáticos si algo sale mal.