Created: 2025-10-06 Updated: 2026-03-23
Status: Revised Draft (v1 – Fully Automated)
This RFC specifies a new supervaizer deploy CLI that fully automates deployment of Supervaizer agents to GCP Cloud Run, AWS App Runner, and DigitalOcean App Platform. The command builds and pushes a Docker image, provisions/updates the service, creates or updates secrets, sets SUPERVAIZER_PUBLIC_URL, verifies health, and prints final endpoints.
Manual deployment requires juggling Docker, registries, provider CLIs, secrets, and health checks. This is slow and error‑prone. A single automated command reduces time‑to‑value, standardizes best practices (health checks, secrets, idempotent updates, rollbacks), and ensures the server’s own assumptions (/.well-known/health, X-API-Key, SUPERVAIZER_PUBLIC_URL) are satisfied out of the box.
- One command to plan → apply → verify for Cloud Run, App Runner, and DO App Platform.
- Idempotent create/update with safe defaults and optional rollback.
- Standardized environment/secret contract for the Server.
- Minimal assumptions: users authenticate with cloud CLIs; we orchestrate with those CLIs.
- Kubernetes/Helm, Azure, custom VPC/LB/DNS/TLS provisioning, CI/CD pipelines.
supervaizer deploy plan [OPTIONS]
supervaizer deploy up [OPTIONS]
supervaizer deploy down [OPTIONS]
supervaizer deploy status [OPTIONS]
supervaizer deploy local [OPTIONS]
supervaizer deploy clean [OPTIONS]
--platform [cloud-run|aws-app-runner|do-app-platform] (required)
--name TEXT # service base name; default from folder
--env [dev|staging|prod] # default: dev
--project-id TEXT # GCP project / AWS account / DO project (if used)
--region TEXT # provider region (e.g., europe-west1, eu-west-1, fra)
--image TEXT # registry/repo:tag; if omitted, computed from git SHA
--port INTEGER # default: 8000
--generate-api-key # create secure API key if missing
--rsa-key-path PATH # optional PEM to persist
--generate-rsa # generate RSA private key secret if none given
--yes # non-interactive
--no-rollback # keep failed revision
--timeout INTEGER # seconds for deploy+verify; sensible default
--verbose # show underlying CLI output (secrets masked)
- plan – Resolve names, detect existing resources, show CREATE/UPDATE/NOOP actions.
- up – Build → Push → Secrets upsert → Service create/update → Set
SUPERVAIZER_PUBLIC_URL→ Verify health → Output. - down – Destroy service and tool-owned secrets; keep images by default.
- status – Print URL, health state, image digest, revision, and key env vars.
- local – Build → Generate secrets → Start Docker Compose → Verify health → Display service info.
- clean – Remove deployment artifacts, generated files, and state with confirmation prompts.
- Service name is deterministic:
${name}-${env}. - If service exists, perform rolling update only when image digest or env/secrets changed.
- On verify failure: automatic rollback to last healthy revision (unless
--no-rollback).
Set for all platforms:
SUPERVAIZER_ENVIRONMENT=--envSUPERVAIZER_HOST=0.0.0.0SUPERVAIZER_PORT=--portSV_LOG_LEVEL=INFO(default)SUPERVAIZER_API_KEY– stored in provider secret store (generated if--generate-api-key)ADMIN_ALLOWED_IPS(optional) – comma-separated IPv4/IPv6 addresses and/or CIDR ranges allowed to access the/adminweb UI; if unset or empty, all IPs are allowed (see../2025_08_ADMIN_README.md). Uses the first hop inX-Forwarded-Forwhen present.- RSA (choose one):
SV_RSA_PRIVATE_KEY(secret value), orSV_RSA_PRIVATE_KEY_PATH(if platform supports volumes)
After provisioning, the CLI reads the assigned URL and sets:
SUPERVAIZER_PUBLIC_URL= provider service URL (applied via a zero‑downtime update).
Health check: /.well-known/health (used for both liveness/readiness in v1).
Note: The current implementation provides both A2A (/.well-known/health) and ACP (/agents/health) health endpoints. The deployment CLI will use /.well-known/health as the primary health check endpoint for consistency with A2A protocol standards.
The supervaizer deploy local command provides a complete local testing environment using Docker Compose, enabling developers to test their Supervaizer agents before deploying to cloud platforms.
supervaizer deploy local [OPTIONS]
Options:
--name TEXT # service base name; default from folder
--env [dev|staging|prod] # default: dev
--port INTEGER # default: 8000
--generate-api-key # create secure API key for testing
--generate-rsa # generate RSA private key for testing
--timeout INTEGER # seconds to wait for service startup; default: 30
--verbose # show Docker Compose output
- Docker Availability Check: Verify Docker is running and accessible.
- Generate Deployment Files: Create Dockerfile, docker-compose.yml, and .dockerignore.
- Generate Test Secrets: Create API key and RSA private key for local testing.
- Build Docker Image: Build the service image with local-test tag.
- Start Services: Launch Docker Compose with generated secrets and environment variables.
- Wait for Service: Poll health endpoint until service is ready or timeout.
- Run Health Checks: Verify all endpoints (health, API docs, optional API health).
- Display Service Info: Show service URL, API key, and access information.
- Automatic Secret Generation: Creates secure test API keys and RSA keys
- Health Verification: Tests
/.well-known/health,/docs, and/agents/healthendpoints - Service Information Display: Shows service URL, API documentation links, and masked secrets
- Cleanup Instructions: Provides commands to stop test services
- Error Handling: Automatic cleanup on failure with detailed error reporting
The local testing sets the following environment variables in Docker Compose:
SUPERVAIZER_ENVIRONMENT=devSUPERVAIZER_HOST=0.0.0.0SUPERVAIZER_PORT={port}SUPERVAIZER_API_KEY={generated-test-key}SV_RSA_PRIVATE_KEY={generated-rsa-key}SV_LOG_LEVEL=INFO
Local testing verifies:
- Basic Health:
GET http://localhost:{port}/.well-known/health - API Health:
GET http://localhost:{port}/agents/health(with API key header) - API Documentation:
GET http://localhost:{port}/docs
- Build & Push: Local Docker build → Artifact Registry push (or
--use-cloud-build). - Secrets: Create/Update Secret Manager entries for
SUPERVAIZER_API_KEYand optionalSV_RSA_PRIVATE_KEY. - Deploy/Update:
gcloud run deploywith--port, env vars,--set-secrets, min instances=1, safe concurrency. - Set Public URL: Fetch service URL → update
SUPERVAIZER_PUBLIC_URLvia config update. - Verify: Poll
GET {url}/.well-known/healthuntil 200 or timeout. - Output: URL,
/docsand/redoclinks, revision, masked secret notes.
- ECR: Ensure repo, login, build & push image.
- Secrets Manager: Upsert
SUPERVAIZER_API_KEYand optionalSV_RSA_PRIVATE_KEY. - Create/Update Service: Port=8000, health path, env + secret refs.
- Set Public URL: Read service URL → update env
SUPERVAIZER_PUBLIC_URL. - Verify and Output as above.
- Registry: Push image to DOCR (or external).
- App Spec: Create or update
do-app-spec.yamlprogrammatically with image, http_port=8000, health path, env & secret items. - Apply:
doctl apps create(first run) ordoctl apps update(subsequent). - Set Public URL: Read assigned URL → update env
SUPERVAIZER_PUBLIC_URLand redeploy. - Verify and Output.
- Docker available and running.
- Provider CLIs authenticated & authorized:
- GCP:
gcloudwith active project; Artifact Registry & Cloud Run APIs enabled. - AWS:
awswith default profile/region; ECR & App Runner permissions. - DO:
doctlauthenticated with access to registry & App Platform.
- GCP:
- Confirms app port and health path; warns if server code deviates from defaults.
- Ensures no plaintext secrets will be written to the repo.
- Validates
supervaizer_control.pyexists and is properly configured. - Checks for required environment variables and provides setup guidance.
- Verifies Dockerfile generation requirements (Python version, dependencies).
- Ensures
.deployment/directory is properly gitignored.
All deployment artifacts are stored under .deployment/ directory (added to .gitignore):
.deployment/Dockerfile(Python slim, EXPOSE 8000,CMD ["python","-m","supervaizer.__main__"]).deployment/.dockerignore(excludes dev files, tests, docs).deployment/docker-compose.yml(local dev/test; uses health check path).deployment/do-app-spec.yaml(DigitalOcean App Platform).deployment/cloudbuild.yaml(optional when--use-cloud-build).deployment/DEPLOY_AUTOMATION.md(how to use the CLI, recover, rollback).deployment/state.json(machine‑generated state: service IDs, URL, image digest, revision).deployment/config.yaml(optional user configuration overrides).deployment/logs/(deployment logs and debug information)
Note: The entire .deployment/ directory is added to .gitignore to prevent accidental commits of deployment artifacts, secrets, and generated files.
- Plan: First run shows CREATE; subsequent runs show UPDATE/NOOP with correct diffs.
- Up: Returns public URL; health passes within timeout;
SUPERVAIZER_PUBLIC_URLis set and reflected in/docslinks. - Update: Changing image/env results in a rolling update with no downtime.
- Rollback: On failed verify, last healthy revision is restored (unless
--no-rollback). - Down: Destroys service and tool‑owned secrets without orphaning provider resources.
- Local: Builds Docker image, generates test secrets, starts Docker Compose, verifies health endpoints, and displays service information.
- Health Check: Service responds to
/.well-known/healthendpoint with 200 status. - API Key: Generated API key works for admin interface access.
- Environment: All required environment variables are properly set.
- Idempotency: Multiple runs of same command produce identical results.
- Error Handling: Clear error messages with actionable recovery steps.
- Secrets never printed; values masked in logs.
- IAM scope guidance documented per provider.
- CLI logs actionable errors and underlying CLI output with
--verbose(still masked).
- Driver modules:
drivers/cloud_run.py,drivers/aws_app_runner.py,drivers/do_app_platform.pyimplementingplan(),up(),down(),status(). - Shared utilities: docker build/push, secret upsert, health verifier, state manager, name & tag resolver.
- Default image tag: git SHA; fallback
:latest.
- ✅ Phase 1: Core Infrastructure - COMPLETED
- ✅ Phase 2: Provider Drivers - COMPLETED
- ✅ Phase 3: CLI Commands - COMPLETED
- ✅ Phase 3.5: Local Testing - COMPLETED
- ✅ Phase 4: Advanced Features - COMPLETED
- 🔄 Phase 5: Testing & Documentation - PENDING
- 🔄 Phase 6: Production Readiness - PENDING
Current Status: All core deployment functionality, local testing, and advanced features are complete. Ready for comprehensive testing and production readiness.
Goal: Establish basic CLI structure and Docker support
Tasks:
-
CLI Structure Setup ✅
- ✅ Add
deploysubcommand to existing CLI (src/supervaizer/cli.py) - ✅ Create
src/supervaizer/deploy/module structure - ✅ Add Docker-related dependencies to
pyproject.toml
- ✅ Add
-
Docker Support ✅
- ✅ Create
Dockerfilegenerator (src/supervaizer/deploy/docker.py) - ✅ Create
.dockerignoregenerator - ✅ Add
docker-compose.ymlgenerator for local testing - ✅ Implement image building and tagging logic
- ✅ Generate all files under
.deployment/directory
- ✅ Create
-
State Management ✅
- ✅ Create deployment state manager (
src/supervaizer/deploy/state.py) - ✅ Implement
.deployment/state.jsonpersistence - ✅ Add state validation and migration logic
- ✅ Create
.deployment/directory structure and.gitignoreentry
- ✅ Create deployment state manager (
-
Initial Testing ✅
- ✅ Unit tests for CLI structure and Docker operations
- ✅ Test Dockerfile generation and validation
- ✅ Test state management and persistence
- ✅ Integration tests with mock Docker API
Dependencies: None (builds on existing CLI)
Status: ✅ COMPLETED - All Phase 1 tasks implemented and tested
Goal: Implement core provider drivers
Tasks:
-
GCP Cloud Run Driver (
src/supervaizer/deploy/drivers/cloud_run.py) ✅- ✅ Artifact Registry integration
- ✅ Secret Manager integration
- ✅ Cloud Run service management
- ✅ Health check verification
-
AWS App Runner Driver (
src/supervaizer/deploy/drivers/aws_app_runner.py) ✅- ✅ ECR integration
- ✅ Secrets Manager integration
- ✅ App Runner service management
- ✅ Health check verification
-
DigitalOcean App Platform Driver (
src/supervaizer/deploy/drivers/do_app_platform.py) ✅- ✅ DOCR integration
- ✅ App Platform service management
- ✅ Health check verification
-
Driver Testing ✅
- ✅ Unit tests for each driver with mocked APIs
- ✅ Test authentication and permission handling
- ✅ Test resource creation, update, and deletion
- ✅ Test error handling and edge cases
- ✅ Integration tests with real provider APIs (dev accounts)
-
Driver Factory ✅
- ✅ Created
driver_factory.pyfor platform-specific driver instantiation - ✅ Added conditional imports to handle missing cloud dependencies
- ✅ Implemented proper error handling for unavailable platforms
- ✅ Created
Dependencies: Phase 1 completion
Status: ✅ COMPLETED - All provider drivers implemented with comprehensive testing
Goal: Implement all CLI commands
Tasks:
-
Plan Command (
src/supervaizer/deploy/commands/plan.py) ✅- ✅ Resource detection and diff generation
- ✅ Cost estimation (optional)
- ✅ Dry-run validation
-
Up Command (
src/supervaizer/deploy/commands/up.py) ✅- ✅ Orchestrate build → push → deploy → verify workflow
- ✅ Handle rollback on failure
- ✅ Progress reporting with rich console
-
Down Command (
src/supervaizer/deploy/commands/down.py) ✅- ✅ Safe resource cleanup
- ✅ Confirmation prompts
- ✅ Resource dependency handling
-
Status Command (
src/supervaizer/deploy/commands/status.py) ✅- ✅ Service health reporting
- ✅ Resource utilization metrics
- ✅ Configuration validation
-
Command Testing ✅
- ✅ Unit tests for each command with mocked dependencies
- ✅ Test command-line argument parsing and validation
- ✅ Test workflow orchestration and error handling
- ✅ Test progress reporting and user feedback
- ✅ Integration tests with real deployments (dev environments)
-
Test Infrastructure ✅
- ✅ Replaced
unittest.mockwithpytest-mockfor better integration - ✅ Added conditional imports to handle missing cloud dependencies
- ✅ Fixed ModuleNotFoundError issues in test discovery
- ✅ Replaced
Dependencies: Phase 2 completion
Status: ✅ COMPLETED - All CLI commands implemented with comprehensive testing
Goal: Implement local Docker testing functionality
Tasks:
-
Local Command Implementation (
src/supervaizer/deploy/commands/local.py) ✅- ✅ Docker availability checking
- ✅ Test secret generation (API keys and RSA keys)
- ✅ Docker Compose service management
- ✅ Health check verification and reporting
- ✅ Service information display
-
Local Testing Features ✅
- ✅ Automatic Docker image building with local-test tag
- ✅ Environment variable configuration for local testing
- ✅ Comprehensive health endpoint testing
- ✅ Service logs display for debugging
- ✅ Cleanup instructions and resource management
-
Local Testing Integration ✅
- ✅ Integration with existing Docker management system
- ✅ Consistent secret generation across local and cloud deployments
- ✅ Health check endpoint validation
- ✅ Error handling and cleanup on failure
-
Local Testing Documentation ✅
- ✅ Created comprehensive 2025_10_LOCAL_TESTING.md guide
- ✅ Added usage examples and troubleshooting
- ✅ Documented environment variables and configuration
- ✅ Provided cleanup and debugging instructions
-
Local Testing Validation ✅
- ✅ Unit tests for all local testing functions
- ✅ Integration tests with Docker Compose
- ✅ Health check endpoint testing
- ✅ Secret generation and validation testing
- ✅ Error handling and cleanup testing
Dependencies: Phase 3 completion
Status: ✅ COMPLETED - Local testing functionality fully implemented with comprehensive testing and documentation
Goal: Add advanced deployment features
Tasks:
-
Secret Management ✅
- ✅ Environment variables setup in docker
- ✅ Centralized environment variable management with
get_docker_env_vars()function - ✅ Factorized environment variable handling in Dockerfile generation
-
Health Verification ✅
- ✅ Enhanced health check endpoints with retry logic and exponential backoff
- ✅ Created comprehensive
health.pyutility module withHealthVerifierclass - ✅ Implemented
HealthCheckConfigfor configurable health check parameters - ✅ Added support for multiple endpoint verification
- ✅ Integrated enhanced health verification into all provider drivers
- ✅ Added detailed health reporting with response times and error messages
-
Clean Command ✅
- ✅ Implemented
supervaizer deploy cleancommand with user confirmation - ✅ Added support for selective cleanup (Docker artifacts only, state only)
- ✅ Created comprehensive cleanup functions with detailed output
- ✅ Added force mode to skip confirmation prompts
- ✅ Implemented verbose mode for detailed cleanup information
- ✅ Added proper error handling and recovery guidance
- ✅ Implemented
Dependencies: Phase 3.5 completion
Status: ✅ COMPLETED - All advanced features implemented with comprehensive functionality
Goal: Comprehensive testing and documentation
Tasks:
-
Testing
-
Unit Testing
- Test all driver classes (
src/supervaizer/deploy/drivers/) - Test all command implementations (
src/supervaizer/deploy/commands/) - Test state management (
src/supervaizer/deploy/state.py) - Test Docker operations (
src/supervaizer/deploy/docker.py) - Test secret management (
src/supervaizer/deploy/secrets.py) - Test health check utilities (
src/supervaizer/deploy/health.py) - Achieve 90%+ code coverage
- Test all driver classes (
-
Integration Testing
- Mock cloud provider APIs for all three platforms
- Test complete deployment workflows (plan → up → status → down)
- Test error handling and rollback scenarios
- Test secret management across providers
- Test state persistence and recovery
-
End-to-End Testing
- Real deployments to dev environments for each provider
- Test with actual
supervaizer_control.pyfiles - Validate health checks and API key functionality
- Test rollback mechanisms with real failures
- Performance testing (deployment time, resource usage)
-
-
Documentation
- Update CLI documentation
- Create deployment guides for each provider
- Add troubleshooting guides
- Update API documentation
Dependencies: Phase 4 completion
Goal: Production-ready release
Tasks:
-
Security Audit
- Secret handling validation
- Permission scope review
- Security best practices implementation
-
Performance Optimization
- Parallel deployment operations
- Caching improvements
- Resource cleanup optimization
-
Release Preparation
- Version bumping and changelog
- Release notes and migration guides
- Community feedback integration
-
Final Testing
- Full regression testing across all providers
- Security testing and penetration testing
- Load testing and performance validation
- User acceptance testing with beta users
- Documentation review and validation
Dependencies: Phase 5 completion
New Dependencies Required:
# Add to pyproject.toml
dependencies = [
# ... existing dependencies ...
"docker>=7.0.0", # Docker SDK for Python
"boto3>=1.34.0", # AWS SDK
"google-cloud-run>=0.10.0", # GCP Cloud Run
"google-cloud-secret-manager>=2.18.0", # GCP Secret Manager
"google-cloud-artifact-registry>=1.8.0", # GCP Artifact Registry
"digitalocean>=0.0.1", # DigitalOcean API
]File Structure:
src/supervaizer/deploy/
├── __init__.py
├── cli.py # Deploy CLI commands
├── state.py # State management
├── docker.py # Docker operations
├── health.py # Health check utilities
├── secrets.py # Secret management
├── drivers/
│ ├── __init__.py
│ ├── base.py # Base driver interface
│ ├── cloud_run.py # GCP Cloud Run
│ ├── aws_app_runner.py # AWS App Runner
│ └── do_app_platform.py # DigitalOcean App Platform
└── commands/
├── __init__.py
├── plan.py
├── up.py
├── down.py
├── status.py
└── local.py # Local Docker testing
- ECS Fargate driver; Azure Container Apps/Instances.
- Separate
/readyendpoint and richer probes. - Canary/blue‑green and traffic splitting where supported.
- CI/CD templates (GitHub Actions) wiring
planon PRs andupon release tags.