From 3946c946825c5d1fa881190018263143d4b92e2f Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 17:57:53 +0300 Subject: [PATCH 01/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 67 +++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index ed40a11..fbf56d5 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -1,11 +1,10 @@ -# .gitea/workflows/sgeupdated.yml name: sgeUpdated CI/CD on: push: branches: - - main # trigger only when code is merged into main - workflow_dispatch: # allow manual trigger + - main # Trigger when code is pushed/merged into main + workflow_dispatch: # Allow manual trigger if needed concurrency: group: sgeupdated-deploy-${{ github.ref }} @@ -14,11 +13,34 @@ concurrency: jobs: deploy: runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Deploy over SSH + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 # Needed to compare the last two commits + + - name: Detect changed files + id: detect + run: | + echo "🔍 Checking which files changed..." + FRONTEND_CHANGED=false + BACKEND_CHANGED=false + + # Get list of changed files between the latest two commits + CHANGED=$(git diff --name-only HEAD^ HEAD || true) + + echo "$CHANGED" | grep -q '^sgeUpdated/sge-frontend/' && FRONTEND_CHANGED=true || true + echo "$CHANGED" | grep -q '^sgeUpdated/sge-backend/' && BACKEND_CHANGED=true || true + + echo "frontend=$FRONTEND_CHANGED" >> $GITHUB_OUTPUT + echo "backend=$BACKEND_CHANGED" >> $GITHUB_OUTPUT + + echo "✅ Frontend changed: $FRONTEND_CHANGED" + echo "✅ Backend changed: $BACKEND_CHANGED" + + - name: Deploy Backend + if: ${{ steps.detect.outputs.backend == 'true' }} uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_HOST }} @@ -28,22 +50,43 @@ jobs: script: | set -euo pipefail + echo "🚀 Starting backend deployment..." cd /home/ubuntu/Bgreen/sgeUpdated git fetch origin main git reset --hard origin/main - echo "⚡ Rebuilding Backend..." + echo "⚙️ Rebuilding Backend..." cd sgeUpdated/sge-backend /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests cd ../.. docker compose up -d --build bgreen-backend - echo "⚡ Rebuilding Frontend..." + echo "✅ Backend deployment complete!" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' + + - name: Deploy Frontend + if: ${{ steps.detect.outputs.frontend == 'true' }} + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script_stop: true + script: | + set -euo pipefail + + echo "🚀 Starting frontend deployment..." + cd /home/ubuntu/Bgreen/sgeUpdated + git fetch origin main + git reset --hard origin/main + + echo "⚙️ Rebuilding Frontend..." cd sgeUpdated/sge-frontend - # npm install + # Uncomment below if needed: + # npm ci # npm run build cd ../.. docker compose up -d --build bgreen-frontend - echo "✅ Deployment complete. Current containers:" - docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' \ No newline at end of file + echo "✅ Frontend deployment complete!" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' -- 2.49.1 From e4621dd9614b814d0fb646f7f097c85ea884c956 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 17:59:25 +0300 Subject: [PATCH 02/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index fbf56d5..5b71729 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -80,7 +80,7 @@ jobs: git fetch origin main git reset --hard origin/main - echo "⚙️ Rebuilding Frontend..." + echo "⚙️ Rebuildingg Frontend..." cd sgeUpdated/sge-frontend # Uncomment below if needed: # npm ci -- 2.49.1 From c6519e075808f66cb08ba469a8372fe35b659bb1 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 18:01:06 +0300 Subject: [PATCH 03/11] back-end pipeline test --- sge-backend/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sge-backend/pom.xml b/sge-backend/pom.xml index 253aacd..5950d13 100644 --- a/sge-backend/pom.xml +++ b/sge-backend/pom.xml @@ -11,7 +11,7 @@ com.sgs sgs - 0.0.5-SNAPSHOT + 0.0.3-SNAPSHOT sgs SGS project for Spring Boot -- 2.49.1 From f21f8693053d85112f8a214561bf27a4d23e5eeb Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 18:42:40 +0300 Subject: [PATCH 04/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 96 ++++++++++++--------------------- 1 file changed, 33 insertions(+), 63 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 5b71729..1973d13 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -1,15 +1,3 @@ -name: sgeUpdated CI/CD - -on: - push: - branches: - - main # Trigger when code is pushed/merged into main - workflow_dispatch: # Allow manual trigger if needed - -concurrency: - group: sgeupdated-deploy-${{ github.ref }} - cancel-in-progress: true - jobs: deploy: runs-on: ubuntu-latest @@ -18,7 +6,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 with: - fetch-depth: 2 # Needed to compare the last two commits + # Fetch all history so we can diff the 'before' and 'after' SHAs + fetch-depth: 0 - name: Detect changed files id: detect @@ -27,66 +16,47 @@ jobs: FRONTEND_CHANGED=false BACKEND_CHANGED=false - # Get list of changed files between the latest two commits - CHANGED=$(git diff --name-only HEAD^ HEAD || true) + # 1. Handle MANUAL RUN (workflow_dispatch) + # If triggered manually, assume we want to deploy everything. + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo " MANUAL RUN: Forcing deployment for both frontend and backend." + FRONTEND_CHANGED=true + BACKEND_CHANGED=true - echo "$CHANGED" | grep -q '^sgeUpdated/sge-frontend/' && FRONTEND_CHANGED=true || true - echo "$CHANGED" | grep -q '^sgeUpdated/sge-backend/' && BACKEND_CHANGED=true || true + # 2. Handle FIRST PUSH (before SHA is all zeros) + # If this is the first push to a new branch, deploy everything. + elif [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then + echo " NEW BRANCH/FIRST PUSH: Forcing deployment for both." + FRONTEND_CHANGED=true + BACKEND_CHANGED=true + + # 3. Handle a normal PUSH event + # Reliably diff between the two SHAs of the push. + else + echo " PUSH EVENT: Diffing from ${{ github.event.before }} to ${{ github.event.after }}" + CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) + + echo "--- Changed Files ---" + echo "$CHANGED" + echo "---------------------" + echo "$CHANGED" | grep -q '^sgeUpdated/sge-frontend/' && FRONTEND_CHANGED=true || true + echo "$CHANGED" | grep -q '^sgeUpdated/sge-backend/' && BACKEND_CHANGED=true || true + fi + + # 4. Set outputs echo "frontend=$FRONTEND_CHANGED" >> $GITHUB_OUTPUT echo "backend=$BACKEND_CHANGED" >> $GITHUB_OUTPUT echo "✅ Frontend changed: $FRONTEND_CHANGED" echo "✅ Backend changed: $BACKEND_CHANGED" + # ... your Deploy Backend and Deploy Frontend steps remain the same ... + - name: Deploy Backend if: ${{ steps.detect.outputs.backend == 'true' }} - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script_stop: true - script: | - set -euo pipefail - - echo "🚀 Starting backend deployment..." - cd /home/ubuntu/Bgreen/sgeUpdated - git fetch origin main - git reset --hard origin/main - - echo "⚙️ Rebuilding Backend..." - cd sgeUpdated/sge-backend - /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests - cd ../.. - docker compose up -d --build bgreen-backend - - echo "✅ Backend deployment complete!" - docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' + # ... (rest of your step) ... - name: Deploy Frontend if: ${{ steps.detect.outputs.frontend == 'true' }} - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script_stop: true - script: | - set -euo pipefail - - echo "🚀 Starting frontend deployment..." - cd /home/ubuntu/Bgreen/sgeUpdated - git fetch origin main - git reset --hard origin/main - - echo "⚙️ Rebuildingg Frontend..." - cd sgeUpdated/sge-frontend - # Uncomment below if needed: - # npm ci - # npm run build - cd ../.. - docker compose up -d --build bgreen-frontend - - echo "✅ Frontend deployment complete!" - docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' + # ... (rest of your step) ... \ No newline at end of file -- 2.49.1 From c411585bd6d8c8bfb3573596c1d01c16d081ea0a Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 18:44:31 +0300 Subject: [PATCH 05/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 1973d13..97ee81c 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -51,7 +51,7 @@ jobs: echo "✅ Frontend changed: $FRONTEND_CHANGED" echo "✅ Backend changed: $BACKEND_CHANGED" - # ... your Deploy Backend and Deploy Frontend steps remain the same ... + # ... your Deploy Baackend and Deploy Frontend steps remain the same ... - name: Deploy Backend if: ${{ steps.detect.outputs.backend == 'true' }} -- 2.49.1 From 2b689a081cde44ff73d28a2edeb67c33266c5368 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 18:50:30 +0300 Subject: [PATCH 06/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 97ee81c..1973d13 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -51,7 +51,7 @@ jobs: echo "✅ Frontend changed: $FRONTEND_CHANGED" echo "✅ Backend changed: $BACKEND_CHANGED" - # ... your Deploy Baackend and Deploy Frontend steps remain the same ... + # ... your Deploy Backend and Deploy Frontend steps remain the same ... - name: Deploy Backend if: ${{ steps.detect.outputs.backend == 'true' }} -- 2.49.1 From 8d1e49fc29a61239a7a99a7848ac7308615263d2 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 21 Oct 2025 18:54:33 +0300 Subject: [PATCH 07/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 114 ++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index 1973d13..a47f898 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -1,3 +1,15 @@ +name: sgeUpdated CI/CD + +on: + push: + branches: + - main # Trigger when code is pushed/merged into main + workflow_dispatch: # Allow manual trigger + +concurrency: + group: sgeupdated-deploy-${{ github.ref }} + cancel-in-progress: true + jobs: deploy: runs-on: ubuntu-latest @@ -5,58 +17,60 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - # Fetch all history so we can diff the 'before' and 'after' SHAs - fetch-depth: 0 + # We no longer need fetch-depth: 2 - - name: Detect changed files - id: detect - run: | - echo "🔍 Checking which files changed..." - FRONTEND_CHANGED=false - BACKEND_CHANGED=false + # + # The "Detect changed files" step has been REMOVED + # - # 1. Handle MANUAL RUN (workflow_dispatch) - # If triggered manually, assume we want to deploy everything. - if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then - echo " MANUAL RUN: Forcing deployment for both frontend and backend." - FRONTEND_CHANGED=true - BACKEND_CHANGED=true - - # 2. Handle FIRST PUSH (before SHA is all zeros) - # If this is the first push to a new branch, deploy everything. - elif [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then - echo " NEW BRANCH/FIRST PUSH: Forcing deployment for both." - FRONTEND_CHANGED=true - BACKEND_CHANGED=true - - # 3. Handle a normal PUSH event - # Reliably diff between the two SHAs of the push. - else - echo " PUSH EVENT: Diffing from ${{ github.event.before }} to ${{ github.event.after }}" - CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) - - echo "--- Changed Files ---" - echo "$CHANGED" - echo "---------------------" - - echo "$CHANGED" | grep -q '^sgeUpdated/sge-frontend/' && FRONTEND_CHANGED=true || true - echo "$CHANGED" | grep -q '^sgeUpdated/sge-backend/' && BACKEND_CHANGED=true || true - fi - - # 4. Set outputs - echo "frontend=$FRONTEND_CHANGED" >> $GITHUB_OUTPUT - echo "backend=$BACKEND_CHANGED" >> $GITHUB_OUTPUT - - echo "✅ Frontend changed: $FRONTEND_CHANGED" - echo "✅ Backend changed: $BACKEND_CHANGED" - - # ... your Deploy Backend and Deploy Frontend steps remain the same ... - - name: Deploy Backend - if: ${{ steps.detect.outputs.backend == 'true' }} - # ... (rest of your step) ... + # The 'if:' condition has been REMOVED + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script_stop: true + script: | + set -euo pipefail + + echo "🚀 Starting backend deployment..." + cd /home/ubuntu/Bgreen/sgeUpdated + git fetch origin main + git reset --hard origin/main + + echo "⚙️ Rebuilding Backend..." + cd sgeUpdated/sge-backend + /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests + cd ../.. + docker compose up -d --build bgreen-backend + + echo "✅ Backend deployment complete!" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' - name: Deploy Frontend - if: ${{ steps.detect.outputs.frontend == 'true' }} - # ... (rest of your step) ... \ No newline at end of file + # The 'if:' condition has been REMOVED + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script_stop: true + script: | + set -euo pipefail + + echo "🚀 Starting frontend deployment..." + cd /home/ubuntu/Bgreen/sgeUpdated + git fetch origin main + git reset --hard origin/main + + echo "⚙️ Rebuildingg Frontend..." + cd sgeUpdated/sge-frontend + # Uncomment below if needed: + # npm ci + # npm run build + cd ../.. + docker compose up -d --build bgreen-frontend + + echo "✅ Frontend deployment complete!" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' \ No newline at end of file -- 2.49.1 From 755d2bfc2b7f1dd089799d57b0f6b7c907024690 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 22 Oct 2025 13:58:49 +0300 Subject: [PATCH 08/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index a47f898..b5c97e8 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -45,7 +45,7 @@ jobs: cd ../.. docker compose up -d --build bgreen-backend - echo "✅ Backend deployment complete!" + echo "✅ Backend deployment complete!" docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' - name: Deploy Frontend -- 2.49.1 From 062e4c2fa07a4be4b719d6d9658d0fb2b9ec3b22 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 22 Oct 2025 17:21:30 +0300 Subject: [PATCH 09/11] Update .gitea/workflows/sgeupdated.yml --- .gitea/workflows/sgeupdated.yml | 45 +++++++-------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index b5c97e8..ed40a11 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -1,10 +1,11 @@ +# .gitea/workflows/sgeupdated.yml name: sgeUpdated CI/CD on: push: branches: - - main # Trigger when code is pushed/merged into main - workflow_dispatch: # Allow manual trigger + - main # trigger only when code is merged into main + workflow_dispatch: # allow manual trigger concurrency: group: sgeupdated-deploy-${{ github.ref }} @@ -13,18 +14,11 @@ concurrency: jobs: deploy: runs-on: ubuntu-latest - steps: - - name: Checkout repository + - name: Checkout repo uses: actions/checkout@v3 - # We no longer need fetch-depth: 2 - # - # The "Detect changed files" step has been REMOVED - # - - - name: Deploy Backend - # The 'if:' condition has been REMOVED + - name: Deploy over SSH uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_HOST }} @@ -34,43 +28,22 @@ jobs: script: | set -euo pipefail - echo "🚀 Starting backend deployment..." cd /home/ubuntu/Bgreen/sgeUpdated git fetch origin main git reset --hard origin/main - echo "⚙️ Rebuilding Backend..." + echo "⚡ Rebuilding Backend..." cd sgeUpdated/sge-backend /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests cd ../.. docker compose up -d --build bgreen-backend - echo "✅ Backend deployment complete!" - docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' - - - name: Deploy Frontend - # The 'if:' condition has been REMOVED - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.SERVER_HOST }} - username: ${{ secrets.SERVER_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script_stop: true - script: | - set -euo pipefail - - echo "🚀 Starting frontend deployment..." - cd /home/ubuntu/Bgreen/sgeUpdated - git fetch origin main - git reset --hard origin/main - - echo "⚙️ Rebuildingg Frontend..." + echo "⚡ Rebuilding Frontend..." cd sgeUpdated/sge-frontend - # Uncomment below if needed: - # npm ci + # npm install # npm run build cd ../.. docker compose up -d --build bgreen-frontend - echo "✅ Frontend deployment complete!" + echo "✅ Deployment complete. Current containers:" docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' \ No newline at end of file -- 2.49.1 From a68aad2b635d0699baf1ffb7e5f2219828225437 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 22 Oct 2025 17:29:51 +0300 Subject: [PATCH 10/11] ++ --- .gitea/workflows/sgeupdated.yml | 65 ++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/sgeupdated.yml b/.gitea/workflows/sgeupdated.yml index ed40a11..f3e7bf9 100644 --- a/.gitea/workflows/sgeupdated.yml +++ b/.gitea/workflows/sgeupdated.yml @@ -1,11 +1,18 @@ -# .gitea/workflows/sgeupdated.yml +# This is the full workflow file with all fixes applied. +# +# It fixes: +# 1. Path errors (cd sge-backend) +# 2. Docker 'container removal' errors (by adding 'docker compose down') +# 3. Runs 'docker compose' from the correct directory (/home/ubuntu/Bgreen) +# 4. Combines backend and frontend into one efficient step + name: sgeUpdated CI/CD on: push: branches: - - main # trigger only when code is merged into main - workflow_dispatch: # allow manual trigger + - main # Trigger when code is pushed/merged into main + workflow_dispatch: # Allow manual trigger concurrency: group: sgeupdated-deploy-${{ github.ref }} @@ -14,11 +21,12 @@ concurrency: jobs: deploy: runs-on: ubuntu-latest + steps: - - name: Checkout repo + - name: Checkout repository uses: actions/checkout@v3 - - name: Deploy over SSH + - name: Deploy Application (Backend & Frontend) uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SERVER_HOST }} @@ -26,24 +34,47 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} script_stop: true script: | + # Exit immediately if any command fails set -euo pipefail - cd /home/ubuntu/Bgreen/sgeUpdated + echo "🚀 Starting deployment..." + + # 1. Go to the main project directory (where docker-compose.yml is) + cd /home/ubuntu/Bgreen + + echo "🔄 Pulling latest code..." + # 2. Go into the repo sub-directory to pull + cd sgeUpdated git fetch origin main git reset --hard origin/main - echo "⚡ Rebuilding Backend..." - cd sgeUpdated/sge-backend + echo "⚙️ Rebuilding Backend..." + # 3. Go to the backend folder (FIXED PATH) + cd sge-backend /opt/apache-maven-3.9.11/bin/mvn clean install -DskipTests - cd ../.. - docker compose up -d --build bgreen-backend + cd .. # Back to sgeUpdated root - echo "⚡ Rebuilding Frontend..." - cd sgeUpdated/sge-frontend - # npm install + echo "⚙️ Rebuilding Frontend..." + # 4. Go to the frontend folder (FIXED PATH) + cd sge-frontend + # Uncomment these if you need to build your frontend + # echo "Installing frontend dependencies..." + # npm ci + # echo "Building frontend..." # npm run build - cd ../.. - docker compose up -d --build bgreen-frontend + cd .. # Back to sgeUpdated root - echo "✅ Deployment complete. Current containers:" - docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' \ No newline at end of file + # 5. Go back to the main project directory + cd .. + # (We are now in /home/ubuntu/Bgreen) + + echo "🛑 Stopping existing services... (FIX for Docker error)" + # 6. Stop services cleanly before building + docker compose down + + echo "🚀 Launching new services..." + # 7. Build and start all services from the correct directory + docker compose up -d --build --remove-orphans + + echo "✅ Deployment complete!" + docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' -- 2.49.1 From 55cfdeb90423d3df93392c259affc1fafe376d20 Mon Sep 17 00:00:00 2001 From: omar Date: Wed, 22 Oct 2025 17:35:30 +0300 Subject: [PATCH 11/11] Update sge-backend/pom.xml --- sge-backend/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sge-backend/pom.xml b/sge-backend/pom.xml index 5950d13..772e2fa 100644 --- a/sge-backend/pom.xml +++ b/sge-backend/pom.xml @@ -11,7 +11,7 @@ com.sgs sgs - 0.0.3-SNAPSHOT + 0.0.4-SNAPSHOT sgs SGS project for Spring Boot -- 2.49.1