zero downtime deploy

    by claude-dev-suite

    1

    Automate blue-green, rolling, and canary deployments with atomic symlinks, Nginx swaps, and health-check rollbacks.

    Free

    3 usesSecurity scanned

    Works with the AI Agents you already use

    zero downtime deploy

    Example session with this skill installed

    I need a bash script for my Node.js app that performs a blue-green swap using Nginx upstreams. It should health check the target port before switching and offer a rollback command.

    • Read your context and instructions
    • Compiled the zero downtime deploy

    This script manages an atomic upstream swap for Nginx by verifying the target application is responsive before updating the active configuration.

    Blue-Green Deployment Script

    #!/bin/bash
    
    # Blue-Green upstream swap for Nginx
    set -euo pipefail
    
    TARGET=${1:-}
    ACTIVE_CONF="/etc/nginx/active_upstream.conf"
    HEALTH_CHECK_TIMEOUT=30
    
    log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; }
    
    # Determine current and target
    current=$(grep -oP 'http://\K[a-z]+' "$ACTIVE_CONF" 2>/dev/null || echo "blue")
    if [[ -z "$TARGET" ]]; then
        TARGET=$([ "$current" = "blue" ] && echo "green" || echo "blue")
    fi
    
    TARGET_PORT=$([ "$TARGET" = "blue" ] && echo "3000" || echo "3001")
    
    log "Health checking $TARGET on port $TARGET_PORT..."
    deadline=$((SECONDS + HEALTH_CHECK_TIMEOUT))
    while [[ $SECONDS -lt $deadline ]]; do
        if curl -fsS --max-time 3 "http://127.0.0.1:${TARGET_PORT}/health" > /dev/null 2>&1; then
            log "$TARGET is healthy"
            break
        fi
        sleep 2
    done
    
    if ! curl -fsS --max-time 3 "http://127.0.0.1:${TARGET_PORT}/health" > /dev/null 2>&1; then
        log "ERROR: Health check failed. Aborting swap."
        exit 1
    fi
    
    # Atomic swap
    TMP_CONF=$(mktemp)
    echo "proxy_pass http://${TARGET};" > "$TMP_CONF"
    sudo mv "$TMP_CONF" "$ACTIVE_CONF"
    sudo nginx -s reload
    
    log "Switched to $TARGET. To rollback: $0 $current"
    

    Next steps

    1. Ensure /etc/nginx/sites-enabled/ includes active_upstream.conf in its location block.
    2. Grant the deploy user NOPASSWD sudo rights for nginx -s reload.
    3. Test the script in a staging environment by simulating a failed health check.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Standard deployments cause service interruptions, broken connections, or data corruption during transitions. Manual SSH updates are error-prone, lack rollback mechanisms, and often fail to validate application health before exposing new code to users.

    What it does

    • Generates Nginx upstream configurations for blue-green and canary traffic splitting.
    • Authors Bash scripts for atomic release management using Capistrano-style symlink swaps.
    • Builds GitHub Actions workflows for SSH-based deployment with health check polling.
    • Designs safe database migration strategies using the expand/contract pattern.
    • Creates automated rollback runbooks to restore service in under 30 seconds.

    Frameworks & tools

    Nginx, GitHub Actions, Systemd, Rsync, Bash, SSH, and any backend capable of health check endpoints (Node.js, Python, Go, etc.).

    Why this beats prompting it yourself

    General LLMs often overlook the race conditions inherent in symlink swaps or the necessity of CREATE INDEX CONCURRENTLY in Postgres. This skill provides production-hardened scripts that include atomic file moves, pre-swap health validation, and automated cleanup of old releases.

    Use cases

    • Implementing zero-downtime blue-green environments on VPS or bare metal.
    • Gradually rolling out features to 10% of users via canary traffic splitting.
    • Setting up CI/CD pipelines that automatically roll back on failed health checks.
    • Planning non-breaking database schema changes for high-traffic apps.

    Known limitations

    Does not support Kubernetes-native objects like Argo Rollouts or cloud-managed services like AWS CodeDeploy. Frontend CDN cache invalidation is out of scope.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    3 uses

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 2 months ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Network Access

    Allowed Hosts

    example.com
    Listed2 months ago

    What's inside

    Frequently Asked Questions

    This skill provides production-ready Bash scripts, Nginx configurations, and GitHub Actions workflows specifically designed to handle atomic symlink swaps and traffic splitting, ensuring your users never see a 502 error during updates.

    The skill includes templates for Nginx upstream management, Capistrano-style directory structures, health-check polling scripts, and automated rollback runbooks.

    Yes, the skill specializes in 'expand/contract' migration patterns and production-safe SQL practices, such as concurrent indexing, to ensure your database stays online during schema changes.

    While it excels at VPS and bare metal environments using Nginx and Systemd, it does not support container orchestration platforms like Kubernetes or proprietary cloud services like AWS CodeDeploy.

    Once you purchase the skill, you will have access to all future updates and optimizations, ensuring your deployment scripts remain compatible with the latest security standards for SSH and Nginx.

    New in DevOps & Cloud

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for DevOps & Cloud.

    Free