0
0
Nginxdevops~10 mins

Blue-green deployment routing in Nginx - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the server block for the blue environment.

Nginx
server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://[1];
    }
}
Drag options to blanks, or click blank then click option'
Agreen_backend
Blocalhost:8080
Cblue_backend
D127.0.0.1:3000
Attempts:
3 left
💡 Hint
Common Mistakes
Using the green backend name instead of blue.
Using an IP address instead of the backend name.
2fill in blank
medium

Complete the code to define the upstream block for the green environment.

Nginx
upstream [1] {
    server 10.0.0.2:8080;
    server 10.0.0.3:8080;
}
Drag options to blanks, or click blank then click option'
Abackend_green
Bgreen_backend
Cblue_backend
Dgreen_servers
Attempts:
3 left
💡 Hint
Common Mistakes
Using the blue backend name.
Using a name not matching the proxy_pass directive.
3fill in blank
hard

Fix the error in the load balancer configuration to route traffic to the active environment.

Nginx
server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://[1];
    }
}
Drag options to blanks, or click blank then click option'
Ainactive_backend
Bblue_backend
Cgreen_backend
Dactive_backend
Attempts:
3 left
💡 Hint
Common Mistakes
Hardcoding blue or green backend names instead of using an active alias.
Using a backend name that does not exist.
4fill in blank
hard

Fill both blanks to configure health checks for blue and green upstreams.

Nginx
upstream blue_backend {
    server 10.0.0.1:8080 [1];
}

upstream green_backend {
    server 10.0.0.2:8080 [2];
}
Drag options to blanks, or click blank then click option'
Amax_fails=3
Bmax_fails=5
Cfail_timeout=10s
Dfail_timeout=30s
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same health check settings for both backends.
Mixing max_fails and fail_timeout values incorrectly.
5fill in blank
hard

Fill all three blanks to complete the blue-green deployment routing with sticky sessions.

Nginx
upstream active_backend {
    ip_hash;
    server 10.0.0.1:8080 [1];
    server 10.0.0.2:8080 [2];
}

server {
    listen 80;
    location / {
        proxy_pass http://[3];
    }
}
Drag options to blanks, or click blank then click option'
Amax_fails=3
Bfail_timeout=15s
Cactive_backend
Dmax_fails=5
Attempts:
3 left
💡 Hint
Common Mistakes
Not using the correct backend name in proxy_pass.
Mixing up health check parameters.