From 9ef7c6393da32d1d563e92e2a6c8b9fa9531310a Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 13 Sep 2026 21:09:16 +0200 Subject: [PATCH] feat: add deploy.sh for robust container deployment --- deploy.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 deploy.sh diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 00000000..7bdad1e8 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Forcefully free port 3002 and redeploy the CMS +PORT=3002 + +echo "--- Preparing for deployment ---" + +# Check if fuser is installed, if not, warn the user +if ! command -v fuser &> /dev/null; then + echo "Error: 'fuser' command not found. Please install psmisc (e.g., sudo apt install psmisc)." + exit 1 +fi + +echo "Forcefully freeing port $PORT..." +# -k kills processes, -n tcp specifies tcp socket +fuser -k $PORT/tcp || echo "No process found on port $PORT or already free." + +echo "Stopping containers..." +docker compose down + +echo "Starting deployment..." +docker compose up -d --build + +echo "--- Deployment initiated ---"