69/71
Sign inSign up free

816. Roll Back to the Right Release

medium 20 XP ~11 minHands-on lab

/srv/lab/site keeps timestamped releases in releases/ (named YYYYMMDD-HHMM) and a symlink current to the one that is live. bin/rollback.sh is the emergency button.

Yesterday it switched the site to a release from last month instead of the previous one. Pressing it a second time did nothing, and bin/rollback.sh 20261131-0000 (a typo) left the site with a broken current link.

Task

Fix bin/rollback.sh [RELEASE]. It uses $SITE_ROOT when set (default /srv/lab/site) and:

  • without an argument switches current to the release that comes just before the current one in name order; rolling back twice goes back two releases,
  • with an argument switches to that release, but only if it is a directory directly inside releases/,
  • fails (non-zero, current unchanged) when the release doesn't exist or there is no older release,
  • on success, appends <time> rollback <from> -> <to> to deploy.log (time as UTC YYYY-MM-DDTHH:MM:SSZ) and prints current: <release>.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.