Spec a Bash deploy script that can roll back

Vibe codingMedium25 min

Your task

Your app runs on a single Linux server as a systemd service called shopd. Deploys are done by hand today. You want an agent to write the Bash script that does them: download the new build, keep the current release, swap in the new one and restart the service.

Write the spec you would hand the agent.

What you know:

  • releases live in /opt/shopd/releases/<version>, and /opt/shopd/current is a symlink to the live one
  • builds are tarballs at https://builds.internal/shopd/<version>.tar.gz, each with a .sha256 file next to it
  • the service answers GET http://localhost:8080/healthz with 200 once it is ready
  • the script runs as a user that may restart shopd with sudo

Then, in a few sentences: what does a quick "write a deploy script" prompt get wrong?