> ## Documentation Index
> Fetch the complete documentation index at: https://doc.blueapi.ir/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment Manager: Environment and Strategy Specification

> DeploymentManager orchestrates staging, canary, and production rollouts. This page specifies deployment strategies, approval gates, and state lifecycle.

DeploymentManager orchestrates the progression of model artifacts from staging through canary to production. This page specifies the supported environments, deployment strategies, approval gates, and the state lifecycle of a deployment record.

## Environments

| Environment | Purpose                                          | Auto-promote Allowed |
| ----------- | ------------------------------------------------ | -------------------- |
| Staging     | Integration testing, smoke tests, benchmark runs | No                   |
| Canary      | Limited production traffic, regression detection | No                   |
| Production  | Full traffic, final serving target               | No                   |

Every artifact must pass staging before entering canary. Canary promotion to production requires explicit approval.

## Deployment Strategies

| Strategy   | Description                                             | Risk Level | Use Case                                 |
| ---------- | ------------------------------------------------------- | ---------- | ---------------------------------------- |
| Blue/Green | Two identical environments; traffic switches atomically | Low        | Major version releases, critical updates |
| Rolling    | Gradual replacement of instances                        | Medium     | Patch releases, routine updates          |
| Canary %   | Percentage-based traffic shift                          | Medium     | A/B testing, gradual confidence building |

DeploymentManager selects the strategy based on the model version change type: major versions default to blue/green, minor to rolling, patch to canary % with a 5% initial step.

## Deployment Record State Diagram

A deployment record moves through states as it progresses through environments and strategies.

```mermaid theme={null}
stateDiagram-v2
    [*] --> CREATED: Submit deployment request
    CREATED --> PREPARING: Validate artifact + config
    PREPARING --> STAGING: Deploy to staging
    STAGING --> STAGING_REVIEW: Run smoke tests + benchmarks
    STAGING_REVIEW --> APPROVED: Pass all gates
    STAGING_REVIEW --> REJECTED: Fail gate
    APPROVED --> CANARY: Deploy to canary
    CANARY --> CANARY_REVIEW: Monitor metrics
    CANARY_REVIEW --> APPROVED_CANARY: Pass regression window
    CANARY_REVIEW --> ROLLBACK: Detect regression
    APPROVED_CANARY --> PRODUCTION: Deploy to production
    PRODUCTION --> PRODUCTION_REVIEW: Monitor SLA
    PRODUCTION_REVIEW --> LIVE: Stable
    PRODUCTION_REVIEW --> ROLLBACK: Detect regression
    ROLLBACK --> PREVIOUS: Restore last known good
    REJECTED --> ARCHIVED: Record failure
    LIVE --> [*]
    PREVIOUS --> [*]
    ARCHIVED --> [*]
```

## Approval Gates

| Gate                | Required Role   | Checks                                                    |
| ------------------- | --------------- | --------------------------------------------------------- |
| Staging approval    | Model Engineer  | Smoke tests pass, benchmark baseline met                  |
| Canary approval     | Model Lead      | Canary window elapsed (default 24h), no regression alerts |
| Production approval | Release Manager | All prior gates passed, security review signed            |

<Warning>
  Auto-promotion is disabled for all environments. Every gate requires explicit human approval. This is a security requirement, not configurable.
</Warning>

## Rollback Triggers

DeploymentManager initiates rollback on any of the following conditions:

* Regression alert from [EvaluationEngine](/evaluation/framework)
* Latency or error rate breach from [Monitoring](/operations/monitoring)
* Manual trigger by Release Manager or on-call engineer
* Security incident flagged by [Security Requirements](/security/security-requirements)

Rollback restores the last known good version and freezes traffic to the failing version. See [Model Rollback](/enterprise/model-rollback) for the full protocol.

## Integration

DeploymentManager reads deployment configurations from [Configuration Specification](/interfaces/configuration-specification). It invokes [QuantizationEngine](/deployment/quantization) before staging and [InferenceBackend](/deployment/inference) during environment setup. Deployment records are stored in [ExperimentTracker](/tracking/experiment-tracking) and linked to [Model Lineage](/tracking/model-lineage).
