$ jobs: security-scan: steps: - uses: trufflesecurity/trufflehog@main # leaked secrets with: extra_args: --only-verified - run: -weight: 500;">pip -weight: 500;">install safety && safety check # CVE audit on deps - run: -weight: 500;">docker build -t devops-app ./backend # build locally for scanning - uses: aquasecurity/trivy-action@master # OS-level vuln scan with: severity: 'CRITICAL,HIGH'
jobs: security-scan: steps: - uses: trufflesecurity/trufflehog@main # leaked secrets with: extra_args: --only-verified - run: -weight: 500;">pip -weight: 500;">install safety && safety check # CVE audit on deps - run: -weight: 500;">docker build -t devops-app ./backend # build locally for scanning - uses: aquasecurity/trivy-action@master # OS-level vuln scan with: severity: 'CRITICAL,HIGH'
jobs: security-scan: steps: - uses: trufflesecurity/trufflehog@main # leaked secrets with: extra_args: --only-verified - run: -weight: 500;">pip -weight: 500;">install safety && safety check # CVE audit on deps - run: -weight: 500;">docker build -t devops-app ./backend # build locally for scanning - uses: aquasecurity/trivy-action@master # OS-level vuln scan with: severity: 'CRITICAL,HIGH'
FROM python:3.11-slim AS builder
WORKDIR /app
RUN -weight: 500;">pip -weight: 500;">install --no-cache-dir flask prometheus-client FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY app.py . RUN useradd -u 10001 appuser && chown -R appuser:appuser /app
USER appuser EXPOSE 5000
CMD ["python", "app.py"]
FROM python:3.11-slim AS builder
WORKDIR /app
RUN -weight: 500;">pip -weight: 500;">install --no-cache-dir flask prometheus-client FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY app.py . RUN useradd -u 10001 appuser && chown -R appuser:appuser /app
USER appuser EXPOSE 5000
CMD ["python", "app.py"]
FROM python:3.11-slim AS builder
WORKDIR /app
RUN -weight: 500;">pip -weight: 500;">install --no-cache-dir flask prometheus-client FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
COPY app.py . RUN useradd -u 10001 appuser && chown -R appuser:appuser /app
USER appuser EXPOSE 5000
CMD ["python", "app.py"]
# The entire network fabric
resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true
} resource "aws_subnet" "public" { cidr_block = "10.0.1.0/24" ... }
resource "aws_subnet" "private" { cidr_block = "10.0.2.0/24" ... }
# The entire network fabric
resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true
} resource "aws_subnet" "public" { cidr_block = "10.0.1.0/24" ... }
resource "aws_subnet" "private" { cidr_block = "10.0.2.0/24" ... }
# The entire network fabric
resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" enable_dns_hostnames = true enable_dns_support = true
} resource "aws_subnet" "public" { cidr_block = "10.0.1.0/24" ... }
resource "aws_subnet" "private" { cidr_block = "10.0.2.0/24" ... }
resource "tls_private_key" "rsa_key" { algorithm = "RSA" rsa_bits = 4096
} resource "aws_key_pair" "app_key" { key_name = "${var.project_name}-key" public_key = tls_private_key.rsa_key.public_key_openssh
}
resource "tls_private_key" "rsa_key" { algorithm = "RSA" rsa_bits = 4096
} resource "aws_key_pair" "app_key" { key_name = "${var.project_name}-key" public_key = tls_private_key.rsa_key.public_key_openssh
}
resource "tls_private_key" "rsa_key" { algorithm = "RSA" rsa_bits = 4096
} resource "aws_key_pair" "app_key" { key_name = "${var.project_name}-key" public_key = tls_private_key.rsa_key.public_key_openssh
}
- uses: -weight: 500;">docker/build-push-action@v5 with: context: ./backend push: true tags: | ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:${{ github.sha }}
- uses: -weight: 500;">docker/build-push-action@v5 with: context: ./backend push: true tags: | ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:${{ github.sha }}
- uses: -weight: 500;">docker/build-push-action@v5 with: context: ./backend push: true tags: | ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:${{ github.sha }}
# values.yaml
replicaCount: 2 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi autoscaling: minReplicas: 2 maxReplicas: 5 targetCPUUtilizationPercentage: 70
# values.yaml
replicaCount: 2 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi autoscaling: minReplicas: 2 maxReplicas: 5 targetCPUUtilizationPercentage: 70
# values.yaml
replicaCount: 2 resources: requests: cpu: 100m memory: 128Mi limits: cpu: 200m memory: 256Mi autoscaling: minReplicas: 2 maxReplicas: 5 targetCPUUtilizationPercentage: 70
# argocd/application.yaml
syncPolicy: automated: prune: true # delete resources removed from Git selfHeal: true # revert any manual cluster changes
# argocd/application.yaml
syncPolicy: automated: prune: true # delete resources removed from Git selfHeal: true # revert any manual cluster changes
# argocd/application.yaml
syncPolicy: automated: prune: true # delete resources removed from Git selfHeal: true # revert any manual cluster changes
REQUEST_COUNT = Counter( 'app_requests_total', 'Total number of requests', ['method', 'endpoint', '-weight: 500;">status']
) REQUEST_LATENCY = Histogram( 'app_request_latency_seconds', 'Request duration', ['endpoint']
)
REQUEST_COUNT = Counter( 'app_requests_total', 'Total number of requests', ['method', 'endpoint', '-weight: 500;">status']
) REQUEST_LATENCY = Histogram( 'app_request_latency_seconds', 'Request duration', ['endpoint']
)
REQUEST_COUNT = Counter( 'app_requests_total', 'Total number of requests', ['method', 'endpoint', '-weight: 500;">status']
) REQUEST_LATENCY = Histogram( 'app_request_latency_seconds', 'Request duration', ['endpoint']
)
- alert: HighErrorRate expr: rate(app_requests_total{-weight: 500;">status=~"5.."}[5m]) > 0.1 for: 2m labels: severity: critical - alert: PodCrashLooping expr: rate(kube_pod_container_status_restarts_total[15m]) > 0 for: 5m labels: severity: critical
- alert: HighErrorRate expr: rate(app_requests_total{-weight: 500;">status=~"5.."}[5m]) > 0.1 for: 2m labels: severity: critical - alert: PodCrashLooping expr: rate(kube_pod_container_status_restarts_total[15m]) > 0 for: 5m labels: severity: critical
- alert: HighErrorRate expr: rate(app_requests_total{-weight: 500;">status=~"5.."}[5m]) > 0.1 for: 2m labels: severity: critical - alert: PodCrashLooping expr: rate(kube_pod_container_status_restarts_total[15m]) > 0 for: 5m labels: severity: critical - No code reaches production without passing security checks — automatically
- Infrastructure is version-controlled — no manual clicking in AWS consoles
- Deployments are zero-touch — -weight: 500;">git push is the only operator action
- The cluster corrects itself — manual changes get reverted, failed deploys roll back
- You can see everything — metrics, dashboards, and alerts firing to Slack - ArgoCD detects the change in Git within seconds
- Triggers a rolling -weight: 500;">update on the cluster — zero downtime
- If health checks fail post-deploy, ArgoCD auto-rolls back to the last healthy state
- If someone manually -weight: 500;">kubectl apply's something directly to the cluster, ArgoCD reverts it within minutes