Infrastructure & Operations · Version 3.4.0

Deployment Guide

The infrastructure, tooling, and procedures for deploying Condrox AI in production. Covers Docker containers, Kubernetes clusters, CI/CD pipelines, monitoring, and the configuration knobs that control runtime behavior.

Version 3.4.0 July 2026 Docker & Kubernetes

Deployment Options

Condrox AI ships with three deployment paths. Pick the one that matches your scale and operational maturity.

OptionRecommended ForNotes
Docker containerSingle-node deploymentsRecommended for single-node. Uses docker-compose with Prometheus and Grafana included.
Kubernetes clusterProduction scaleRecommended for production scale. 9 manifests in k8s/ cover autoscaling, TLS, network policies, and disruption budgets.
Direct Python executionDevelopment onlyRun python -m condrox directly. Not suitable for production traffic.

For anything beyond local development, use Docker or Kubernetes. Direct Python execution lacks process management, health checks, and restart semantics.

Docker Deployment

The Docker setup uses a multi-stage Dockerfile. The build stage installs all dependencies and compiles any native extensions. The runtime stage is based on python:3.11-slim, which keeps the final image small and reduces attack surface.

Container Characteristics

PropertyValue
Base image (runtime)python:3.11-slim
Build stageFull dependency installation and compilation
Runtime usernovaspire (UID 1000, non-root)
WSGI serverGunicorn with uvicorn workers
Health checkGET /health endpoint

The container runs as a non-root user named novaspire with UID 1000. This means the process cannot modify system files or bind to privileged ports. If you need port 80 or 443, handle that at the load balancer or ingress layer.

Environment Variables

VariablePurposeRequired
API_KEYAuthentication key for API accessYes
KNOWLEDGE_DATA_PATHPath to the knowledge base filesYes
GRAFANA_ADMIN_PASSWORDAdmin password for Grafana instanceYes (with compose)
CONDROX_SKIP_KNOWLEDGE_LOADSkip loading knowledge base on boot (faster startup for testing)No

docker-compose.yml

The included docker-compose.yml defines three services:

Example Commands

# Build the container image
docker build -t condrox-ai:3.4.0 .

# Start all services (API, Prometheus, Grafana)
docker-compose up -d

# View logs
docker-compose logs -f condrox-api

# Stop all services
docker-compose down

The first build takes roughly 90 seconds depending on network speed and whether dependency caches are warm. Subsequent builds use Docker layer caching and complete in under 10 seconds if requirements have not changed.

Kubernetes Deployment

The k8s/ directory contains 9 manifests that cover a production-grade deployment. Apply them with kubectl apply -f k8s/ or integrate them into your GitOps workflow.

Manifest Inventory

ManifestKindPurpose
namespace.yamlNamespaceIsolated condrox namespace
configmap.yamlConfigMapNon-sensitive configuration values
secret.yamlSecretAPI keys and passwords (base64-encoded)
deployment.yamlDeployment3 replicas (configurable)
service.yamlServiceClusterIP, port 8000
ingress.yamlIngressTLS termination at the edge
hpa.yamlHorizontalPodAutoscalerAutoscaling based on CPU
networkpolicy.yamlNetworkPolicyIngress and egress restrictions
pdb.yamlPodDisruptionBudgetMin available 1 during disruptions

Autoscaling

The HorizontalPodAutoscaler scales the deployment based on CPU utilization:

ParameterValue
Min replicas2
Max replicas10
CPU target70%

When average CPU across pods exceeds 70%, the HPA adds replicas up to the max of 10. When CPU drops, it removes replicas down to the min of 2. Scale-up is fast (under 30 seconds once the new pod passes health checks). Scale-down is slower by default to avoid flapping.

Resource Requests and Limits

ResourceRequestLimit
Memory256Mi512Mi
CPU250m500m

Requests guarantee resources for scheduling. Limits cap usage to prevent a single pod from starving its neighbors. Adjust these based on your actual load patterns after reviewing Prometheus metrics.

Networking

The Service exposes the API on port 8000 via ClusterIP. Internal services within the cluster reach the API through this Service. External traffic enters through the Ingress, which terminates TLS before forwarding plaintext to the Service.

The NetworkPolicy restricts traffic in both directions:

The PodDisruptionBudget ensures at least 1 pod stays available during voluntary disruptions like node drains or cluster upgrades. This prevents a rolling update from taking all replicas down at once.

CI/CD Pipeline

The GitHub Actions workflow automates testing, security scanning, building, and deployment. It triggers on every push to main and on all pull requests.

Jobs

