Code Monkey home page Code Monkey logo

blue-green's Introduction

Deploy with Vercel

Blue-Green deployments and canary deployments on Vercel

Demo โ†’ https://blue-green.vercel.rocks

Blue-green deployments is a deployment strategy where you serve two versions of your application, "Blue" and "Green". You serve the current version of your application (Blue) and then you can then deploy a different version of your application (Green) without affecting the Blue environment.

This keeps your Blue application running seamlessly for production users while you test and deploy to your Green application. When you're done testing and ready to serve user's your Green application, you can incrementally or fully switch to your new Green application with no perceptible change for your users.

This is typically done using load balancers to direct traffic, but with Vercel's generated urls you can instantly switch which application is served to users seamlessly using Skew Protection, Edge Config, and Middleware in Next.js. By using Skew Protection, the assignment to the blue or green deployments are sticky across Vercel's entire global CDN, edge functions, and serverless function infrastructure. This ensures users are never shuffling between the blue and green deployment in a given session.

The blue-green deployment strategy is great for managing risk, giving you the ability to gradually roll out a new version of your application (including breaking changes) or go back to using the previous version instantaneously.

Getting started

{
  "blue-green-configuration": {
    "deploymentDomainBlue": "https://blue-green-61yvm4f5d.vercel.rocks",
    "deploymentDomainGreen": "https://blue-green-nq2hvhtsv.vercel.rocks",
    "trafficGreenPercent": 50
  }
}

The fields deploymentDomainBlue and deploymentDomainGreen must be valid deployment domains for your projects.

See this project's middleware.ts file for the logic implementing the blue-green logic.

Executing a blue-green deployment

With both deployments using the same Middleware in this project, Vercel will only serve the deployment specified in your Edge Config.

The simplest way to perform a blue-green deployment would be to manually update the Edge Config. Upon saving it, the new deployments will begin serving.

For CI/CD-driven blue-green deployments, you can automate deployments using the Edge Config API in your CI/CD pipeline. You can see a working example of this in action by viewing the GitHub Action in this project. It creates new deployments and updates the Edge Config with the new deployment urls.

blue-green's People

Contributors

cramforce avatar manovotny avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.