From 2f5f6a2fce270c95ec2ee1bb5797cc257a99f975 Mon Sep 17 00:00:00 2001 From: serversdown Date: Mon, 22 Jun 2026 23:04:42 +0000 Subject: [PATCH] chore: add redeploy script --- redeploy.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 redeploy.sh diff --git a/redeploy.sh b/redeploy.sh new file mode 100755 index 0000000..100e310 --- /dev/null +++ b/redeploy.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# +# Rebuild + redeploy a SINGLE compose service without touching the rest of the +# stack. The whole-stack rebuild you keep hitting happens because `web-app` +# depends_on slmm + sfm, so `compose up --build web-app` rebuilds the entire +# dependency tree. `--no-deps` is the fix: build + recreate ONLY this service. +# +# Usage: +# ./redeploy.sh # rebuild + redeploy web-app (prod-style, :8001) +# ./redeploy.sh terra-view # the dev container (:1001, bind-mounted source) +# ./redeploy.sh sfm # any single service +# +# Tip: the dev `terra-view` service bind-mounts the source, so for plain +# code/template edits you usually only need: docker compose restart terra-view +# Rebuild it only when requirements.txt or the Dockerfile changed. + +set -euo pipefail +cd "$(dirname "$0")" + +SVC="${1:-web-app}" + +if ! docker compose config --services | grep -qx "$SVC"; then + echo "✗ '$SVC' is not a service in this compose project." + echo " Available: $(docker compose config --services | paste -sd' ')" + exit 1 +fi + +echo "▶ Rebuilding '$SVC' (dependencies untouched)…" +docker compose build "$SVC" + +echo "▶ Recreating ONLY '$SVC'…" +docker compose up -d --no-deps "$SVC" + +echo +echo "✓ '$SVC' redeployed. Current state:" +docker compose ps "$SVC"