30 lines
831 B
Bash
Executable File
30 lines
831 B
Bash
Executable File
#!/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..."
|
|
if docker compose up -d --build; then
|
|
./scripts/alert.sh "Deployment successful for EpicNext-Cms"
|
|
echo "--- Deployment successful ---"
|
|
else
|
|
./scripts/alert.sh "Deployment FAILED for EpicNext-Cms"
|
|
echo "--- Deployment FAILED ---"
|
|
exit 1
|
|
fi
|
|
|