0
0
Nginxdevops~20 mins

Blue-green deployment routing in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Blue-Green Deployment Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Blue-Green Deployment Routing

In a blue-green deployment, two identical environments (blue and green) run different versions of an application. What is the main purpose of routing traffic between these environments?

ATo run both versions simultaneously and merge their databases
BTo gradually shift user traffic from the old version to the new version without downtime
CTo deploy the new version only after the old version is completely shut down
DTo randomly distribute traffic between unrelated applications
Attempts:
2 left
💡 Hint

Think about how users experience updates without interruptions.

💻 Command Output
intermediate
2:00remaining
Nginx Configuration Output for Blue-Green Routing

Given this simplified Nginx snippet for blue-green deployment routing, what will be the upstream server handling requests when the set $upstream variable is set to green?

Nginx
upstream blue {
    server 10.0.0.1:8080;
}

upstream green {
    server 10.0.0.2:8080;
}

server {
    listen 80;
    location / {
        set $upstream green;
        proxy_pass http://$upstream;
    }
}
ARequests are forwarded to 10.0.0.2:8080
BNginx will throw a syntax error due to variable usage in proxy_pass
CRequests are forwarded to 10.0.0.1:8080
DRequests are load balanced between 10.0.0.1:8080 and 10.0.0.2:8080
Attempts:
2 left
💡 Hint

Check which upstream block matches the variable $upstream.

Configuration
advanced
2:00remaining
Identify the Error in Blue-Green Nginx Routing Configuration

Review this Nginx configuration snippet intended for blue-green deployment routing. Which option correctly identifies the error that will prevent proper routing?

Nginx
upstream blue {
    server 10.0.0.1:8080;
}

upstream green {
    server 10.0.0.2:8080;
}

server {
    listen 80;
    location / {
        set $upstream blue;
        proxy_pass http://$upstream/;
    }
}
AThe 'set' directive cannot be used inside location blocks
BThe upstream blocks must be named with IP addresses, not 'blue' or 'green'
CThe trailing slash in proxy_pass causes Nginx to ignore the variable and route incorrectly
DNginx requires proxy_pass to use a fixed URL, variables are not allowed
Attempts:
2 left
💡 Hint

Consider how Nginx handles proxy_pass with variables and trailing slashes.

🔀 Workflow
advanced
2:30remaining
Blue-Green Deployment Switch Workflow Using Nginx

Which sequence of steps correctly describes switching traffic from the blue environment to the green environment using Nginx configuration?

A3,1,2,4
B1,3,2,4
C3,2,1,4
D2,1,3,4
Attempts:
2 left
💡 Hint

Think about the logical order: readiness, config change, reload, then monitor.

Troubleshoot
expert
2:00remaining
Diagnosing Nginx Routing Failure in Blue-Green Deployment

After switching Nginx upstream from blue to green, users report 502 Bad Gateway errors. Which is the most likely cause?

AThe proxy_pass directive is missing the http:// prefix
BNginx configuration syntax error prevents reload
CThe blue upstream block is missing from the config
DThe green backend server at 10.0.0.2:8080 is down or unreachable
Attempts:
2 left
💡 Hint

502 Bad Gateway usually means Nginx cannot connect to the backend server.