Deployment

Vorte applications are designed for containerized deployment. This guide covers Docker, Kubernetes, health probes, Prometheus metrics, and the native Rust engine.

Docker

Generate a Dockerfile

terminal
bash
Copied!
1vorte dockerfile --workers 4 --port 8000

This generates an optimized multi-stage Dockerfile:

terminal
bash
Copied!
1FROM python:3.12-slim AS builder
2WORKDIR /app
3COPY requirements.txt .
4RUN pip install --no-cache-dir -r requirements.txt
5COPY . .
6
7FROM python:3.12-slim
8WORKDIR /app
9COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
10COPY --from=builder /app .
11EXPOSE 8000
12CMD ["vorte", "serve", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]

Docker Compose

example.py
python
Copied!
1vorte docker-compose --with-redis --with-postgres

Generates a docker-compose.yml with all required services:

config.yaml
yaml
Copied!
1version: "3.8"
2services:
3 app:
4 build: .
5 ports:
6 - "8000:8000"
7 environment:
8 - DATABASE_URL=postgresql+asyncpg://user:pass@postgres:5432/mydb
9 - REDIS_URL=redis://redis:6379/0
10 depends_on:
11 - postgres
12 - redis
13 healthcheck:
14 test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
15 interval: 30s
16 timeout: 10s
17 retries: 3
18
19 postgres:
20 image: postgres:16-alpine
21 environment:
22 POSTGRES_USER: user
23 POSTGRES_PASSWORD: pass
24 POSTGRES_DB: mydb
25 volumes:
26 - pgdata:/var/lib/postgresql/data
27
28 redis:
29 image: redis:7-alpine
30 volumes:
31 - redisdata:/data
32
33volumes:
34 pgdata:
35 redisdata:

Kubernetes

Generate Manifests

example.py
python
Copied!
1vorte k8s --namespace production --replicas 3

Health Probes

Vorte provides three built-in endpoints for Kubernetes probes. Configure them in your pod spec:

config.yaml
yaml
Copied!
1spec:
2 containers:
3 - name: vorte-app
4 image: my-registry/vorte-app:latest
5 ports:
6 - containerPort: 8000
7 livenessProbe:
8 httpGet:
9 path: /live
10 port: 8000
11 initialDelaySeconds: 10
12 periodSeconds: 30
13 readinessProbe:
14 httpGet:
15 path: /ready
16 port: 8000
17 initialDelaySeconds: 5
18 periodSeconds: 10
19 startupProbe:
20 httpGet:
21 path: /health
22 port: 8000
23 failureThreshold: 30
24 periodSeconds: 5

Resource Limits

config.yaml
yaml
Copied!
1spec:
2 containers:
3 - name: vorte-app
4 resources:
5 requests:
6 memory: "256Mi"
7 cpu: "250m"
8 limits:
9 memory: "512Mi"
10 cpu: "500m"

Prometheus Integration

Vorte exposes a /metrics endpoint in Prometheus text format. Configure Prometheus to scrape it:

config.yaml
yaml
Copied!
1scrape_configs:
2 - job_name: "vorte-app"
3 metrics_path: "/metrics"
4 scrape_interval: 15s
5 static_configs:
6 - targets: ["vorte-app:8000"]

Available Metrics

MetricTypeDescription
vorte_http_requests_totalcounterTotal HTTP requests by method, path, status
vorte_http_request_duration_secondshistogramRequest latency distribution
vorte_module_stategaugeCurrent state of each module (1=ready)
vorte_ai_tokens_totalcounterAI token usage by provider and type
vorte_db_query_duration_secondshistogramDatabase query latency
vorte_cache_operations_totalcounterCache hits and misses

Rust Engine

Vorte includes an optional Rust engine for serialization, routing, and middleware. It is compiled during installation when Rust 1.75+ is available.

terminal
bash
Copied!
1# Verify the Rust engine is active
2vorte info | grep rust_engine
3# rust_engine: true
4
5# Build with the Rust engine
6pip install vorte --no-binary vorte_serial

The Rust engine provides significant performance improvements for JSON serialization, route matching, and request processing. If Rust is not available, Vorte gracefully falls back to pure Python implementations.

Environment Variables

VariableDefaultDescription
VORTE_ENVdevelopmentApplication environment
VORTE_HOST127.0.0.1Server bind address
VORTE_PORT8000Server bind port
VORTE_WORKERS1Number of worker processes
VORTE_DEBUGfalseEnable debug mode
VORTE_LOG_LEVELinfoLogging level
VORTE_CONFIG_PATHconfig.yamlConfiguration file path
DATABASE_URLNoneDatabase connection string
REDIS_URLNoneRedis connection string
SECRET_KEYNoneApplication secret key

Production Checklist

  • Set VORTE_ENV=production
  • Set VORTE_DEBUG=false
  • Configure SECRET_KEY with a strong random value
  • Set VORTE_WORKERS to match your CPU cores
  • Enable the Rust engine for maximum performance
  • Configure health probes for liveness and readiness
  • Set up Prometheus scraping for the /metrics endpoint
  • Disable the dashboard and info endpoints in production
  • Use HTTPS with a reverse proxy or load balancer
  • Set appropriate resource limits in Kubernetes
Stay in the loop

Get Vorte release notes, module guides, and developer deep-dives. No spam — unsubscribe anytime.