Blue-green deployment

블루·그린 배포

Prepare old and new environments side by side, then switch the entry route.

···
html
<div class="stage" data-phase="0"><div class="title">TRAFFIC SWITCH</div><div class="route">REQUESTS <span></span></div><div class="row environments"><div class="panel blue">BLUE<br>v1</div><div class="panel green">GREEN<br>v2</div></div><div class="sub">verify green, then switch the route</div></div>
css
.stage{width:min(94vw,760px);height:min(88vh,330px);padding:clamp(9px,2.6vmin,20px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,2.5vmin,16px)/1.3 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;display:flex;flex-direction:column;gap:clamp(6px,1.7vmin,12px);overflow:hidden;position:relative}.stage *{min-width:0}.stage .title{color:var(--accent);font-weight:800}.stage .sub{color:var(--muted)}.stage .row{display:flex;align-items:center;gap:clamp(5px,1.6vmin,12px)}.stage .panel{border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(6px,1.6vmin,12px)}.stage .mono{font-family:ui-monospace,SFMono-Regular,monospace;font-size:clamp(12px,2.5vmin,15px)}.stage .grow{flex:1}.stage .on{color:var(--accent)}.route{text-align:center;color:var(--accent)}.route span:after{content:'↙';display:inline-block;font-size:clamp(22px,5vmin,40px);transition:transform .4s}.environments{flex:1;justify-content:center}.environments .panel{width:38%;height:80%;display:grid;place-items:center;text-align:center}.blue{border-color:var(--accent-2)!important;background:color-mix(in srgb,var(--accent-2) 14%,var(--surface))!important}.green{border-color:var(--accent)!important}.stage[data-phase="1"] .green{background:color-mix(in srgb,var(--accent) 15%,var(--surface))}.stage[data-phase="2"] .route span:after{content:'↘'}.stage[data-phase="2"] .green{background:color-mix(in srgb,var(--accent) 29%,var(--surface));box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 20%,transparent)}
js
const stage=document.querySelector('.stage');let phase=0;function advance(){phase=(phase+1)%3;stage.dataset.phase=String(phase)}const timer=setInterval(advance,1200);stage.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})

Blue-green deployment keeps two environments available and switches routing after the new one passes checks. The new environment can be examined before receiving production traffic.

The demo moves the request route from blue to green. Shared resources such as database schemas may need compatibility work because reversing the router alone may not undo those changes.

When to use

Use it when fast switching is valuable and two environments can be kept ready.

Open as page ↗