BeginnerCoder

Lesson 17 — Blue-green switch

Two copies, one switch

Blue-green deployment keeps two identical environments. One (say blue) serves users; you deploy the new version to the other (green), test it, then flip the router so all traffic goes to green. If something is wrong, flip back — the old version is still running.

Note: real DevOps tools (CI servers, load balancers, Docker, Kubernetes) cannot run in your browser, so this exercise is a small plain-JS simulation of the logic those tools use.

Why it matters: deploys and rollbacks become a single, instant switch with zero downtime.

Want it another way?
Task

Finish deploy(): set active to the other color and return a message "now serving <color>".

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.

Keep going with DevOps Foundations

Ready for more? Optional paid resources that pick up where this lesson leaves off.

Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.