GitHunt
PS

psenger/deploysync

A configuration drift detection and synchronization tool for deployment environments

DeploySync Logo

DeploySync

Detect, compare, and prevent configuration drift across your deployment environments

Python 3.8+ MIT License Alpha Status Coverage 97%

What is it?FeaturesQuick StartArchitectureUse CasesDocumentation


The Problem

You're deploying to production and something breaks. After hours of debugging, you discover the issue: a configuration value that works in staging is different in production. Sound familiar?

Configuration drift between environments is a silent killer of deployment reliability. It happens gradually—a tweaked timeout here, a changed connection string there—until your environments diverge enough to cause real problems.

DeploySync gives you visibility into configuration differences before they become production incidents.

What is DeploySync?

DeploySync is a Python library for detecting and analyzing configuration drift between deployment environments. It compares configuration dictionaries across dev, staging, and production environments, identifies differences, calculates drift percentages, and helps you maintain configuration consistency.

Environment consistency without the guesswork

Features

Detection Engine

  • Pairwise Comparison — Compare any two environments to find configuration differences
  • Batch Analysis — Compare all environments at once with automatic pair generation
  • Nested Support — Deep comparison of nested configuration structures
  • Drift Metrics — Quantified drift percentage for objective measurement

Configuration

  • Threshold Control — Define what percentage of drift is "significant" for your needs
  • Key Filtering — Ignore sensitive keys (passwords, API keys) during comparison
  • Environment Variables — Configure entirely via environment variables
  • Validation — Built-in configuration validation with detailed error messages

Data Models

  • Environment — Rich environment representation with metadata support
  • ConfigDrift — Detailed drift results with difference breakdowns
  • ComparisonResult — Wrapped results with significance flags
  • SyncOperation — Track sync/rollback operations with status management

Quick Start

1. Install

git clone https://github.com/psenger/deploysync.git
cd deploysync
pip install -r requirements.txt
pip install -e .

2. Detect Drift

from deploysync import DriftDetector, DeploySyncConfig, Environment

# Configure the detector
config = DeploySyncConfig(
    environments={"dev": "https://dev.example.com", "prod": "https://prod.example.com"},
    drift_threshold=0.1,  # 10% threshold (0.1 = 10%)
    ignore_keys=["password", "api_key"]
)
detector = DriftDetector(config)

# Define your environments
dev = Environment(
    name="dev",
    type="development",
    endpoint="https://dev.example.com",
    configuration={"database": {"host": "localhost"}, "debug": True}
)

prod = Environment(
    name="prod",
    type="production",
    endpoint="https://prod.example.com",
    configuration={"database": {"host": "prod-db.example.com"}, "debug": False}
)

# Detect drift
drift = detector.detect_drift(dev, prod)
print(f"Drift: {drift.drift_percentage}% ({drift.difference_count} differences)")

3. Analyze Results

if detector.is_drift_significant(drift):
    print("SIGNIFICANT drift detected!")
    for diff in drift.differences:
        print(f"  {diff['key']}: {diff['source_value']}{diff['target_value']}")

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        DeploySync                               │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐       │
│  │ Environment  │    │ Environment  │    │ Environment  │       │
│  │    (dev)     │    │  (staging)   │    │    (prod)    │       │
│  │              │    │              │    │              │       │
│  │ configuration│    │ configuration│    │ configuration│       │
│  └──────┬───────┘    └──────┬───────┘    └──────┬───────┘       │
│         │                   │                   │               │
│         └───────────────────┼───────────────────┘               │
│                             │                                   │
│                             ▼                                   │
│                   ┌──────────────────┐                          │
│                   │  DriftDetector   │                          │
│                   │                  │                          │
│                   │ • detect_drift() │                          │
│                   │ • batch_detect() │                          │
│                   │ • compare_configs│                          │
│                   └────────┬─────────┘                          │
│                            │                                    │
│                            ▼                                    │
│         ┌──────────────────────────────────────┐                │
│         │            ConfigDrift               │                │
│         │                                      │                │
│         │  • drift_percentage: 25.0%           │                │
│         │  • differences: [{key, values}...]   │                │
│         │  • has_differences: true             │                │
│         └──────────────────────────────────────┘                │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Use Cases

DevOps Engineer

"I need to verify staging matches production before deploying"

results = detector.batch_detect([staging_env, prod_env])
for result in results:
    if result.is_significant:
        print(f"WARNING: {result.summary}")

Platform Team

"We manage dozens of microservices and need to audit configuration consistency"

# Compare all service configurations at once
all_envs = [load_env(name) for name in ["dev", "staging", "prod"]]
results = detector.batch_detect(all_envs)
significant_drifts = [r for r in results if r.is_significant]

SRE Team

"We need to ignore secrets but catch everything else"

config = DeploySyncConfig(
    environments={...},
    drift_threshold=0.05,  # 5% threshold (0.05 = 5%)
    ignore_keys=["password", "secret", "api_key", "token", "credential"]
)

Release Manager

"I want to document what changed between environments"

drift = detector.detect_drift(old_env, new_env)
for diff in drift.differences:
    print(f"| {diff['key']} | {diff['source_value']} | {diff['target_value']} | {diff['type']} |")

Status & Roadmap

DeploySync is in alpha. The core detection engine is stable and well-tested.

Implemented

  • Configuration drift detection between two environments
  • Batch comparison across multiple environments
  • Nested dictionary comparison
  • Configurable drift thresholds
  • Key filtering (ignore sensitive data)
  • Environment variable configuration
  • Comprehensive test suite (97% coverage)

In Progress

  • CLI interface for command-line usage
  • YAML/JSON configuration file support

Planned

  • Webhook notifications for drift alerts
  • Slack/email integration
  • Configuration sync operations
  • Rollback tracking
  • Web dashboard
  • Historical drift tracking

Documentation

Document Description
Getting Started Installation and first drift detection
API Reference Complete API documentation
Configuration All configuration options explained
Examples Common usage patterns and recipes

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=deploysync --cov-report=term-missing

# Run specific module tests
pytest tests/test_detector.py -v

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Priority areas:

  • Documentation improvements
  • Additional test coverage
  • CLI implementation
  • Integration examples

License

MIT License — see LICENSE for details.


Built for teams who believe configuration consistency matters.