Skip to content

Commit

Permalink
azd infra standard folder + copilot springboot and sk upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dantelmomsft committed Sep 12, 2024
1 parent 7ba9498 commit 559edb7
Show file tree
Hide file tree
Showing 32 changed files with 4,765 additions and 192 deletions.
4 changes: 1 addition & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
"version": "2.39.1"
},
"ghcr.io/devcontainers-contrib/features/typescript:2": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "1.1.8"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
"docker-in-docker": {
"version": "latest",
"moby": true,
Expand Down
322 changes: 161 additions & 161 deletions .github/workflows/azure-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,162 +1,162 @@
name: Container Apps CI/CD pipeline

on:
push:
branches:
- main
paths:
- "app/**"
tags:
- v*.*.*
workflow_dispatch:

jobs:
changes-detection:
runs-on: ubuntu-latest
outputs:
env-name: ${{steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT}}
build-copilot: ${{ steps.changes.outputs.copilot }}
build-frontend: ${{ steps.changes.outputs.frontend }}
build-account-api: ${{ steps.changes.outputs.account-api }}
build-payment-api: ${{ steps.changes.outputs.payment-api }}
build-transaction-api: ${{ steps.changes.outputs.transaction-api }}
steps:
- uses: actions/checkout@v2
- name: Filter Changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
copilot:
- 'app/copilot/**'
frontend:
- 'app/frontend/**'
account-api:
- 'app/business-api/account/**'
payment-api:
- 'app/business-api/payment/**'
transaction-api:
- 'app/business-api/transactions-history/**'
- name: Set environment for branch
id: set-deploy-env
run: |
echo "checking branch name [${{github.ref_name}}]"
if [[ ${{github.ref_name}} == 'main' ]]; then
echo "main branch detected. Set Development environment"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'release'* ]]; then
echo "release branch detected. Set Test environment"
echo "DEPLOY_ENVIRONMENT=Test" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'v'* ]]; then
echo "tag detected. Set Production environment"
echo "DEPLOY_ENVIRONMENT=Production" >> "$GITHUB_OUTPUT"
else
echo "branch not detected. Set Development environment as default"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
fi
build-account-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/account-api
app-folder-path: ./app/business-api/account
secrets: inherit

deploy-account-app:
needs: [changes-detection,build-account-app]
if: ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/account-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.ACCOUNTS_ACA_DEV_APP_NAME }}
secrets: inherit

build-transaction-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-transaction-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/transactions-history-api
app-folder-path: ./app/business-api/transactions-history
secrets: inherit

deploy-transaction-app:
needs: [changes-detection,build-transaction-app]
if: ${{ needs.changes-detection.outputs.build-transaction-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/transactions-history-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.TRANSACTIONS_ACA_DEV_APP_NAME }}
secrets: inherit
build-payment-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/payment-api
app-folder-path: ./app/business-api/payment
secrets: inherit

deploy-payment-app:
needs: [changes-detection,build-payment-app]
if: ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/payment-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.PAYMENTS_ACA_DEV_APP_NAME }}
secrets: inherit

build-frontend-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/web
app-folder-path: ./app/frontend
secrets: inherit

deploy-frontend-app:
needs: [changes-detection,build-frontend-app]
if: ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/web
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.WEB_ACA_DEV_APP_NAME }}
secrets: inherit

build-copilot-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-copilot == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/copilot
app-folder-path: ./app/copilot
secrets: inherit

deploy-copilot-app:
needs: [changes-detection,build-copilot-app]
if: ${{ needs.changes-detection.outputs.build-copilot == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/copilot
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.COPILOT_ACA_DEV_APP_NAME }}
secrets: inherit
name: Container Apps CI/CD pipeline

on:
push:
branches:
- main
paths:
- "app/**"
tags:
- v*.*.*
workflow_dispatch:

jobs:
changes-detection:
runs-on: ubuntu-latest
outputs:
env-name: ${{steps.set-deploy-env.outputs.DEPLOY_ENVIRONMENT}}
build-copilot: ${{ steps.changes.outputs.copilot }}
build-frontend: ${{ steps.changes.outputs.frontend }}
build-account-api: ${{ steps.changes.outputs.account-api }}
build-payment-api: ${{ steps.changes.outputs.payment-api }}
build-transaction-api: ${{ steps.changes.outputs.transaction-api }}
steps:
- uses: actions/checkout@v2
- name: Filter Changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
copilot:
- 'app/copilot/**'
frontend:
- 'app/frontend/**'
account-api:
- 'app/business-api/account/**'
payment-api:
- 'app/business-api/payment/**'
transaction-api:
- 'app/business-api/transactions-history/**'
- name: Set environment for branch
id: set-deploy-env
run: |
echo "checking branch name [${{github.ref_name}}]"
if [[ ${{github.ref_name}} == 'main' ]]; then
echo "main branch detected. Set Development environment"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'release'* ]]; then
echo "release branch detected. Set Test environment"
echo "DEPLOY_ENVIRONMENT=Test" >> "$GITHUB_OUTPUT"
elif [[ ${{github.ref_name}} == *'v'* ]]; then
echo "tag detected. Set Production environment"
echo "DEPLOY_ENVIRONMENT=Production" >> "$GITHUB_OUTPUT"
else
echo "branch not detected. Set Development environment as default"
echo "DEPLOY_ENVIRONMENT=Development" >> "$GITHUB_OUTPUT"
fi
build-account-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/account-api
app-folder-path: ./app/business-api/account
secrets: inherit

