Skip to main content
This guide covers production deployment of iii with security hardening, monitoring, and high availability.

Hardened Docker Setup

Run iii with security constraints:
Security flags:
  • --read-only - Read-only root filesystem
  • --tmpfs /tmp - Writable temporary directory
  • --cap-drop=ALL - Drop all Linux capabilities
  • --cap-add=NET_BIND_SERVICE - Allow binding to ports < 1024
  • --security-opt=no-new-privileges:true - Prevent privilege escalation

Docker Compose Production

Use docker-compose.prod.yml for production with Caddy reverse proxy:
docker-compose.prod.yml
Start production stack:

Reverse Proxy (Caddy)

Caddy provides automatic HTTPS with Let’s Encrypt:
Caddyfile
Features:
  • Automatic HTTPS with Let’s Encrypt
  • HTTP/2 and HTTP/3 support
  • Automatic certificate renewal
  • WebSocket proxying
Replace your-domain.com with your actual domain. Caddy will automatically obtain SSL certificates.

Port Configuration

iii exposes four ports: Recommended network setup:
  • Expose port 49134 directly for SDK connections (or via WSS proxy)
  • Proxy ports 3111 and 3112 through Caddy/nginx with HTTPS
  • Keep port 9464 internal (metrics scraping only)

Redis Setup

iii requires Redis for Queue and Stream modules.

Redis Standalone

Enable persistence:

Redis Cluster

For high availability, use Redis Cluster or Redis Sentinel:
Update your config:
config.prod.yaml

Production Configuration

Example production config with security best practices:
config.prod.yaml
Key differences from development:
  • host: 0.0.0.0 - Bind all interfaces (behind reverse proxy)
  • Specific CORS origins (not *)
  • OTLP exporter for traces and logs
  • Reduced sampling ratio (10%)
  • File-based storage with persistent volumes
  • Console logging disabled for logs

Environment Variables

Set production environment variables:
.env
Load with Docker Compose:

Monitoring

Prometheus Metrics

iii exposes Prometheus metrics on port 9464:
prometheus.yml
Available metrics:
  • iii_invocations_total - Total function invocations
  • iii_invocations_error - Failed invocations
  • iii_workers_active - Active worker connections
  • iii_http_requests_total - HTTP requests
  • Custom metrics via OpenTelemetry

Health Checks

iii provides health check endpoints: HTTP health check:
Docker healthcheck:

OpenTelemetry

Export traces and logs to OpenTelemetry Collector:
Collector config:
otel-collector-config.yaml

Scaling

Horizontal Scaling

iii is stateless and can be scaled horizontally:
Requirements:
  • Shared Redis instance for Queue and Stream modules
  • Load balancer for HTTP traffic (Caddy, nginx, HAProxy)
  • Session affinity not required

Load Balancing

Use Caddy with multiple upstream servers:

Backup and Recovery

Redis Backup

Enable Redis persistence:
Backup Redis data:

State Storage Backup

Backup file-based state:
Automated backups:

Security Checklist

1

Run as non-root user

Use distroless image or create non-root user in Dockerfile
2

Read-only filesystem

Run with --read-only and mount writable volumes only where needed
3

Drop capabilities

Use --cap-drop=ALL --cap-add=NET_BIND_SERVICE
4

Network isolation

Use Docker networks, don’t expose internal ports
5

HTTPS/TLS everywhere

Use Caddy or nginx for automatic HTTPS
6

Restrict CORS origins

Set specific allowed origins in production config
7

Environment secrets

Use Docker secrets or external secret managers
8

Update regularly

Keep iii and dependencies updated

Troubleshooting

Connection Issues

Workers can’t connect to WebSocket (port 49134):

Redis Connection

iii can’t connect to Redis:

High Memory Usage

Reduce memory consumption:

Logs

View iii logs:

Next Steps

Monitoring

Set up observability and alerting

Security

Advanced security hardening