Follow these best practices to ensure your LangTrain deployments are secure, scalable, and high-performing. Learn about deployment, optimization, monitoring, and compliance.
1# Production deployment configuration23# Terraform infrastructure as code4resource "aws_eks_cluster" "langtrain" {5 name = "langtrain-production"6 role_arn = aws_iam_role.cluster_role.arn7 version = "1.28"89 vpc_config {10 subnet_ids = [aws_subnet.private[*].id]11 endpoint_private_access = true12 endpoint_public_access = false13 security_group_ids = [aws_security_group.cluster.id]14 }1516 encryption_config {17 resources = ["secrets"]18 provider {19 key_id = aws_kms_key.cluster.arn20 }21 }2223 enabled_cluster_log_types = [24 "api", "audit", "authenticator",25 "controllerManager", "scheduler"26 ]27}2829# Kubernetes deployment with best practices30apiVersion: apps/api/v131kind: Deployment32metadata:33 name: langtrain-api34 namespace: langtrain-production35spec:36 replicas: 337 strategy:38 type: RollingUpdate39 rollingUpdate:40 maxUnavailable: 141 maxSurge: 14243 template:44 spec:45 securityContext:46 runAsNonRoot: true47 runAsUser: 100048 fsGroup: 20004950 containers:51 - name: api52 image: langtrain/api:v1.2.353 imagePullPolicy: Always5455 resources:56 requests:57 cpu: "500m"58 memory: "1Gi"59 limits:60 cpu: "2"61 memory: "4Gi"6263 livenessProbe:64 httpGet:65 path: /health66 port: 808067 initialDelaySeconds: 3068 periodSeconds: 106970 readinessProbe:71 httpGet:72 path: /ready73 port: 808074 initialDelaySeconds: 575 periodSeconds: 57677 env:78 - name: DATABASE_PASSWORD79 valueFrom:80 secretKeyRef:81 name: database-secrets82 key: password