JobToolWhat It Does
TestpytestRuns the full test suite (938 tests). Fails the pipeline on any test failure.
SecurityBandit, TrivyBandit runs SAST scanning on Python source. Trivy scans the built container image for known vulnerabilities.
BuildDockerBuilds the container image and pushes it to the registry with a version tag and latest.
DeploykubectlApplies manifests to staging automatically. Production deployment requires manual approval before proceeding.

All jobs must pass for deployment to proceed. A failing test, a Bandit finding above the configured severity, or a Trivy vulnerability match will block the build. The deploy job runs kubectl apply -f k8s/ against the staging cluster first, then waits for a human to click approve before applying to production.

# Trigger the pipeline
git push origin main

# Or open a pull request to run tests and security scans
# without deploying

Monitoring

The API exposes a /metrics endpoint in Prometheus format. Prometheus scrapes it at a configurable interval (default 15 seconds) and Grafana queries Prometheus to populate dashboards.

Metrics

9 metrics are exported:

MetricTypeWhat It Measures
Request countCounterTotal requests processed
Latency histogramHistogramRequest latency distribution in milliseconds
Error rateGaugeCurrent error percentage over a rolling window
Active connectionsGaugeCurrent in-flight requests
Memory usageGaugeProcess RSS in bytes
CPU usageGaugeProcess CPU percentage
Knowledge itemsGaugeNumber of items loaded in the knowledge base
Cache hit rateGaugeEmbedding cache hit percentage
Pipeline stage timingHistogramPer-stage latency for all 18 pipeline stages

Grafana Dashboards

Grafana ships with pre-configured dashboards covering three areas:

The docker-compose.yml includes both Prometheus and Grafana, so a single docker-compose up gives you the full monitoring stack with no extra configuration.

Alerting

Grafana alerting rules are configured for three conditions:

Wire these alerts to your notification channel of choice (Slack, PagerDuty, email) through Grafana's contact points. The alert thresholds are starting points. Tune them based on your baseline traffic patterns.

Configuration

Condrox AI reads its configuration from system_config.yaml, which serves as the central configuration file. Every critical setting can be overridden by an environment variable, which takes precedence over the YAML value. This lets you run the same image in development, staging, and production with different configs.

Key Settings

SettingDefaultNotes
Knowledge data pathE:\Data\condrox\knowledgeConfigurable. Mount this as a volume in Docker or a PersistentVolume in Kubernetes.
Persistence pathSQLite database locationStore on persistent storage. Losing this file means losing session memory and conversation history.
Single instance lockEnabledPrevents multiple instances from writing to the same SQLite database. Disable only if you have external coordination.

The knowledge data path defaults to E:\Data\condrox\knowledge because that is where the development environment stores it. In Docker, override this with KNOWLEDGE_DATA_PATH and mount a volume at that path. In Kubernetes, use a PersistentVolumeClaim.

Performance Characteristics

These numbers come from the benchmark suite running on actual hardware. They describe what you can expect from a single instance under normal load.

MetricValueNotes
API latency (p50)0.748 ms averageSub-millisecond for most requests
Throughput1,785 req/sSingle instance, no horizontal scaling
Memory per request0.010 MB peakPer-request allocation, not sustained
Boot time~3 secondsWith knowledge loading enabled
Test suite938 tests in ~210 secondsFull suite including Evidence Engine integration tests

Boot time drops to under 1 second when CONDROX_SKIP_KNOWLEDGE_LOAD is set, but the API will return empty results for knowledge queries until the base is loaded manually. Use this only for testing.

Production Checklist

Run through this list before pointing real traffic at your deployment. Each item addresses a common failure mode.

Before You Go Live

  • Set API_KEY environment variable to a strong random value. Use at least 32 characters of mixed case, digits, and symbols.
  • Configure CORS_ALLOWED_ORIGINS to your frontend domain. Do not leave it set to wildcard in production.
  • Set up TLS termination at the load balancer or ingress. Redirect all HTTP traffic to HTTPS.
  • Configure persistent storage for the SQLite database. Use a PersistentVolumeClaim in Kubernetes or a named volume in Docker.
  • Mount the knowledge data volume. Confirm the path matches KNOWLEDGE_DATA_PATH.
  • Set up Grafana alerting. Wire the three default alerts to your on-call notification channel.
  • Configure log aggregation. Ship container logs to your central logging system (ELK, Loki, CloudWatch, etc.).
  • Set resource limits appropriate to your cluster. The defaults (256Mi/250m requests, 512Mi/500m limits) are starting points, not gospel.
  • Enable the PodDisruptionBudget. Confirm minAvailable: 1 is set before draining nodes.
  • Test failover with pod deletion. Delete a pod manually and verify the deployment recovers without user-visible errors.

If you cannot check every box, figure out which ones are blocked and why. Going live with gaps in TLS, authentication, or persistence will cause problems that are harder to fix under load.