← Back to all products

Deploy Scripts

$19

Python deploy scripts with rollback support, health checks, and zero-downtime deployment patterns.

📁 9 files
JSONMarkdownPythonCI/CD

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 9 files

deploy-scripts/ ├── LICENSE ├── README.md ├── examples/ │ └── deploy_config.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_configuration-reference.md │ └── 03_license.md ├── index.html └── src/ └── deploy_scripts.py

📖 Documentation Preview README excerpt

Deploy Scripts

Part of the Deploy Kit by CodeVault

Production deployment workflow simulator and planner. Implements blue-green deployment, canary releases, rolling updates, and rollback strategies — all as standalone Python scripts you can study, customize, and integrate into your CI/CD pipeline.

Features

  • Blue-Green Deploy: Zero-downtime deployment by switching between two identical environments
  • Canary Deploy: Gradually shift traffic from old to new version with health validation
  • Rolling Update: Sequentially update instances with configurable batch size
  • Rollback Manager: Track deployment history and instantly revert to any previous version
  • All strategies simulated with realistic timing and status output
  • JSON deployment manifest for declarative configuration
  • Dry-run mode to preview what would happen
  • Deployment history logging to JSON file
  • Python stdlib only — zero dependencies

Quick Start


# Run a blue-green deployment
python src/deploy_scripts.py --config examples/deploy_config.json --strategy blue-green

# Run a canary deployment (gradually shift traffic)
python src/deploy_scripts.py --config examples/deploy_config.json --strategy canary

# Rolling update with batch size of 2
python src/deploy_scripts.py --config examples/deploy_config.json --strategy rolling --batch-size 2

# Dry run — preview without executing
python src/deploy_scripts.py --config examples/deploy_config.json --strategy blue-green --dry-run

# Rollback to previous version
python src/deploy_scripts.py --config examples/deploy_config.json --rollback

# View deployment history
python src/deploy_scripts.py --config examples/deploy_config.json --history

Configuration Reference

FieldTypeRequiredDescription
app_namestringYesApplication name
versionstringYesVersion being deployed (e.g., v2.1.0)
environmentstringNoTarget environment (default: staging)
instancesarrayNoList of target hosts/instances
health_check_urlstringNoURL to check after deployment
health_check_timeoutintNoSeconds to wait for health check (default: 30)
canary_stepsarrayNoTraffic percentages for canary (e.g., [10, 25, 50, 100])
rollback_on_failureboolNoAuto-rollback on health check failure (default: true)

CLI Reference

FlagDescription
--config, -cPath to the JSON deploy config (required)
--strategy, -sDeploy strategy: blue-green, canary, rolling
--batch-sizeInstances per batch for rolling updates (default: 1)

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/deploy_scripts.py #!/usr/bin/env python3 """ Deploy Scripts — Deploy Kit by DataNest Production deployment workflow simulator implementing blue-green, canary, and rolling update strategies with rollback support and deployment history. Why this exists: Deployment strategies like blue-green and canary are conceptually simple but tricky to implement correctly. This tool gives you working reference implementations you can study, test in dry-run mode, and adapt to your real infrastructure. It logs every step so you can audit what happened. Usage: python deploy_scripts.py --config deploy.json --strategy blue-green python deploy_scripts.py --config deploy.json --strategy canary python deploy_scripts.py --config deploy.json --strategy rolling --batch-size 2 python deploy_scripts.py --config deploy.json --rollback License: MIT """ from __future__ import annotations import argparse import json import logging import sys import time from dataclasses import dataclass, field, asdict from datetime import datetime, timezone from pathlib import Path from typing import Any # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- STRATEGIES = {"blue-green", "canary", "rolling"} HISTORY_FILE = "deploy_history.json" LOG = logging.getLogger("deploy-scripts") # --------------------------------------------------------------------------- # Data Models # --------------------------------------------------------------------------- @dataclass class Instance: # ... 534 more lines ...
Buy Now — $19 Back to Products