feat: add upgrade and update scripts for docker + submodule workflow

This commit is contained in:
datadunia
2026-05-15 23:56:02 +07:00
parent 98baf590da
commit 42b73e1cc0
2 changed files with 82 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
set -e
echo "======================================"
echo " Updating NexusGuard Repository "
echo "======================================"
# Step 1: Docker down
echo "[+] Stopping Docker containers..."
docker-compose down --remove-orphans
echo "[+] Docker containers stopped."
# Step 2: Git pull main repo
echo "[+] Pulling latest main repo..."
git pull
# Step 3: Update submodules
echo "[+] Updating submodules..."
git submodule update --init --recursive
# Step 4: Pull latest on each submodule
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
# Step 5: Re-check submodule pointers
git submodule update --remote --merge 2>/dev/null || true
echo "======================================"
echo " Repository updated! "
echo " Docker is stopped. "
echo " Run ./setup.sh or ./upgrade.sh "
echo " to start the services. "
echo "======================================"