Files
Nexus-Guard-Suite/upgrade.sh
T

35 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -e
echo "======================================"
echo " Upgrading NexusGuard SD-WAN Suite... "
echo "======================================"
# Pastikan file env ada
if [ ! -f .env ]; then
echo "[-] ERROR: .env file not found. Please run ./setup.sh first."
exit 1
fi
echo "[+] Pulling latest source code from repository..."
git pull origin main || echo "[!] Git pull skipped or failed, continuing..."
echo "[+] Sourcing environment variables from root .env..."
export $(grep -v '^#' .env | xargs)
echo "[+] Rebuilding Docker images (injecting new environment variables)..."
# Menggunakan --build-arg untuk memastikan Vue/Vite membaca domain API baru
docker-compose build --build-arg VITE_API_BASE_URL=$VITE_API_BASE_URL
echo "[+] Restarting containers..."
docker-compose up -d
echo "[+] Cleaning up unused dangling images to free up space..."
docker image prune -f
echo "======================================"
echo " Upgrade & Rebuild complete! "
echo " Dashboard : http://localhost"
echo " API Port : ${API_PORT:-8080}"
echo "======================================"