Skip to main content

Blue-Green with HTTP error rollback strategy example

The Blue-Green with HTTP error rollback strategy gradually shifts traffic from the old version (blue) to the new version (green) and automatically rolls back if the HTTP error rate exceeds a defined threshold.

💡 TIP: Use it for production deployments where stability and user experience are critical, especially when a quick rollback is essential.

Using the web interface​

From Platform Settings > Deployment Strategies > New deployment strategy:

  1. Target the configuration: Select the resource, dimensions, and scope types your strategy will apply to.

  2. Name and describe the strategy. For example:

    • Name: Blue-Green with HTTP error rollback
    • Description: Gradual traffic shift with rollback if error rate exceeds 0.3
  3. Configure rollback settings and traffic switch: Use this configuration example for a blue-green deployment with HTTP error rollback.

    deployment-strategy-blue-green

Using the API​

Send a POST request to the Create deployment strategy endpoint with the example request below.

important

If you're using the request example below, remember to set your nrn and dimensions values before sending the request.

curl -L 'https://api.nullplatform.com/deployment_strategy' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
"name": "Blue-Green with HTTP error rollback",
"description": "Gradual traffic shift with rollback if error rate exceeds 0.3",
"nrn": "organization=1:account=2",
"dimensions": {
"environment": "staging"
},
"scope_type_ids": [],
"parameters": {
"type": "object",
"title": "Deployment strategy parameters",
"uiSchema": {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/metrics/properties/enabled",
"label": "Enable metric-based rollback"
},
{
"type": "Control",
"scope": "#/properties/metrics/properties/rules",
"label": "",
"options": {
"style": {
"p": 2,
"bgcolor": "background.surface",
"borderRadius": ".5rem",
"& .MuiInputBase-input": {
"bgcolor": "background.paper",
"borderRadius": ".5rem"
},
"& .MuiOutlinedInput-root": {
"bgcolor": "background.paper",
"borderRadius": ".5rem"
}
}
},
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/metrics/properties/enabled",
"schema": {
"const": true
}
}
}
},
{
"type": "Control",
"scope": "#/properties/traffic/properties/enable_auto_switch",
"label": "Customize traffic switch"
},
{
"type": "Group",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/traffic/properties/enable_auto_switch",
"schema": {
"const": true
}
}
},
"options": {
"style": {
"bgcolor": "background.surface",
"borderRadius": ".em",
"& .MuiInputBase-input": {
"bgcolor": "background.paper"
},
"& .MuiOutlinedInput-root": {
"bgcolor": "background.paper"
}
}
},
"elements": [
{
"type": "Control",
"scope": "#/properties/traffic/properties/step",
"label": "Step size",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/traffic/properties/enable_auto_switch",
"schema": {
"const": true
}
}
}
},
{
"type": "Control",
"scope": "#/properties/traffic/properties/interval",
"label": "Interval in seconds",
"rule": {
"effect": "SHOW",
"condition": {
"scope": "#/properties/traffic/properties/enable_auto_switch",
"schema": {
"const": true
}
}
}
}
]
}
]
},
"properties": {
"metrics": {
"type": "object",
"title": "Metrics configuration",
"description": "Configure metrics monitoring for deployment validation",
"default": {
"enabled": true,
"rules": [
{
"operator": "greater_than",
"name": "http.error_rate",
"threshold": 0.3
}
]
},
"properties": {
"enabled": {
"type": "boolean",
"title": "Enable metric-based rollback",
"description": "Set a criteria for auto-rollback upon certain metric threshold is exceeded.",
"default": true
},
"rules": {
"type": "array",
"items": {
"type": "object",
"title": "Metric rule",
"properties": {
"name": {
"type": "string",
"title": "Metric name",
"description": "Name of the metric to monitor",
"examples": [
"error_rate",
"response_time",
"cpu_usage"
]
},
"operator": {
"type": "string",
"title": "Comparison operator",
"description": "How to compare the metric value against the threshold",
"oneOf": [
{ "const": "greater_than", "title": "Greater than or equal to" },
{ "const": "less_than", "title": "Less than or equal to" },
{ "const": "equals", "title": "Equals to" }
],
"default": "equals"
},
"threshold": {
"type": "number",
"title": "Threshold value",
"description": "Threshold value for the metric",
"placeholder": "eg., 10"
}
}
},
"default": [
{
"operator": "greater_than",
"name": "http.error_rate",
"threshold": 0.3
}
]
}
},
"if": {
"properties": {
"enabled": {
"const": true
}
}
},
"then": {
"properties": {
"rules": {
"minItems": 1,
"items": {
"properties": {
"name": { "minLength": 2 },
"threshold": { "minimum": 0 }
},
"required": ["name", "threshold", "operator"]
}
}
}
}
},
"traffic": {
"type": "object",
"title": "Traffic management",
"description": "Configure traffic switching behavior",
"default": {
"enable_auto_switch": true,
"interval": 30,
"step": 0.1
},
"properties": {
"enable_auto_switch": {
"type": "boolean",
"title": "Customize traffic switch",
"description": "Set the pace at which the traffic switch phase will take place.",
"default": true
},
"interval": {
"type": "integer",
"title": "Interval in seconds",
"description": "Seconds between traffic increments",
"default": 30
},
"step": {
"title": "Step size",
"description": "Traffic increment step as percentage",
"oneOf": [
{ "const": 0.05, "title": "5%" },
{ "const": 0.1, "title": "10%" },
{ "const": 0.15, "title": "15%" },
{ "const": 0.2, "title": "20%" },
{ "const": 0.25, "title": "25%" },
{ "const": 0.3, "title": "30%" },
{ "const": 0.35, "title": "35%" },
{ "const": 0.4, "title": "40%" },
{ "const": 0.45, "title": "45%" },
{ "const": 0.5, "title": "50%" },
{ "const": 1, "title": "100%" }
],
"default": 0.1
}
},
"if": {
"properties": {
"enable_auto_switch": { "const": true }
}
},
"then": {
"required": ["interval", "step"],
"properties": {
"interval": { "minimum": 1, "maximum": 120 }
}
}
}
}
},
"type": "deployment"
}'