deploy-account-app:
needs: [changes-detection,build-account-app]
if: ${{ needs.changes-detection.outputs.build-account-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/account-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.ACCOUNTS_ACA_DEV_APP_NAME }}
secrets: inherit

build-transaction-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-transaction-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/transactions-history-api
app-folder-path: ./app/business-api/transactions-history
secrets: inherit

deploy-transaction-app:
needs: [changes-detection,build-transaction-app]
if: ${{ needs.changes-detection.outputs.build-transaction-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/transactions-history-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.TRANSACTIONS_ACA_DEV_APP_NAME }}
secrets: inherit
build-payment-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/payment-api
app-folder-path: ./app/business-api/payment
secrets: inherit

deploy-payment-app:
needs: [changes-detection,build-payment-app]
if: ${{ needs.changes-detection.outputs.build-payment-api == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/payment-api
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.PAYMENTS_ACA_DEV_APP_NAME }}
secrets: inherit

build-frontend-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/web
app-folder-path: ./app/frontend
secrets: inherit

deploy-frontend-app:
needs: [changes-detection,build-frontend-app]
if: ${{ needs.changes-detection.outputs.build-frontend == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/web
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.WEB_ACA_DEV_APP_NAME }}
secrets: inherit

build-copilot-app:
needs: changes-detection
if : ${{ needs.changes-detection.outputs.build-copilot == 'true' }}
uses: ./.github/workflows/acr-build-push.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/copilot
app-folder-path: ./app/copilot
secrets: inherit

deploy-copilot-app:
needs: [changes-detection,build-copilot-app]
if: ${{ needs.changes-detection.outputs.build-copilot == 'true' }}
uses: ./.github/workflows/aca-deploy.yaml
with:
env-name: ${{ needs.changes-detection.outputs.env-name}}
image-name: personal-finance-assistance-java/copilot
container-app-env-name: ${{ vars.ACA_DEV_ENV_NAME}}
container-app-name: ${{ vars.COPILOT_ACA_DEV_APP_NAME }}
secrets: inherit

40 changes: 40 additions & 0 deletions app/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
services:
frontend:
image: personal-finance-assistant-java/frontend
build: ../../app/frontend
environment:
REACT_APP_API_BASE_URL: "http://copilot:8080"
ports:
- "80:80"
copilot:
image: personal-finance-assistant-java/copilot-backend
build: ../../app/copilot
environment:
- AZURE_STORAGE_ACCOUNT=${AZURE_STORAGE_ACCOUNT}
- AZURE_STORAGE_CONTAINER=${AZURE_STORAGE_CONTAINER}
- AZURE_OPENAI_CHATGPT_MODEL=${AZURE_OPENAI_CHATGPT_MODEL}
- AZURE_OPENAI_SERVICE=${AZURE_OPENAI_SERVICE}
- AZURE_OPENAI_CHATGPT_DEPLOYMENT=${AZURE_OPENAI_CHATGPT_DEPLOYMENT}
- spring_profiles_active=docker
- ACCOUNTS_API_SERVER_URL=http://account:8080
- PAYMENTS_API_SERVER_URL=http://payment:8080
- TRANSACTIONS_API_SERVER_URL=http://transaction:8080
- AZURE_CLIENT_ID=${servicePrincipal}
- AZURE_CLIENT_SECRET=${servicePrincipalPassword}
- AZURE_TENANT_ID=${servicePrincipalTenant}
account:
image: personal-finance-assistant-java/business-account
build:
context: ../../app/business-api/account
payment:
image: personal-finance-assistant-java/business-payment
build:
context: ../../app/business-api/payment
environment:
- TRANSACTIONS_API_SERVER_URL=http://transaction:8080
transaction:
image: personal-finance-assistant-java/business-transaction-history
build:
context: ../../app/business-api/transactions-history


Loading

0 comments on commit 559edb7

Please sign in to comment.