Trial Two Gallery Price Previews

ShellBeginner
Practice Now

Introduction

APERTURE wants to include a new audio guide with admission. A small share of synthetic visitors will try each preview before everyone receives it. You will configure real Nginx routing, compare prices by version, stop an incorrect preview and promote a correct one.

Basic terminal familiarity is enough; HTTP and proxy configuration are introduced here. Workstation contains the prepared tools; Gallery is the visitor website. All services run on one host. These are training requests, without payments or real visitors. This is a decision during a partial rollout, not a pre-release test gate or a promise of zero downtime. Documentation is localized; the website and actual interface labels remain English.

Send a Small Share to a Preview

In this step, start in Gallery. Open Explore the exhibition, then Choose tickets. The normal group is two adults and two children. Select Calculate price: £48 is correct because adults cost £18 and children £6. The new audio guide must add no charge. Open Visit, download the visit guide, then use APERTURE to return home.

Switch to Workstation. pwd prints your directory; cat prints supplied files:

pwd
/home/labex/project/exhibit
cat price-sheet.txt

An HTTP request asks a server for a URL; its response contains a status and content. 200 means the request succeeded, not that the price is right. A proxy receives the public request and forwards it to an upstream, one of our three application versions. 127.0.0.1 means this host; the port identifies a service. Visitors use Nginx on port 8081; ports 9001, 9002, 9003 are classic, preview-a, preview-b.

Edit only upstream.conf. Each Nginx server line names one upstream. weight=4 versus weight=1 gives the preview roughly one fifth of requests, not a guaranteed proportion of people. The semicolon ends a directive. The following here-document replaces the file; the quoted NGINX keeps its text literal. Paste through the final NGINX line:

cat > upstream.conf <<'NGINX'
server 127.0.0.1:9001 weight=4;
server 127.0.0.1:9002 weight=1;
NGINX

The supplied application helper validates these lines, copies them into the native Nginx configuration and reloads it. sudo gives it permission to change this service. It does not judge prices or choose a version:

sudo python3 /opt/labex/exhibit/route.py

Expect Applied native Nginx upstream: and your two lines. A syntax rejection leaves the previous route active: correct the file and apply again.

python3 runs the prepared client. sample sends 80 independent requests through port 8081, without retries, and prints observed prices by version:

python3 traffic.py sample

Look for both classic and preview-a, with at least five responses each. Counts can vary; rerun if either sample is too small. Each run has a new window ID; never combine windows across routing changes. HTTP errors remain visible. If errors occur, reapply the saved route and retry a fresh window; do not treat an incomplete window as evidence. You have now exposed a minority to the preview; the next step uses its business results to decide.

Stop the Incorrect Price Trial

In this step, stay in Workstation and read the previous sample. classic returns [48]; preview-a returns [60] and a nonzero Wrong price count. Both returned HTTP success. Comparing only their combined average would hide which visitors were overcharged. The printed Prices GBP lists every distinct total seen for each version.

The business rule is £48 with no guide surcharge. Stop this candidate. To select only classic, replace the upstream list with one line, apply it and measure a new window:

cat > upstream.conf <<'NGINX'
server 127.0.0.1:9001 weight=1;
NGINX
sudo python3 /opt/labex/exhibit/route.py
python3 traffic.py sample

Expect only classic, 80 responses, [48], zero wrong prices and zero errors. Saving a file alone does not switch traffic. A fresh window after application proves the old version is actually serving requests again.

Switch to Gallery, open Tickets, and calculate the group price. It is £48. Reloading during a mixed trial can choose another version for each request; this exercise has no sticky visitor sessions. The proxy disables upstream retries and closes connections; it does not silently replace a failing preview response with a successful classic response. Real systems require deliberate session and retry policies.

Return to Workstation. The incorrect trial has stopped, but keeping classic forever would not deliver the new guide. Next, evaluate the other preview.

Promote the Correct Guide Preview

In this step, begin in Workstation. Give preview-b the same limited exposure before considering promotion:

cat > upstream.conf <<'NGINX'
server 127.0.0.1:9001 weight=4;
server 127.0.0.1:9003 weight=1;
NGINX
sudo python3 /opt/labex/exhibit/route.py
python3 traffic.py sample

Both versions must have at least five responses and show [48], with zero wrong prices and errors. This bounded test supports continuing; it does not prove every real-world workload is safe. The website, guide and other visitor combinations also matter.

Promote the correct preview by making it the only upstream, then apply and sample again:

cat > upstream.conf <<'NGINX'
server 127.0.0.1:9003 weight=1;
NGINX
sudo python3 /opt/labex/exhibit/route.py
python3 traffic.py sample

Expect only preview-b, 80 responses and [48]. If you used the wrong port, restore the preceding mixed configuration, apply it and repeat the comparison before promoting the correct version. Do not edit prices or supplied programs to manufacture success.

Switch to Gallery and return home. Follow Explore the exhibition: it now describes the included audio guide. Open Choose tickets, calculate £48 for two adults/two children, then £18 for one adult/zero children. Visit Visit and download its real guide. The complete visitor experience must survive promotion; a version label or green check alone is insufficient. Grading reads existing request facts and actual prices; it never changes routes for you.

The promoted preview keeps the family price at £48

Summary

You used real weighted routing to expose a minority of requests, separated business prices by version, stopped an incorrect trial and promoted a correct preview. Independent windows and visible failures kept the decision tied to actual traffic. Small training samples support this exercise's decision, without proving production reliability or zero downtime.