>_ IzzyLab

Hands-on task

This task is step 10 of the course “Shipping a release”

A /version endpoint after the rollout

medium~12 min

After a rollout, monitoring checks which version is actually answering. Add a service endpoint to nginx (the site on port 80, config /etc/nginx/sites-enabled/default): GET /version answers with status 200 and the body 2.4.0 straight from the config, without a file on disk. It must fire only on the exact path /version — /version-old, for example, must still return 404.

What you'll practise:
  • nginx
  • location =
  • return
  • service endpoint
  • nginx -s reload

Topic breakdown

Service endpoints like /version or /healthz are polled by monitoring and load balancers, so they must be cheap and predictable. In nginx such a response is built right in the config: the return directive sends a code and a body without touching the disk. The form of location matters: the = modifier means an exact path match and is checked before prefix rules, while a prefix location /version would also grab /version-old and /versions. After editing, the config is checked with nginx -t and applied with a graceful reload — the workers pick it up without dropping connections.

What's checked

  1. /version answers 200
  2. /version returns 2.4.0
  3. /version-old still gives 404
  4. the home page works

What it looks like