Skip to main content

Deployment Infrastructure

6.2 Deployment Infrastructure​

Docker​

The SDK is designed for containerised deployment with multi-stage builds that minimise image size and attack surface:

FROM python:3.11-slim as builder
WORKDIR /build
COPY pyproject.toml ./
RUN pip install --no-cache-dir build && python -m build

FROM python:3.11-slim
RUN useradd -m -u 1000 abm && \
apt-get update && apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*
USER abm
WORKDIR /app
COPY --from=builder /build/dist/*.whl ./
RUN pip install --no-cache-dir *.whl
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
COPY model.py ./
CMD ["abm-lab", "serve", "--model", "model.py", "--host", "0.0.0.0", "--port", "8080"]

Build and run:

docker build -t abm-lab:latest .
docker run -p 8080:8080 -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY abm-lab:latest

The non-root user (abm, UID 1000) prevents privilege escalation. The health check endpoint (/health) enables orchestrator health monitoring. The multi-stage build produces images under 200MB.

Helm Chart (Kubernetes)​

The SDK ships a Helm chart with 8 Kubernetes templates for production deployment:

TemplateResourcePurpose
deployment.yamlDeploymentPod specification with settings ConfigMap mount
service.yamlServiceClusterIP service exposing the API port
ingress.yamlIngressExternal HTTP routing (optional)
hpa.yamlHorizontalPodAutoscalerCPU-based auto-scaling
pvc.yamlPersistentVolumeClaimStorage for output and checkpoints
serviceaccount.yamlServiceAccountRBAC identity for pods
configmap.yamlConfigMapsettings.json mounted as a volume

The chart supports three deployment modes: api (REST server), runner (batch MC execution), and mcp (distributed partition server). Key values:

replicaCount: 3
image:
repository: ghcr.io/simudyne/abm-lab
tag: v0.7.0
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
resources:
limits:
cpu: "1000m"
memory: "2Gi"
persistence:
enabled: true
size: 10Gi

Install:

helm install abm-lab ./deploy/helm/abm-lab \
--set image.tag=v0.7.0 \
--set autoscaling.enabled=true \
--set secrets.anthropicApiKey=$ANTHROPIC_API_KEY

The ConfigMap injects settings.json (orchestration, LLM, MC, telemetry configuration) into each pod, ensuring consistent runtime behaviour across replicas. Liveness and readiness probes point to GET /health.