forked from dotnet-architecture/eShopModernizing
-
Notifications
You must be signed in to change notification settings - Fork 2
Epic 8: Deployment Configuration #96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
devin-ai-integration
merged 14 commits into
migration/complete-java-migration-v3
from
epic-8/deployment
May 26, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
21b821a
Merge pull request #44 from Cognition-Partner-Workshops/epic-6/cross-…
devin-ai-integration[bot] 9c28176
feat: add deployment & cutover artifacts for Spring Boot migration
devin-ai-integration[bot] 7c6dc8e
fix: correct table names in CUTOVER.md data integrity queries
devin-ai-integration[bot] 56760ec
NM-167: Create Dockerfile for Spring Boot application
devin-ai-integration[bot] b3e64e0
Merge NM-167: Create Dockerfile for Spring Boot application
devin-ai-integration[bot] aa0ec1b
NM-168: Create GitHub Actions CI/CD workflow for Azure VM deployment
devin-ai-integration[bot] 50ee48c
Merge NM-168: Create GitHub Actions CI/CD workflow for Azure VM deplo…
devin-ai-integration[bot] 049b962
NM-169: Create Azure VM deployment documentation and setup scripts
devin-ai-integration[bot] 779ce6e
Merge NM-169: Create Azure VM deployment documentation and setup scripts
devin-ai-integration[bot] 8425bb2
NM-170: Document rollback plan and cutover procedure
devin-ai-integration[bot] 8d2020b
Merge NM-170: Document rollback plan and cutover procedure
devin-ai-integration[bot] 4b51155
fix: setup-vm.sh accepts environment argument (staging|production)
devin-ai-integration[bot] 939042b
fix: add GHCR auth to deploy jobs and correct docker-compose docs
devin-ai-integration[bot] e3fd680
fix: add environment: staging to health-check job for secret access
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| name: Build & Deploy to Azure VM | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, migration/complete-java-migration] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| env: | ||
| JAVA_VERSION: '21' | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }}/eshop-catalog | ||
| WORKING_DIR: eShopLegacyMVC-SpringBoot | ||
|
|
||
| jobs: | ||
| # ────────────────────────────────────────────── | ||
| # Job 1: Build, Test, and Verify | ||
| # ────────────────────────────────────────────── | ||
| build-and-test: | ||
| name: Build & Test | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
| cache: maven | ||
| cache-dependency-path: ${{ env.WORKING_DIR }}/pom.xml | ||
|
|
||
| - name: Build and run tests | ||
| run: ./mvnw clean verify -B | ||
|
|
||
| - name: Check code formatting (Spotless) | ||
| run: ./mvnw spotless:check -B | ||
|
|
||
| - name: Publish test results | ||
| uses: dorny/test-reporter@v1 | ||
| if: always() | ||
| with: | ||
| name: JUnit Test Results | ||
| path: ${{ env.WORKING_DIR }}/target/surefire-reports/*.xml | ||
| reporter: java-junit | ||
|
|
||
| - name: Upload JaCoCo coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: jacoco-report | ||
| path: ${{ env.WORKING_DIR }}/target/site/jacoco/ | ||
| retention-days: 14 | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Job 2: Build Docker Image and Push to GHCR | ||
| # ────────────────────────────────────────────── | ||
| docker-build-push: | ||
| name: Docker Build & Push | ||
| runs-on: ubuntu-latest | ||
| needs: build-and-test | ||
| if: github.event_name == 'push' | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract Docker metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| type=raw,value=${{ github.sha }} | ||
| type=ref,event=branch | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ${{ env.WORKING_DIR }} | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Job 3: Deploy to Staging (auto-deploy) | ||
| # ────────────────────────────────────────────── | ||
| deploy-staging: | ||
| name: Deploy to Staging | ||
| runs-on: ubuntu-latest | ||
| needs: docker-build-push | ||
| environment: staging | ||
| steps: | ||
| - name: Deploy to staging VM via SSH | ||
| uses: appleboy/ssh-action@v1 | ||
| with: | ||
| host: ${{ secrets.STAGING_VM_HOST }} | ||
| username: ${{ secrets.VM_USERNAME }} | ||
| key: ${{ secrets.VM_SSH_KEY }} | ||
| envs: GHCR_TOKEN | ||
| script: | | ||
| echo "$GHCR_TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
| docker stop eshop-catalog || true | ||
| docker rm eshop-catalog || true | ||
| docker run -d \ | ||
| --name eshop-catalog \ | ||
| --restart unless-stopped \ | ||
| -p 8080:8080 \ | ||
| --env-file /opt/app/staging.env \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
| env: | ||
| GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Job 4: Health Check on Staging | ||
| # ────────────────────────────────────────────── | ||
| health-check-staging: | ||
| name: Staging Health Check | ||
| runs-on: ubuntu-latest | ||
| needs: deploy-staging | ||
|
devin-ai-integration[bot] marked this conversation as resolved.
|
||
| environment: staging | ||
| steps: | ||
| - name: Wait for application startup | ||
| run: sleep 30 | ||
|
|
||
| - name: Verify health endpoint | ||
| run: | | ||
| for i in $(seq 1 10); do | ||
| STATUS=$(curl -sf "${{ secrets.STAGING_URL }}/actuator/health" | jq -r '.status') || true | ||
| if [ "$STATUS" = "UP" ]; then | ||
| echo "Health check passed: status is UP" | ||
| exit 0 | ||
| fi | ||
| echo "Attempt $i: status=$STATUS — retrying in 10s..." | ||
| sleep 10 | ||
| done | ||
| echo "Health check failed after 10 attempts" | ||
| exit 1 | ||
|
|
||
| # ────────────────────────────────────────────── | ||
| # Job 5: Deploy to Production (manual approval) | ||
| # ────────────────────────────────────────────── | ||
| deploy-production: | ||
| name: Deploy to Production | ||
| runs-on: ubuntu-latest | ||
| needs: health-check-staging | ||
| environment: | ||
| name: production | ||
| url: ${{ secrets.PROD_URL }} | ||
| steps: | ||
| - name: Deploy to production VM via SSH | ||
| uses: appleboy/ssh-action@v1 | ||
| with: | ||
| host: ${{ secrets.PROD_VM_HOST }} | ||
| username: ${{ secrets.VM_USERNAME }} | ||
| key: ${{ secrets.VM_SSH_KEY }} | ||
| envs: GHCR_TOKEN | ||
| script: | | ||
| echo "$GHCR_TOKEN" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
| docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
| docker stop eshop-catalog || true | ||
| docker rm eshop-catalog || true | ||
| docker run -d \ | ||
| --name eshop-catalog \ | ||
| --restart unless-stopped \ | ||
| -p 8080:8080 \ | ||
| --env-file /opt/app/production.env \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | ||
| env: | ||
| GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Verify production health | ||
| run: | | ||
| sleep 30 | ||
| for i in $(seq 1 10); do | ||
| STATUS=$(curl -sf "${{ secrets.PROD_URL }}/actuator/health" | jq -r '.status') || true | ||
| if [ "$STATUS" = "UP" ]; then | ||
| echo "Production health check passed: status is UP" | ||
| exit 0 | ||
| fi | ||
| echo "Attempt $i: status=$STATUS — retrying in 10s..." | ||
| sleep 10 | ||
| done | ||
| echo "Production health check failed after 10 attempts" | ||
| exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Build output | ||
| target/ | ||
|
|
||
| # IDE files | ||
| .idea/ | ||
| *.iml | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Docker | ||
| Dockerfile | ||
| docker-compose.yml | ||
| .dockerignore | ||
|
|
||
| # CI/CD | ||
| azure-pipelines.yml | ||
| .github/ | ||
|
|
||
| # Kubernetes | ||
| k8s/ | ||
|
|
||
| # Scripts | ||
| scripts/ | ||
|
|
||
| # Documentation | ||
| *.md | ||
| LICENSE | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.