Deployment¶
StratEvo supports Docker deployment for running the API server, MCP server, or scheduled tasks in a containerized environment.
Docker¶
Quick Start¶
# Build the image
docker build -t stratevo .
# Run the API server
docker run -p 8080:8080 stratevo
# Run with environment variables
docker run -p 8080:8080 \
-e OPENAI_API_KEY=sk-... \
-e TELEGRAM_BOT_TOKEN=... \
stratevo
Dockerfile¶
StratEvo ships with a production-ready Dockerfile:
- Base image:
python:3.12-slimfor minimal size - Non-root user: Runs as
stratevouser for security - Health check: Built-in HTTP health check on
/api/v1/health - Exposed port:
8080for the API server
Docker Compose¶
The included docker-compose.yml provides two services:
| Service | Description | Port |
|---|---|---|
stratevo |
CLI/task runner with persistent data volume | — |
stratevo-api |
REST API server with health check | 8080 |
Features:
- Volume mount for persistent data (
./data:/app/data) - Environment variable passthrough for API keys
- Restart policy (
unless-stopped) - Resource limits (memory and CPU)
- Health checks with interval/timeout configuration
Configuration¶
Environment variables for Docker:
| Variable | Description | Default |
|---|---|---|
STRATEVO_PORT |
API server port | 8080 |
STRATEVO_HOST |
Bind address | 0.0.0.0 |
STRATEVO_WORKERS |
Number of worker processes | 2 |
STRATEVO_LOG_LEVEL |
Log level | info |
OPENAI_API_KEY |
OpenAI API key (for AI features) | — |
ANTHROPIC_API_KEY |
Anthropic API key (for AI features) | — |
TELEGRAM_BOT_TOKEN |
Telegram bot token | — |
DISCORD_WEBHOOK_URL |
Discord webhook URL | — |
DeploymentConfig¶
Use the DeploymentConfig class to manage deployment settings programmatically:
from stratevo.deploy import DeploymentConfig
# From environment variables
config = DeploymentConfig.from_env()
print(config.port) # 8080
print(config.workers) # 2
# Custom configuration
config = DeploymentConfig(
port=9090,
workers=4,
host="0.0.0.0",
log_level="warning",
)
assert config.validate()
# Generate .env file
env_content = config.to_env_string()
with open(".env", "w") as f:
f.write(env_content)
Production Recommendations¶
- Use a reverse proxy — Put Nginx or Traefik in front of the API server
- Set resource limits — Use Docker's
--memoryand--cpusflags - Mount volumes — Persist cache and data with
-v ./data:/app/data - Use secrets — Don't bake API keys into images; use environment variables or Docker secrets
- Health checks — The built-in health endpoint at
/api/v1/healthis monitored automatically - Logging — Set
STRATEVO_LOG_LEVEL=warningin production to reduce noise
CI/CD¶
The .github/workflows/release.yml workflow automatically builds and publishes to PyPI on version tags:
For Docker image publishing, add a step to your CI: