Provisioning
Provisioning in Odin defines how and where components are deployed. While service definitions describe what to deploy, provisioning configurations specify the deployment details for each cloud provider and platform.
What is Provisioning?
Section titled “What is Provisioning?”Provisioning configuration maps components to actual cloud resources:
- Kubernetes deployments: Pods, services, ingress
- AWS resources: EC2 instances, RDS databases, ElastiCache
- GCP resources: Compute Engine, Cloud SQL, Memorystore
- Azure resources: VMs, Azure Database, Cache for Redis
Provisioning Configuration Structure
Section titled “Provisioning Configuration Structure”Provisioning configs are JSON files that specify deployment parameters for each component:
[ { "component_name": "api-server", "deployment_type": "kubernetes-deployment", "params": { "namespace": "production", "cpu": "2", "memory": "4Gi", "image": "myregistry/user-api:1.0.0" }, "env_variables": { "DB_HOST": "postgres.prod.svc.cluster.local", "CACHE_URL": "redis://cache:6379" } }, { "component_name": "database", "deployment_type": "rds-postgres", "params": { "instance_class": "db.t3.medium", "storage": "100", "multi_az": true } }]Provisioning Properties
Section titled “Provisioning Properties”Each provisioning entry contains:
| Property | Required | Description |
|---|---|---|
component_name | Yes | Must match a component in the service definition |
deployment_type | Yes | Provider-specific deployment type |
params | Yes | Deployment-specific parameters (varies by type) |
env_variables | No | Environment variables to inject |
Deployment Types
Section titled “Deployment Types”Different deployment types are available for different platforms:
Kubernetes Deployment Types
Section titled “Kubernetes Deployment Types”kubernetes-deployment
Section titled “kubernetes-deployment”Deploy a containerized application:
{ "component_name": "api", "deployment_type": "kubernetes-deployment", "params": { "namespace": "staging", "cpu": "500m", "memory": "1Gi", "replicas": 3, "image": "myregistry/api:1.0.0", "port": 8080, "service_type": "LoadBalancer" }, "env_variables": { "LOG_LEVEL": "info", "DB_CONNECTION_STRING": "postgres://db:5432/myapp" }}kubernetes-statefulset
Section titled “kubernetes-statefulset”Deploy a stateful application:
{ "component_name": "cache", "deployment_type": "kubernetes-statefulset", "params": { "namespace": "staging", "cpu": "1", "memory": "2Gi", "replicas": 3, "image": "redis:7.0", "volume_size": "10Gi", "storage_class": "fast-ssd" }}AWS Deployment Types
Section titled “AWS Deployment Types”rds-postgres / rds-mysql
Section titled “rds-postgres / rds-mysql”Deploy a managed database:
{ "component_name": "database", "deployment_type": "rds-postgres", "params": { "instance_class": "db.r5.large", "storage": "200", "storage_type": "gp3", "multi_az": true, "backup_retention_days": 7, "engine_version": "14.5", "subnet_group": "private-db-subnet", "security_groups": ["sg-12345678"] }}elasticache-redis
Section titled “elasticache-redis”Deploy a managed Redis cluster:
{ "component_name": "cache", "deployment_type": "elasticache-redis", "params": { "node_type": "cache.r5.large", "num_nodes": 3, "engine_version": "7.0", "subnet_group": "private-cache-subnet", "security_groups": ["sg-87654321"], "automatic_failover": true }}ec2-instance
Section titled “ec2-instance”Deploy on EC2:
{ "component_name": "worker", "deployment_type": "ec2-instance", "params": { "instance_type": "t3.medium", "ami": "ami-12345678", "vpc_id": "vpc-abcdef", "subnet_id": "subnet-123456", "key_name": "my-keypair", "security_groups": ["sg-11111111"], "user_data": "#!/bin/bash\n# initialization script" }, "env_variables": { "SERVICE_PORT": "8080" }}GCP Deployment Types
Section titled “GCP Deployment Types”gce-instance
Section titled “gce-instance”Deploy on Google Compute Engine:
{ "component_name": "app", "deployment_type": "gce-instance", "params": { "machine_type": "n1-standard-2", "zone": "us-central1-a", "image": "projects/debian-cloud/global/images/debian-11", "network": "default", "disk_size": "50" }}cloudsql-postgres
Section titled “cloudsql-postgres”Deploy Cloud SQL:
{ "component_name": "database", "deployment_type": "cloudsql-postgres", "params": { "tier": "db-n1-standard-2", "database_version": "POSTGRES_14", "region": "us-central1", "availability_type": "REGIONAL", "disk_size": "100" }}Environment Variables
Section titled “Environment Variables”Provisioning configs can inject environment variables into components:
{ "component_name": "api", "deployment_type": "kubernetes-deployment", "params": { "namespace": "production", "image": "myregistry/api:1.0.0" }, "env_variables": { "NODE_ENV": "production", "LOG_LEVEL": "warn", "DB_HOST": "database.prod.example.com", "DB_PORT": "5432", "DB_NAME": "myapp", "CACHE_URL": "redis://cache.prod.example.com:6379", "API_TIMEOUT": "30000" }}Deploying with Provisioning Configs
Section titled “Deploying with Provisioning Configs”When deploying a service, provide both the service definition and provisioning config:
odin deploy service --env staging \ --file service.json \ --provisioning provisioning.jsonOdin validates that:
- Every component in the service has a provisioning config
- All
component_namevalues match components in the service - Deployment types are supported
- Required parameters are provided
Environment-Specific Provisioning
Section titled “Environment-Specific Provisioning”You can create different provisioning configs for different environments:
provisioning-dev.json:
[ { "component_name": "api", "deployment_type": "kubernetes-deployment", "params": { "namespace": "dev", "cpu": "100m", "memory": "256Mi", "replicas": 1, "image": "myregistry/api:dev" } }, { "component_name": "database", "deployment_type": "rds-postgres", "params": { "instance_class": "db.t3.micro", "storage": "20" } }]provisioning-prod.json:
[ { "component_name": "api", "deployment_type": "kubernetes-deployment", "params": { "namespace": "production", "cpu": "2", "memory": "4Gi", "replicas": 10, "image": "myregistry/api:1.0.0" } }, { "component_name": "database", "deployment_type": "rds-postgres", "params": { "instance_class": "db.r5.2xlarge", "storage": "500", "multi_az": true, "backup_retention_days": 30 } }]Deploy to different environments:
# Devodin deploy service --env dev \ --file service.json \ --provisioning provisioning-dev.json
# Productionodin deploy service --env prod \ --file service.json \ --provisioning provisioning-prod.jsonProvisioning Best Practices
Section titled “Provisioning Best Practices”1. Separate Configs per Environment
Section titled “1. Separate Configs per Environment”Don’t use the same provisioning config for all environments. Create specific configs:
provisioning/ ├── dev.json ├── staging.json └── production.json2. Resource Sizing
Section titled “2. Resource Sizing”Development:
- Small instances/resources
- Minimal replicas
- Basic monitoring
Production:
- Right-sized based on load testing
- High availability (multi-AZ, replicas)
- Enhanced monitoring and backups
3. Secret Management
Section titled “3. Secret Management”Use secret management tools instead of hardcoding:
{ "env_variables": { "DB_PASSWORD": "${SECRET:db-password}", "API_KEY": "${SECRET:api-key}" }}4. Network Configuration
Section titled “4. Network Configuration”Isolate environments with network configuration:
{ "params": { "vpc_id": "vpc-prod-12345", "subnet_id": "subnet-private-67890", "security_groups": ["sg-app-prod"] }}5. Tagging and Labels
Section titled “5. Tagging and Labels”Add tags for cost tracking and organization:
{ "params": { "tags": { "Environment": "production", "Team": "backend", "CostCenter": "engineering", "Service": "user-api" } }}Complete Example
Section titled “Complete Example”service.json:
{ "name": "user-api", "version": "1.0.0", "team": "backend", "components": [ { "name": "api", "type": "webservice", "version": "1.0.0", "depends_on": ["database", "cache"] }, { "name": "database", "type": "postgres", "version": "14.5" }, { "name": "cache", "type": "redis", "version": "7.0" } ]}provisioning.json:
[ { "component_name": "api", "deployment_type": "kubernetes-deployment", "params": { "namespace": "production", "cpu": "2", "memory": "4Gi", "replicas": 5, "image": "myregistry/user-api:1.0.0", "port": 8080, "service_type": "LoadBalancer" }, "env_variables": { "NODE_ENV": "production", "LOG_LEVEL": "info", "DB_HOST": "user-db.prod.rds.amazonaws.com", "DB_PORT": "5432", "DB_NAME": "userdb", "CACHE_HOST": "cache.prod.cache.amazonaws.com", "CACHE_PORT": "6379" } }, { "component_name": "database", "deployment_type": "rds-postgres", "params": { "instance_class": "db.r5.xlarge", "storage": "200", "storage_type": "gp3", "multi_az": true, "engine_version": "14.5", "backup_retention_days": 14, "backup_window": "03:00-04:00", "maintenance_window": "sun:04:00-sun:05:00", "subnet_group": "private-db-subnet", "security_groups": ["sg-db-prod"] } }, { "component_name": "cache", "deployment_type": "elasticache-redis", "params": { "node_type": "cache.r5.large", "num_nodes": 3, "engine_version": "7.0", "subnet_group": "private-cache-subnet", "security_groups": ["sg-cache-prod"], "automatic_failover": true, "snapshot_retention_limit": 7 } }]Deploy:
odin deploy service --env production \ --file service.json \ --provisioning provisioning.jsonRelated Concepts
Section titled “Related Concepts”- Service: Define what to deploy
- Component: Components need provisioning configs
- Environment: Where resources are provisioned