#!/bin/sh # Start-first rolling update of the API service under load. # # Swarm replaces one task at a time (parallelism 1), waiting for the new task's # health check before removing the old one. Traefik keeps routing to ready tasks. set -eu root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) cd "$root" stack=${STACK_NAME:-lab4} image=${API_IMAGE:-mtusi-messenger-lab4:4.0.1} docker build --build-arg APP_REVISION="$image" -t "$image" . docker service update \ --image "$image" \ --update-order start-first \ --update-parallelism 1 \ --update-delay 5s \ --update-failure-action rollback \ "${stack}_api" docker service ps "${stack}_api" --no-trunc