diff --git a/apps/dashboard-ui b/apps/dashboard-ui index 924c811..344f513 160000 --- a/apps/dashboard-ui +++ b/apps/dashboard-ui @@ -1 +1 @@ -Subproject commit 924c811d5397f16a3064c03023042e2d284d6767 +Subproject commit 344f513ea50f871ccc5053fd55bdb7f20fc5ad0e diff --git a/docker-compose.yml b/docker-compose.yml index 676d61e..853cd52 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,13 +48,12 @@ services: - IPAM_POOL=10.8.0.0/16 - GIN_MODE=release ports: - - "8080:8080" + - "${API_PORT:-8080}:8080" depends_on: postgres: condition: service_healthy redis: condition: service_healthy - # Requires NET_ADMIN capability for nftables manipulation cap_add: - NET_ADMIN - NET_RAW @@ -62,6 +61,21 @@ services: networks: - nexusnet + dashboard-ui: + build: + context: ./apps/dashboard-ui + dockerfile: Dockerfile + args: + # Inject the root .env variable into the frontend build process + VITE_API_BASE_URL: ${VITE_API_BASE_URL} + ports: + - "80:80" + depends_on: + - server-core + restart: unless-stopped + networks: + - nexusnet + volumes: pgdata: redisdata: diff --git a/upgrade.sh b/upgrade.sh index 28630c6..10f054a 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -2,41 +2,33 @@ set -e echo "======================================" -echo " Upgrading NexusGuard SD-WAN Suite " +echo " Upgrading NexusGuard SD-WAN Suite... " echo "======================================" -# Step 1: Docker down -echo "[+] Stopping Docker containers..." -docker-compose down --remove-orphans -echo "[+] Docker containers stopped." +# Pastikan file env ada +if [ ! -f .env ]; then + echo "[-] ERROR: .env file not found. Please run ./setup.sh first." + exit 1 +fi -# Step 2: Git pull main repo -echo "[+] Pulling latest main repo..." -git pull +echo "[+] Pulling latest source code from repository..." +git pull origin main || echo "[!] Git pull skipped or failed, continuing..." -# Step 3: Update submodules -echo "[+] Updating submodules..." -git submodule update --init --recursive +echo "[+] Sourcing environment variables from root .env..." +export $(grep -v '^#' .env | xargs) -# Step 4: Submodule checkout — pull latest main on each -for sub in apps/server-core apps/device-agent apps/dashboard-ui; do - if [ -d "$sub" ]; then - echo "[+] Updating $sub..." - cd "$sub" - git checkout main 2>/dev/null || git checkout master 2>/dev/null || true - git pull - cd - > /dev/null - fi -done +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 -# Step 5: Re-check superproject submodule pointers -git submodule update --remote --merge 2>/dev/null || true - -# Step 6: Docker up -echo "[+] Starting Docker containers..." +echo "[+] Restarting containers..." docker-compose up -d +echo "[+] Cleaning up unused dangling images to free up space..." +docker image prune -f + echo "======================================" -echo " NexusGuard upgrade complete! " -echo " API Port : 8080 " +echo " Upgrade & Rebuild complete! " +echo " Dashboard : http://localhost" +echo " API Port : ${API_PORT:-8080}" echo "======================================"