Merge 0601707e7edd4e59dbaac5f1f05ecffb08c453fb into 69cc6cb129460ce523697fc8aeeb77f066860eb3

This commit is contained in:
Sumit Ghosh 2021-07-07 10:02:53 +00:00 committed by GitHub
commit 6c27ca1f59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
413 changed files with 61455 additions and 12241 deletions

50
.github/workflows/basket-api-deploy.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Deploy basket-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["basket-api"]
branches: [dev]
types: [completed]
env:
CHART: basket-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -1,6 +1,7 @@
name: basket-api name: basket-api
on: on:
workflow_dispatch:
push: push:
branches: branches:
- dev - dev
@ -21,6 +22,7 @@ on:
env: env:
SERVICE: basket-api SERVICE: basket-api
IMAGE: basket.api IMAGE: basket.api
DOTNET_VERSION: 5.0.x
jobs: jobs:
@ -30,7 +32,23 @@ jobs:
steps: steps:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Basket/Basket.API
dotnet build --no-restore
cd -
cd Services/Basket/Basket.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Compose build ${{ env.SERVICE }} - name: Compose build ${{ env.SERVICE }}
run: sudo -E docker-compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }}
working-directory: ./src working-directory: ./src
@ -46,6 +64,22 @@ jobs:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Basket/Basket.API
dotnet build --no-restore
cd -
cd Services/Basket/Basket.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Enable experimental features for the Docker daemon and CLI - name: Enable experimental features for the Docker daemon and CLI
run: | run: |
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json

View File

@ -0,0 +1,50 @@
name: Deploy catalog-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["catalog-api"]
branches: [dev]
types: [completed]
env:
CHART: catalog-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -1,6 +1,7 @@
name: catalog-api name: catalog-api
on: on:
workflow_dispatch:
push: push:
branches: branches:
- dev - dev
@ -21,6 +22,7 @@ on:
env: env:
SERVICE: catalog-api SERVICE: catalog-api
IMAGE: catalog.api IMAGE: catalog.api
DOTNET_VERSION: 5.0.x
jobs: jobs:
@ -30,6 +32,22 @@ jobs:
steps: steps:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Catalog/Catalog.API
dotnet build --no-restore
cd -
cd Services/Catalog/Catalog.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Compose build ${{ env.SERVICE }} - name: Compose build ${{ env.SERVICE }}
run: sudo -E docker-compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }}
@ -46,6 +64,22 @@ jobs:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Catalog/Catalog.API
dotnet build --no-restore
cd -
cd Services/Catalog/Catalog.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Enable experimental features for the Docker daemon and CLI - name: Enable experimental features for the Docker daemon and CLI
run: | run: |
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json

View File

@ -0,0 +1,50 @@
name: Deploy identity-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["identity-api"]
branches: [dev]
types: [completed]
env:
CHART: identity-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy mobileshoppingagg
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["mobileshoppingagg"]
branches: [dev]
types: [completed]
env:
CHART: mobileshoppingagg
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy ordering-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["ordering-api"]
branches: [dev]
types: [completed]
env:
CHART: ordering-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -1,6 +1,7 @@
name: ordering-api name: ordering-api
on: on:
workflow_dispatch:
push: push:
branches: branches:
- dev - dev
@ -21,6 +22,7 @@ on:
env: env:
SERVICE: ordering-api SERVICE: ordering-api
IMAGE: ordering.api IMAGE: ordering.api
DOTNET_VERSION: 5.0.x
jobs: jobs:
@ -30,6 +32,22 @@ jobs:
steps: steps:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Ordering/Ordering.API
dotnet build --no-restore
cd -
cd Services/Ordering/Ordering.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Compose build ${{ env.SERVICE }} - name: Compose build ${{ env.SERVICE }}
run: sudo -E docker-compose build ${{ env.SERVICE }} run: sudo -E docker-compose build ${{ env.SERVICE }}
@ -45,6 +63,22 @@ jobs:
steps: steps:
- name: 'Checkout Github Action' - name: 'Checkout Github Action'
uses: actions/checkout@master uses: actions/checkout@master
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Build and run unit tests
run: |
cd src
dotnet restore "eShopOnContainers-ServicesAndWebApps.sln"
cd Services/Ordering/Ordering.API
dotnet build --no-restore
cd -
cd Services/Ordering/Ordering.UnitTests
dotnet build --no-restore
dotnet test --no-build -v=normal
- name: Enable experimental features for the Docker daemon and CLI - name: Enable experimental features for the Docker daemon and CLI
run: | run: |

View File

@ -0,0 +1,50 @@
name: Deploy ordering-backgroundtasks
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["ordering-backgroundtasks"]
branches: [dev]
types: [completed]
env:
CHART: ordering-backgroundtasks
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy ordering-signalrhub
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["ordering-signalrhub"]
branches: [dev]
types: [completed]
env:
CHART: ordering-signalrhub
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy payment-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["payment-api"]
branches: [dev]
types: [completed]
env:
CHART: payment-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy webhooks-api
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["webhooks-api"]
branches: [dev]
types: [completed]
env:
CHART: webhooks-api
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

50
.github/workflows/webmvc-deploy.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Deploy webmvc
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["webmvc"]
branches: [dev]
types: [completed]
env:
CHART: webmvc
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -0,0 +1,50 @@
name: Deploy webshoppingagg
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["webshoppingagg"]
branches: [dev]
types: [completed]
env:
CHART: webshoppingagg
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

50
.github/workflows/webspa-deploy.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Deploy webspa
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["webspa"]
branches: [dev]
types: [completed]
env:
CHART: webspa
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

50
.github/workflows/webstatus-deploy.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Deploy webstatus
on:
workflow_dispatch:
repository_dispatch:
types:
- deploy
workflow_run:
workflows: ["webstatus"]
branches: [dev]
types: [completed]
env:
CHART: webstatus
NAMESPACE: eshop
CHART_ROOT: deploy/k8s/helm
jobs:
deploy-to-k8s:
#if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || github.event.workflow_run.conclusion == 'success' }}
if: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/aks-set-context@v1
name: Set AKS context
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Set branch name as env variable
run: |
currentbranch=$(echo ${GITHUB_REF##*/})
echo "running on $currentbranch"
echo "BRANCH=$currentbranch" >> $GITHUB_ENV
shell: bash
- name: Deploy Chart
run: |
./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected
env:
TAG: ${{ env.BRANCH }}
working-directory: ${{ env.CHART_ROOT }}

View File

@ -6,6 +6,12 @@
Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers. Sample .NET Core reference application, powered by Microsoft, based on a simplified microservices architecture and Docker containers.
## SPA Application (Angular)
![](img/eshop-spa-app-home.png)
## MVC application (ASP.NET Core)
![](img/eshop-webmvc-app-screenshot.png) ![](img/eshop-webmvc-app-screenshot.png)
## Build Status (GitHub Actions) ## Build Status (GitHub Actions)

View File

@ -1,8 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mobileshoppingapigw -}} {{- $serviceName := .Values.app.svc.mobileshoppingapigw -}}
apiVersion: networking.k8s.io/v1beta1
apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "apigwms.fullname" . }} name: {{ template "apigwms.fullname" . }}

View File

@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.webshoppingapigw -}} {{- $serviceName := .Values.app.svc.webshoppingapigw -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "apigwws.fullname" . }} name: {{ template "apigwws.fullname" . }}

View File

@ -19,6 +19,7 @@ app: # app global settings
payment: payment-api # ingress entry for payment api payment: payment-api # ingress entry for payment api
webhooks: webhooks-api # ingress entry for webhooks api webhooks: webhooks-api # ingress entry for webhooks api
webhooksweb: webhooks-web # ingress entry for webhooks web demo client webhooksweb: webhooks-web # ingress entry for webhooks web demo client
zipkin: zipkin # ingress entry for the Zipkin tracing tool.
svc: svc:
basket: basket-api # service name for basket api basket: basket-api # service name for basket api
catalog: catalog-api # service name for catalog api catalog: catalog-api # service name for catalog api
@ -36,3 +37,4 @@ app: # app global settings
payment: payment-api # service name for payment api payment: payment-api # service name for payment api
webhooks: webhooks-api # service name for webhooks api webhooks: webhooks-api # service name for webhooks api
webhooksweb: webhooks-client # service name for webhooks web webhooksweb: webhooks-client # service name for webhooks web
zipkin: zipkin # service name for Zipkin

View File

@ -1,4 +1,5 @@
{{- $name := include "basket-api.fullname" . -}} {{- $name := include "basket-api.fullname" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -14,4 +15,5 @@ data:
urls__IdentityUrl: http://{{ .Values.app.svc.identity }} urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -36,6 +36,8 @@ env:
key: all__UseAzureServiceBus key: all__UseAzureServiceBus
- name: IdentityUrl - name: IdentityUrl
key: urls__IdentityUrl key: urls__IdentityUrl
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: OrchestratorType - name: OrchestratorType
@ -43,7 +45,9 @@ env:
- name: PORT - name: PORT
value: "80" value: "80"
- name: GRPC_PORT - name: GRPC_PORT
value: "81" value: "81"
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -2,6 +2,7 @@
{{- $sqlsrv := include "sql-name" . -}} {{- $sqlsrv := include "sql-name" . -}}
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -18,4 +19,5 @@ data:
catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}" catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}"
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -38,6 +38,8 @@ env:
key: all__EventBusConnection key: all__EventBusConnection
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
key: all__UseAzureServiceBus key: all__UseAzureServiceBus
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -48,6 +50,8 @@ env:
value: "80" value: "80"
- name: GRPC_PORT - name: GRPC_PORT
value: "81" value: "81"
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -12,6 +12,7 @@ Param(
[parameter(Mandatory=$false)][string]$imageTag="latest", [parameter(Mandatory=$false)][string]$imageTag="latest",
[parameter(Mandatory=$false)][bool]$useLocalk8s=$false, [parameter(Mandatory=$false)][bool]$useLocalk8s=$false,
[parameter(Mandatory=$false)][bool]$useMesh=$false, [parameter(Mandatory=$false)][bool]$useMesh=$false,
[parameter(Mandatory=$false)][bool]$enableTrace=$false,
[parameter(Mandatory=$false)][string][ValidateSet('Always','IfNotPresent','Never', IgnoreCase=$false)]$imagePullPolicy="Always", [parameter(Mandatory=$false)][string][ValidateSet('Always','IfNotPresent','Never', IgnoreCase=$false)]$imagePullPolicy="Always",
[parameter(Mandatory=$false)][string][ValidateSet('prod','staging','none','custom', IgnoreCase=$false)]$sslSupport = "none", [parameter(Mandatory=$false)][string][ValidateSet('prod','staging','none','custom', IgnoreCase=$false)]$sslSupport = "none",
[parameter(Mandatory=$false)][string]$tlsSecretName = "eshop-tls-custom", [parameter(Mandatory=$false)][string]$tlsSecretName = "eshop-tls-custom",
@ -119,6 +120,7 @@ if (-not [string]::IsNullOrEmpty($registry)) {
Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green
$infras = ("sql-data", "nosql-data", "rabbitmq", "keystore-data", "basket-data") $infras = ("sql-data", "nosql-data", "rabbitmq", "keystore-data", "basket-data")
$traceTools = ("zipkin")
$charts = ("eshop-common", "basket-api","catalog-api", "identity-api", "mobileshoppingagg","ordering-api","ordering-backgroundtasks","ordering-signalrhub", "payment-api", "webmvc", "webshoppingagg", "webspa", "webstatus", "webhooks-api", "webhooks-web") $charts = ("eshop-common", "basket-api","catalog-api", "identity-api", "mobileshoppingagg","ordering-api","ordering-backgroundtasks","ordering-signalrhub", "payment-api", "webmvc", "webshoppingagg", "webspa", "webstatus", "webhooks-api", "webhooks-web")
$gateways = ("apigwms", "apigwws") $gateways = ("apigwms", "apigwws")
@ -132,6 +134,16 @@ else {
Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow Write-Host "eShopOnContainers infrastructure (bbdd, redis, ...) charts aren't installed (-deployCharts is false)" -ForegroundColor Yellow
} }
if ($enableTrace) {
Write-Host "Enabling traces : $traceTools" -ForegroundColor Green
#helm install "$appName-$traceTools" --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" $traceTools
Install-Chart $traceTools "-f app.yaml --values inf.yaml -f $ingressValuesFile -f $ingressMeshAnnotationsFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=latest --set image.pullPolicy=$imagePullPolicy --set inf.tls.enabled=$sslEnabled --set inf.mesh.enabled=$false --set inf.k8s.local=$useLocalk8s" $false
}
else {
Write-Host "OpenTelemetry Trace is not enabled. Charts isn't installed (-enableTrace is false)" -ForegroundColor Yellow
}
if ($deployCharts) { if ($deployCharts) {
foreach ($chart in $charts) { foreach ($chart in $charts) {
if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) { if ($chartsToDeploy -eq "*" -or $chartsToDeploy.Contains($chart)) {

199
deploy/k8s/helm/deploy-chart.sh Executable file
View File

@ -0,0 +1,199 @@
#!/usr/bin/env bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode
set -euo pipefail
usage()
{
cat <<END
deploy.sh: deploys the $app_name application to a Kubernetes cluster using Helm.
Parameters:
--aks-name <AKS cluster name>
The name of the AKS cluster. Required when the registry (using the -r parameter) is set to "aks".
--aks-rg <AKS resource group>
The resource group for the AKS cluster. Required when the registry (using the -r parameter) is set to "aks".
-c | --chart <name of chart>
The name of the chart to upgrade (or install)
-d | --dns <dns or ip address> | --dns aks
Specifies the external DNS/ IP address of the Kubernetes cluster.
If 'aks' is set as value, the DNS value is retrieved from the AKS. --aks-name and --aks-rg are needed.
When --use-local-k8s is specified the external DNS is automatically set to localhost.
-h | --help
Displays this help text and exits the script.
-n | --app-name <the name of the app>
Specifies the name of the application (default: eshop).
--namespace <namespace name>
Specifies the namespace name to deploy the app. If it doesn't exists it will be created (default: eshop).
-p | --docker-password <docker password>
The Docker password used to logon to the custom registry, supplied using the -r parameter.
-r | --registry <container registry>
Specifies the container registry to use (required), e.g. myregistry.azurecr.io.
--skip-clean
Do not clean the Kubernetes helm chart. Default is to clean the chart.
-t | --tag <docker image tag>
The tag used for the newly created docker images. Default: latest.
-u | --docker-username <docker username>
The Docker username used to logon to the custom registry, supplied using the -r parameter.
--use-local-k8s
Deploy to a locally installed Kubernetes (default: false).
It is assumed that the Kubernetes cluster has been granted access to the container registry.
If using AKS and ACR see link for more info:
https://docs.microsoft.com/en-us/azure/container-registry/container-registry-auth-aks
WARNING! THE SCRIPT WILL COMPLETELY DESTROY ALL DEPLOYMENTS AND SERVICES VISIBLE
FROM THE CURRENT CONFIGURATION CONTEXT AND NAMESPACE.
It is recommended that you check your selected namespace, 'eshop' by default, is already in use.
Every deployment and service done in the namespace will be deleted.
For more information see https://kubernetes.io/docs/tasks/administer-cluster/namespaces/
END
}
acr_connected=''
app_name='eshop'
aks_name=''
aks_rg=''
chart=''
clean='yes'
container_registry=''
docker_password=''
docker_username=''
dns=''
image_tag='latest'
skip_infrastructure=''
use_local_k8s=''
namespace='eshop'
while [[ $# -gt 0 ]]; do
case "$1" in
--acr-connected )
acr_connected='yes'; shift ;;
--aks-name )
aks_name="$2"; shift 2;;
--aks-rg )
aks_rg="$2"; shift 2;;
-c | --chart )
chart="$2"; shift 2;;
-d | --dns )
dns="$2"; shift 2;;
-h | --help )
usage; exit 1 ;;
-n | --app-name )
app_name="$2"; shift 2;;
-p | --docker-password )
docker_password="$2"; shift 2;;
-r | --registry )
container_registry="$2"; shift 2;;
--skip-clean )
clean=''; shift ;;
--image-build )
build_images='yes'; shift ;;
--image-push )
push_images='yes'; shift ;;
--skip-infrastructure )
skip_infrastructure='yes'; shift ;;
-t | --tag )
image_tag="$2"; shift 2;;
-u | --docker-username )
docker_username="$2"; shift 2;;
--use-local-k8s )
use_local_k8s='yes'; shift ;;
--namespace )
namespace="$2"; shift 2;;
*)
echo "Unknown option $1"
usage; exit 2 ;;
esac
done
export TAG=$image_tag
use_custom_registry=''
if [[ -n $container_registry ]] && [[ -z $acr_connected ]]; then
echo "################ Log into custom registry $container_registry ##################"
use_custom_registry='yes'
if [[ -z $docker_username ]] || [[ -z $docker_password ]]; then
echo "Error: Must use -u (--docker-username) AND -p (--docker-password) if specifying custom registry"
exit 1
fi
docker login -u $docker_username -p $docker_password $container_registry
fi
ingress_values_file="ingress_values.yaml"
if [[ $use_local_k8s ]]; then
ingress_values_file="ingress_values_dockerk8s.yaml"
dns="localhost"
fi
if [[ $dns == "aks" ]]; then
echo "#################### Begin AKS discovery based on the --dns aks setting. ####################"
if [[ -z $aks_name ]] || [[ -z $aks_rg ]]; then
echo "Error: When using -dns aks, MUST set -aksName and -aksRg too."
echo ''
usage
exit 1
fi
echo "Getting AKS cluster $aks_name AKS (in resource group $aks_rg)"
# JMESPath queries are case sensitive and httpapplicationrouting can be lowercase sometimes
jmespath_dnsqueries=(\
addonProfiles.httpApplicationRouting.config.HTTPApplicationRoutingZoneName \
addonProfiles.httpapplicationrouting.config.HTTPApplicationRoutingZoneName \
)
for q in "${jmespath_dnsqueries[@]}"
do
dns="$(az aks show -n $aks_name -g $aks_rg --query $q -o tsv)"
if [[ -n $dns ]]; then break; fi
done
if [[ -z $dns ]]; then
echo "Error: when getting DNS of AKS $aks_name (in resource group $aks_rg). Please ensure AKS has httpRouting enabled AND Azure CLI is logged in and is of version 2.0.37 or higher."
exit 1
fi
echo "DNS base found is $dns. Will use $aks_name.$dns for the app!"
dns="$aks_name.$dns"
fi
# Initialization & check commands
if [[ -z $dns ]]; then
echo "No DNS specified. Ingress resources will be bound to public IP."
fi
previous_install=''
if [[ -z $(helm ls -q --namespace $namespace | grep "$app_name-$chart") ]]; then
echo "No previous release found"
else
previous_install='yes'
fi
if [[ $clean ]] && [[ $previous_install ]]; then
echo "Cleaning previous helm releases..."
helm uninstall "$app_name-$chart" --namespace $namespace
echo "Previous release deleted"
waitsecs=5; while [ $waitsecs -gt 0 ]; do echo -ne "$waitsecs\033[0K\r"; sleep 1; : $((waitsecs--)); done
previous_install=''
fi
echo "#################### Begin $app_name $chart installation using Helm ####################"
if [[ $use_custom_registry ]] || [[ $acr_connected ]]; then
if [[ -z $acr_connected ]]; then
if [[ -z $previous_install ]]; then
helm upgrade --install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --set inf.registry.login=$docker_username --set inf.registry.pwd=$docker_password --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
else
helm upgrade --install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
fi
elif [[ $chart != "eshop-common" ]]; then
# ACR is already connected, so we don't need username/password
if [[ -z $previous_install ]]; then
helm install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --set inf.registry.server=$container_registry --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
else
# don't set the image repo since it's already set
helm upgrade "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
fi
fi
elif [[ $chart != "eshop-common" ]]; then # eshop-common is ignored when no secret must be deployed
helm upgrade --install "$app_name-$chart" --namespace $namespace --set "ingress.hosts={$dns}" --values app.yaml --values inf.yaml --values $ingress_values_file --set app.name=$app_name --set inf.k8s.dns=$dns --set image.tag=$image_tag --set image.pullPolicy=Always $chart
fi
echo "FINISHED: Helm chart installed."

View File

@ -9,6 +9,7 @@
{{- $xamarincallback := include "url-of" (list "xamarincallback" .) -}} {{- $xamarincallback := include "url-of" (list "xamarincallback" .) -}}
{{- $webhooks_url := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}} {{- $webhooks_url := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}}
{{- $webhooksweb_url := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}} {{- $webhooksweb_url := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -32,4 +33,5 @@ data:
xamarin_callback_e: http://{{ $xamarincallback }} xamarin_callback_e: http://{{ $xamarincallback }}
webhooksapi_e: http://{{ $webhooks_url }} webhooksapi_e: http://{{ $webhooks_url }}
webhooksweb_e: http://{{ $webhooksweb_url }} webhooksweb_e: http://{{ $webhooksweb_url }}
enableDevspaces: "{{ .Values.enableDevspaces }}" enableDevspaces: "{{ .Values.enableDevspaces }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -3,7 +3,7 @@
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.identity }} {{- $serviceName := .Values.app.svc.identity }}
{{- $name := include "identity-api.fullname" . -}} {{- $name := include "identity-api.fullname" . -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $name }}-local name: {{ $name }}-local

View File

@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.identity }} {{- $serviceName := .Values.app.svc.identity }}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "identity-api.fullname" . }} name: {{ template "identity-api.fullname" . }}

View File

@ -56,6 +56,8 @@ env:
key: webhooksweb_e key: webhooksweb_e
- name: EnableDevspaces - name: EnableDevspaces
key: enableDevspaces key: enableDevspaces
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
value: Development value: Development
@ -63,7 +65,8 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -1,6 +1,7 @@
{{- $name := include "mobileshoppingagg.fullname" . -}} {{- $name := include "mobileshoppingagg.fullname" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} {{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -27,3 +28,4 @@ data:
internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}" internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}"
internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}" internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}"
urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }} urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }}
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -59,6 +59,8 @@ env:
key: internalurls__grpcOrdering key: internalurls__grpcOrdering
- name: IdentityUrlExternal - name: IdentityUrlExternal
key: urls__IdentityUrlExternal key: urls__IdentityUrlExternal
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -69,6 +71,8 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -1,5 +1,6 @@
{{- $name := include "ordering-api.fullname" . -}} {{- $name := include "ordering-api.fullname" . -}}
{{- $sqlsrv := include "sql-name" . -}} {{- $sqlsrv := include "sql-name" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -15,4 +16,5 @@ data:
urls__IdentityUrl: http://{{ .Values.app.svc.identity }} urls__IdentityUrl: http://{{ .Values.app.svc.identity }}
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -43,6 +43,8 @@ env:
key: all__UseAzureServiceBus key: all__UseAzureServiceBus
- name: IdentityUrl - name: IdentityUrl
key: urls__IdentityUrl key: urls__IdentityUrl
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -52,7 +54,9 @@ env:
- name: PORT - name: PORT
value: "80" value: "80"
- name: GRPC_PORT - name: GRPC_PORT
value: "81" value: "81"
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -1,6 +1,7 @@
{{- $name := include "ordering-backgroundtasks.fullname" . -}} {{- $name := include "ordering-backgroundtasks.fullname" . -}}
{{- $sqlsrv := include "sql-name" . -}} {{- $sqlsrv := include "sql-name" . -}}
{{- $cfgname := printf "cfg-%s" $name | trunc 63 }} {{- $cfgname := printf "cfg-%s" $name | trunc 63 }}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -18,4 +19,5 @@ data:
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
graceperiodmanager__CheckUpdateTime: "{{ .Values.cfg.checkUpdateTime }}" graceperiodmanager__CheckUpdateTime: "{{ .Values.cfg.checkUpdateTime }}"
graceperiodmanager__GracePeriodTime: "{{ .Values.cfg.gracePeriodTime }}" graceperiodmanager__GracePeriodTime: "{{ .Values.cfg.gracePeriodTime }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -48,12 +48,16 @@ env:
key: graceperiodmanager__CheckUpdateTime key: graceperiodmanager__CheckUpdateTime
- name: GracePeriodTime - name: GracePeriodTime
key: graceperiodmanager__GracePeriodTime key: graceperiodmanager__GracePeriodTime
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
value: Development value: Development
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -1,5 +1,6 @@
{{- $name := include "ordering-signalrhub.fullname" . -}} {{- $name := include "ordering-signalrhub.fullname" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} {{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -15,4 +16,5 @@ data:
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
signalr__StoreConnectionString: {{ .Values.inf.redis.keystore.constr }} signalr__StoreConnectionString: {{ .Values.inf.redis.keystore.constr }}
urls__IdentityUrl: http://identity-api urls__IdentityUrl: http://identity-api
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -46,6 +46,8 @@ env:
key: urls__IdentityUrl key: urls__IdentityUrl
- name: SignalrStoreConnectionString - name: SignalrStoreConnectionString
key: signalr__StoreConnectionString key: signalr__StoreConnectionString
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -54,4 +56,6 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
values: 'True' values: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'

View File

@ -1,4 +1,5 @@
{{- $name := include "payment-api.fullname" . -}} {{- $name := include "payment-api.fullname" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -12,4 +13,5 @@ metadata:
data: data:
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -36,12 +36,16 @@ env:
key: all__EventBusConnection key: all__EventBusConnection
- name: AzureServiceBusEnabled - name: AzureServiceBusEnabled
key: all__UseAzureServiceBus key: all__UseAzureServiceBus
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
value: Development value: Development
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -2,6 +2,7 @@
{{- $sqlsrv := include "sql-name" . -}} {{- $sqlsrv := include "sql-name" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} {{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -18,4 +19,5 @@ data:
urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }} urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }}
all__EventBusConnection: {{ .Values.inf.eventbus.constr }} all__EventBusConnection: {{ .Values.inf.eventbus.constr }}
all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}"
all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}"
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.webhooks }} {{- $serviceName := .Values.app.svc.webhooks }}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "webhooks-api.fullname" . }} name: {{ template "webhooks-api.fullname" . }}

View File

@ -44,10 +44,14 @@ env:
key: urls__IdentityUrl key: urls__IdentityUrl
- name: IdentityUrlExternal - name: IdentityUrlExternal
key: urls__IdentityUrlExternal key: urls__IdentityUrlExternal
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
value: Development value: Development
- name: OrchestratorType - name: OrchestratorType
value: 'K8S' value: 'K8S'
- name: OTEL_USE_EXPORTER
value: 'zipkin'

View File

@ -3,6 +3,7 @@
{{- $webhooksweb := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}} {{- $webhooksweb := include "url-of" (list .Values.app.ingress.entries.webhooksweb .) -}}
{{- $webhooks := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}} {{- $webhooks := include "url-of" (list .Values.app.ingress.entries.webhooks .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -18,3 +19,4 @@ data:
identity_e: {{ $protocol }}://{{ $identity }} identity_e: {{ $protocol }}://{{ $identity }}
webhooksweb_e: {{ $protocol }}://{{ $webhooksweb }} webhooksweb_e: {{ $protocol }}://{{ $webhooksweb }}
urls_webhooksweb: http://{{ .Values.app.svc.webhooksweb }} urls_webhooksweb: http://{{ .Values.app.svc.webhooksweb }}
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "webhooks-web.fullname" . }} name: {{ template "webhooks-web.fullname" . }}

View File

@ -40,6 +40,8 @@ env:
key: webhooksweb_e key: webhooksweb_e
- name: SelfUrl - name: SelfUrl
key: webhooksweb_e key: webhooksweb_e
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -48,5 +50,7 @@ env:
value: 'K8S' value: 'K8S'
- name: Token - name: Token
value: "WebHooks-Demo-Web" # Can use whatever you want value: "WebHooks-Demo-Web" # Can use whatever you want
- name: OTEL_USE_EXPORTER
value: 'zipkin'

View File

@ -3,6 +3,7 @@
{{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}} {{- $webshoppingapigw := include "url-of" (list .Values.app.ingress.entries.webshoppingapigw .) -}}
{{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}} {{- $mvc := include "url-of" (list .Values.app.ingress.entries.mvc .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -22,3 +23,4 @@ data:
urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }} urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }}
urls__mvc: {{ $protocol }}://{{ $mvc }} urls__mvc: {{ $protocol }}://{{ $mvc }}
urls__IdentityUrl: {{ $protocol }}://{{ $identity }} urls__IdentityUrl: {{ $protocol }}://{{ $identity }}
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -3,7 +3,7 @@
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mvc }} {{- $serviceName := .Values.app.svc.mvc }}
{{- $name := include "webmvc.fullname" . -}} {{- $name := include "webmvc.fullname" . -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $name }}-local name: {{ $name }}-local

View File

@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.mvc -}} {{- $serviceName := .Values.app.svc.mvc -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "webmvc.fullname" . }} name: {{ template "webmvc.fullname" . }}

View File

@ -46,6 +46,8 @@ env:
key: internalurls__identity__hc key: internalurls__identity__hc
- name: SignalrHubUrl - name: SignalrHubUrl
key: urls__apigwws key: urls__apigwws
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -54,4 +56,6 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'

View File

@ -1,6 +1,7 @@
{{- $name := include "webshoppingagg.fullname" . -}} {{- $name := include "webshoppingagg.fullname" . -}}
{{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}} {{- $identity := include "url-of" (list .Values.app.ingress.entries.identity .) -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -27,3 +28,4 @@ data:
internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}" internalurls__grpcCatalog: "http://{{ .Values.app.svc.catalog }}:{{ .Values.service.grpcPort }}"
internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}" internalurls__grpcOrdering: "http://{{ .Values.app.svc.ordering }}:{{ .Values.service.grpcPort }}"
urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }} urls__IdentityUrlExternal: {{ $protocol }}://{{ $identity }}
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -59,7 +59,8 @@ env:
key: internalurls__grpcOrdering key: internalurls__grpcOrdering
- name: IdentityUrlExternal - name: IdentityUrlExternal
key: urls__IdentityUrlExternal key: urls__IdentityUrlExternal
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -70,6 +71,8 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'
probes: probes:
liveness: liveness:
path: /liveness path: /liveness

View File

@ -4,6 +4,7 @@
{{- $spa := include "url-of" (list .Values.app.ingress.entries.spa .) -}} {{- $spa := include "url-of" (list .Values.app.ingress.entries.spa .) -}}
{{- $mongo := include "mongo-name" . -}} {{- $mongo := include "mongo-name" . -}}
{{- $protocol := include "protocol" . -}} {{- $protocol := include "protocol" . -}}
{{- $zipkin := include "url-of" (list .Values.app.ingress.entries.zipkin .) -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
@ -21,4 +22,5 @@ data:
internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc internalurls__identity__hc: http://{{ .Values.app.svc.identity }}/hc
urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }} urls__apigwws: {{ $protocol }}://{{ $webshoppingapigw }}
urls__spa: {{ $protocol }}://{{ $spa }} urls__spa: {{ $protocol }}://{{ $spa }}
urls__IdentityUrl: {{ $protocol }}://{{ $identity }} urls__IdentityUrl: {{ $protocol }}://{{ $identity }}
urls__Otel__ExporterEndpoint: http://{{ .Values.app.svc.zipkin }}:9411/api/v2/spans

View File

@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "webspa.fullname" . }} name: {{ template "webspa.fullname" . }}

View File

@ -44,6 +44,8 @@ env:
key: internalurls__identity__hc key: internalurls__identity__hc
- name: SignalrHubUrl - name: SignalrHubUrl
key: urls__apigwws key: urls__apigwws
- name: OTEL_EXPORTER_TOOL_ENDPOINT
key: urls__Otel__ExporterEndpoint
# values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value) # values define environment variables with a fixed value (no configmap involved) (name is name of var, and value is its value)
values: values:
- name: ASPNETCORE_ENVIRONMENT - name: ASPNETCORE_ENVIRONMENT
@ -54,4 +56,6 @@ env:
value: 'K8S' value: 'K8S'
- name: IsClusterEnv - name: IsClusterEnv
value: 'True' value: 'True'
- name: OTEL_USE_EXPORTER
value: 'zipkin'

View File

@ -1,7 +1,7 @@
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
{{- $fullName := include "webstatus.fullname" . -}} {{- $fullName := include "webstatus.fullname" . -}}
{{- $ingressPath := include "pathBase" . -}} {{- $ingressPath := include "pathBase" . -}}
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ template "webstatus.fullname" . }} name: {{ template "webstatus.fullname" . }}

View File

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: zipkin
version: 0.1.0

View File

@ -0,0 +1,2 @@
eShop trace tool Zipkin installed.
-----------------------

View File

@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "zipkin.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "zipkin.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "zipkin.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

View File

@ -0,0 +1,60 @@
{{- define "suffix-name" -}}
{{- if .Values.app.name -}}
{{- .Values.app.name -}}
{{- else -}}
{{- .Release.Name -}}
{{- end -}}
{{- end -}}
{{- define "sql-name" -}}
{{- if .Values.inf.sql.host -}}
{{- .Values.inf.sql.host -}}
{{- else -}}
{{- printf "%s" "sql-data" -}}
{{- end -}}
{{- end -}}
{{- define "mongo-name" -}}
{{- if .Values.inf.mongo.host -}}
{{- .Values.inf.mongo.host -}}
{{- else -}}
{{- printf "%s" "nosql-data" -}}
{{- end -}}
{{- end -}}
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if eq $name "" -}}
{{- $ctx.Values.inf.k8s.dns -}}
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just <dns>/<name> */}}
{{- end -}}
{{- end -}}
{{- define "pathBase" -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}
{{- .Values.pathBase -}}
{{- end -}}
{{- end -}}
{{- define "fqdn-image" -}}
{{- if .Values.inf.registry -}}
{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}}
{{- else -}}
{{- .Values.image.repository -}}
{{- end -}}
{{- end -}}
{{- define "protocol" -}}
{{- if .Values.inf.tls.enabled -}}
{{- printf "%s" "https" -}}
{{- else -}}
{{- printf "%s" "http" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "zipkin.fullname" . }}
labels:
app: {{ template "zipkin.name" . }}
chart: {{ template "zipkin.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "zipkin.name" . }}
release: {{ .Release.Name }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ template "zipkin.name" . }}
release: {{ .Release.Name }}
{{ if .Values.inf.mesh.enabled -}}
annotations:
linkerd.io/inject: enabled
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 9411
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
readinessProbe:
httpGet:
path: /
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,33 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.inf.k8s.local -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := .Values.app.svc.zipkin }}
{{- $name := include "zipkin.fullname" . -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ $name }}-local
labels:
app: {{ template "zipkin.name" . }}
chart: {{ template "zipkin.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{ toYaml . | indent 4 }}
{{- end }}
{{- if .Values.inf.mesh.enabled }}
{{- with .Values.ingress.mesh.annotations }}
{{ toYaml . | indent 4 }}
{{- end }}
{{- end }}
spec:
rules:
- http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: http
path: {{ $ingressPath }}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,39 @@
{{- if .Values.ingress.enabled -}}
{{- $ingressPath := include "pathBase" . -}}
{{- $serviceName := include "zipkin.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ template "zipkin.fullname" . }}
labels:
app: {{ template "zipkin.name" . }}
chart: {{ template "zipkin.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $.Values.app.svc.zipkin }}
servicePort: http
{{- end }}
{{- end }}

View File

@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app.svc.zipkin }}
labels:
app: {{ template "zipkin.name" . }}
chart: {{ template "zipkin.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
app: {{ template "zipkin.name" . }}
release: {{ .Release.Name }}

View File

@ -0,0 +1,26 @@
replicaCount: 1
clusterName: eshop-aks
pathBase: /zipkin
image:
repository: openzipkin/zipkin
tag: latest
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 9411
ingress:
enabled: true
annotations: {}
tls: []
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:
@ -18,7 +18,7 @@ spec:
servicePort: http servicePort: http
path: /webmvc path: /webmvc
--- ---
apiVersion: extensions/v1beta1 apiVersion: networking.k8s.io/v1
kind: Ingress kind: Ingress
metadata: metadata:
annotations: annotations:

View File

@ -26,7 +26,7 @@ metadata:
app.kubernetes.io/part-of: ingress-nginx app.kubernetes.io/part-of: ingress-nginx
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
name: nginx-ingress-clusterrole name: nginx-ingress-clusterrole
@ -82,7 +82,7 @@ rules:
- update - update
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1
kind: Role kind: Role
metadata: metadata:
name: nginx-ingress-role name: nginx-ingress-role
@ -127,7 +127,7 @@ rules:
- get - get
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
name: nginx-ingress-role-nisa-binding name: nginx-ingress-role-nisa-binding
@ -145,7 +145,7 @@ subjects:
namespace: ingress-nginx namespace: ingress-nginx
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
name: nginx-ingress-clusterrole-nisa-binding name: nginx-ingress-clusterrole-nisa-binding

View File

@ -10,10 +10,10 @@ function Check-Admin {
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
} }
function Add-InboundRule { function Add-InboundRule {
New-NetFirewallRule -DisplayName $InboundDisplayName -Confirm -Description "$Name Inbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound New-NetFirewallRule -DisplayName $InboundDisplayName -Confirm -Description "$Name Inbound Rule for port range 5100-5205" -LocalAddress Any -LocalPort 5100-5205 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Inbound
} }
function Add-OutboundRule { function Add-OutboundRule {
New-NetFirewallRule -DisplayName $OutboundDisplayName -Confirm -Description "$Name Outbound Rule for port range 5100-5150" -LocalAddress Any -LocalPort 5100-5150 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound New-NetFirewallRule -DisplayName $OutboundDisplayName -Confirm -Description "$Name Outbound Rule for port range 5100-5205" -LocalAddress Any -LocalPort 5100-5205 -Protocol tcp -RemoteAddress Any -RemotePort Any -Direction Outbound
} }
if ((Check-Admin) -eq $false) { if ((Check-Admin) -eq $false) {

BIN
img/eshop-spa-app-home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -103,7 +103,7 @@ static_resources:
lb_policy: round_robin lb_policy: round_robin
hosts: hosts:
- socket_address: - socket_address:
address: webshoppingagg address: mobileshoppingagg
port_value: 80 port_value: 80
- name: catalog - name: catalog
connect_timeout: 0.25s connect_timeout: 0.25s

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
@ -13,6 +13,7 @@ COPY "ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.
COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj"
COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj"
COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj" COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj"
COPY "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj" "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj"
COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj"
COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj"
COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj"
@ -38,6 +39,7 @@ COPY "Web/WebhookClient/WebhookClient.csproj" "Web/WebhookClient/WebhookClient.c
COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj" COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj"
COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj" COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj"
COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj" COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj"
COPY "OpenTelemetry/OpenTelemetry.Customization.csproj" "OpenTelemetry/OpenTelemetry.Customization.csproj"
COPY "docker-compose.dcproj" "docker-compose.dcproj" COPY "docker-compose.dcproj" "docker-compose.dcproj"

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim FROM mcr.microsoft.com/dotnet/sdk:5.0
ARG BUILD_CONFIGURATION=Debug ARG BUILD_CONFIGURATION=Debug
ENV ASPNETCORE_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_USE_POLLING_FILE_WATCHER=true ENV DOTNET_USE_POLLING_FILE_WATCHER=true

View File

@ -24,7 +24,6 @@
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" /> <PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
@ -33,6 +32,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj" />
<ProjectReference Include="..\..\..\OpenTelemetry\OpenTelemetry.Customization.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -2,9 +2,9 @@
using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models; using Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Text.Json;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
{ {
@ -24,14 +24,17 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Services
public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket) public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket)
{ {
var uri = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft(); var uri = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var content = new StringContent(JsonConvert.SerializeObject(basket), System.Text.Encoding.UTF8, "application/json"); var content = new StringContent(JsonSerializer.Serialize(basket), System.Text.Encoding.UTF8, "application/json");
var response = await _apiClient.PostAsync(uri, content); var response = await _apiClient.PostAsync(uri, content);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var ordersDraftResponse = await response.Content.ReadAsStringAsync(); var ordersDraftResponse = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<OrderData>(ordersDraftResponse); return JsonSerializer.Deserialize<OrderData>(ordersDraftResponse, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
} }
} }
} }

View File

@ -22,6 +22,8 @@ using Microsoft.OpenApi.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using OpenTelemetry.Customization.Extensions;
using OpenTelemetry.Customization;
namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
{ {
@ -50,6 +52,14 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
.AddDevspaces() .AddDevspaces()
.AddHttpServices() .AddHttpServices()
.AddGrpcServices(); .AddGrpcServices();
// Add Telemetry
services.AddOpenTelemetry(new OpenTelemetryConfig()
{
ServiceName = "mobileshoppingagg",
ExportType = Configuration.GetValue<string>("OTEL_USE_EXPORTER"),
ExportToolEndpoint = Configuration.GetValue<string>("OTEL_EXPORTER_TOOL_ENDPOINT")
});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -107,7 +117,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator
services.Configure<UrlsConfig>(configuration.GetSection("urls")); services.Configure<UrlsConfig>(configuration.GetSection("urls"));
services.AddControllers() services.AddControllers()
.AddNewtonsoftJson(); .AddJsonOptions(options => options.JsonSerializerOptions.WriteIndented = true);
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
@ -13,6 +13,7 @@ COPY "ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.
COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj"
COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj"
COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj" COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj"
COPY "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj" "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj"
COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj"
COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj"
COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj"
@ -38,6 +39,7 @@ COPY "Web/WebhookClient/WebhookClient.csproj" "Web/WebhookClient/WebhookClient.c
COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj" COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj"
COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj" COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj"
COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj" COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj"
COPY "OpenTelemetry/OpenTelemetry.Customization.csproj" "OpenTelemetry/OpenTelemetry.Customization.csproj"
COPY "docker-compose.dcproj" "docker-compose.dcproj" COPY "docker-compose.dcproj" "docker-compose.dcproj"

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim FROM mcr.microsoft.com/dotnet/sdk:5.0
ARG BUILD_CONFIGURATION=Debug ARG BUILD_CONFIGURATION=Debug
ENV ASPNETCORE_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_USE_POLLING_FILE_WATCHER=true ENV DOTNET_USE_POLLING_FILE_WATCHER=true

View File

@ -2,9 +2,9 @@
using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models; using Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Text.Json;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
{ {
@ -24,14 +24,17 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Services
public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket) public async Task<OrderData> GetOrderDraftFromBasketAsync(BasketData basket)
{ {
var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft(); var url = _urls.Orders + UrlsConfig.OrdersOperations.GetOrderDraft();
var content = new StringContent(JsonConvert.SerializeObject(basket), System.Text.Encoding.UTF8, "application/json"); var content = new StringContent(JsonSerializer.Serialize(basket), System.Text.Encoding.UTF8, "application/json");
var response = await _apiClient.PostAsync(url, content); var response = await _apiClient.PostAsync(url, content);
response.EnsureSuccessStatusCode(); response.EnsureSuccessStatusCode();
var ordersDraftResponse = await response.Content.ReadAsStringAsync(); var ordersDraftResponse = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<OrderData>(ordersDraftResponse); return JsonSerializer.Deserialize<OrderData>(ordersDraftResponse, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
} }
} }
} }

View File

@ -19,9 +19,11 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using OpenTelemetry.Customization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt; using System.IdentityModel.Tokens.Jwt;
using OpenTelemetry.Customization.Extensions;
namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
{ {
@ -50,6 +52,14 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
.AddDevspaces() .AddDevspaces()
.AddApplicationServices() .AddApplicationServices()
.AddGrpcServices(); .AddGrpcServices();
// Add Telemetry
services.AddOpenTelemetry(new OpenTelemetryConfig()
{
ServiceName = "webshoppingagg",
ExportType = Configuration.GetValue<string>("OTEL_USE_EXPORTER"),
ExportToolEndpoint = Configuration.GetValue<string>("OTEL_EXPORTER_TOOL_ENDPOINT")
});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -130,7 +140,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator
services.Configure<UrlsConfig>(configuration.GetSection("urls")); services.Configure<UrlsConfig>(configuration.GetSection("urls"));
services.AddControllers() services.AddControllers()
.AddNewtonsoftJson(); .AddJsonOptions(options => options.JsonSerializerOptions.WriteIndented = true);
services.AddSwaggerGen(options => services.AddSwaggerGen(options =>
{ {

View File

@ -25,7 +25,6 @@
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" /> <PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" /> <PackageReference Include="Serilog.Sinks.Console" Version="4.0.0-dev-00834" />
@ -35,6 +34,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\Devspaces.Support\Devspaces.Support.csproj" />
<ProjectReference Include="..\..\..\OpenTelemetry\OpenTelemetry.Customization.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="xunit" Version="2.4.0" /> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -5,7 +5,7 @@ using System.Text;
namespace EventBus.Tests namespace EventBus.Tests
{ {
public class TestIntegrationEvent : IntegrationEvent public record TestIntegrationEvent : IntegrationEvent
{ {
} }
} }

View File

@ -5,8 +5,7 @@
<RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBus</RootNamespace> <RootNamespace>Microsoft.eShopOnContainers.BuildingBlocks.EventBus</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,10 @@
using Newtonsoft.Json; using System;
using System; using System.Text.Json.Serialization;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
{ {
public record IntegrationEvent public record IntegrationEvent
{ {
public IntegrationEvent() public IntegrationEvent()
{ {
Id = Guid.NewGuid(); Id = Guid.NewGuid();
@ -18,10 +18,10 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events
CreationDate = createDate; CreationDate = createDate;
} }
[JsonProperty] [JsonInclude]
public Guid Id { get; private init; } public Guid Id { get; private init; }
[JsonProperty] [JsonInclude]
public DateTime CreationDate { get; private init; } public DateTime CreationDate { get; private init; }
} }
} }

View File

@ -4,8 +4,6 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Extensions;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Polly; using Polly;
using Polly.Retry; using Polly.Retry;
using RabbitMQ.Client; using RabbitMQ.Client;
@ -15,6 +13,7 @@ using System;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Text.Json;
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
{ {
@ -89,9 +88,11 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
_logger.LogTrace("Declaring RabbitMQ exchange to publish event: {EventId}", @event.Id); _logger.LogTrace("Declaring RabbitMQ exchange to publish event: {EventId}", @event.Id);
channel.ExchangeDeclare(exchange: BROKER_NAME, type: "direct"); channel.ExchangeDeclare(exchange: BROKER_NAME, type: "direct");
var message = JsonConvert.SerializeObject(@event); var body = JsonSerializer.SerializeToUtf8Bytes(@event, @event.GetType(), new JsonSerializerOptions
var body = Encoding.UTF8.GetBytes(message); {
WriteIndented = true
});
policy.Execute(() => policy.Execute(() =>
{ {
@ -142,13 +143,10 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
{ {
_persistentConnection.TryConnect(); _persistentConnection.TryConnect();
} }
using (var channel = _persistentConnection.CreateModel()) _consumerChannel.QueueBind(queue: _queueName,
{ exchange: BROKER_NAME,
channel.QueueBind(queue: _queueName, routingKey: eventName);
exchange: BROKER_NAME,
routingKey: eventName);
}
} }
} }
@ -272,8 +270,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
{ {
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler; var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
if (handler == null) continue; if (handler == null) continue;
dynamic eventData = JObject.Parse(message); using dynamic eventData = JsonDocument.Parse(message);
await Task.Yield(); await Task.Yield();
await handler.Handle(eventData); await handler.Handle(eventData);
} }
@ -282,7 +279,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ
var handler = scope.ResolveOptional(subscription.HandlerType); var handler = scope.ResolveOptional(subscription.HandlerType);
if (handler == null) continue; if (handler == null) continue;
var eventType = _subsManager.GetEventTypeByName(eventName); var eventType = _subsManager.GetEventTypeByName(eventName);
var integrationEvent = JsonConvert.DeserializeObject(message, eventType); var integrationEvent = JsonSerializer.Deserialize(message, eventType, new JsonSerializerOptions() { PropertyNameCaseInsensitive= true});
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType); var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
await Task.Yield(); await Task.Yield();

View File

@ -8,8 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac" Version="6.1.0" /> <PackageReference Include="Autofac" Version="6.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" /> <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Polly" Version="7.2.1" /> <PackageReference Include="Polly" Version="7.2.1" />
<PackageReference Include="RabbitMQ.Client" Version="6.2.1" /> <PackageReference Include="RabbitMQ.Client" Version="6.2.1" />
</ItemGroup> </ItemGroup>

View File

@ -5,11 +5,10 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System; using System;
using System.Text; using System.Text;
using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
public class EventBusServiceBus : IEventBus public class EventBusServiceBus : IEventBus
@ -36,7 +35,7 @@
public void Publish(IntegrationEvent @event) public void Publish(IntegrationEvent @event)
{ {
var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFFIX, ""); var eventName = @event.GetType().Name.Replace(INTEGRATION_EVENT_SUFFIX, "");
var jsonMessage = JsonConvert.SerializeObject(@event); var jsonMessage = JsonSerializer.Serialize(@event);
var body = Encoding.UTF8.GetBytes(jsonMessage); var body = Encoding.UTF8.GetBytes(jsonMessage);
var message = new Message var message = new Message
@ -165,7 +164,8 @@
{ {
var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler; var handler = scope.ResolveOptional(subscription.HandlerType) as IDynamicIntegrationEventHandler;
if (handler == null) continue; if (handler == null) continue;
dynamic eventData = JObject.Parse(message);
using dynamic eventData = JsonDocument.Parse(message);
await handler.Handle(eventData); await handler.Handle(eventData);
} }
else else
@ -173,7 +173,7 @@
var handler = scope.ResolveOptional(subscription.HandlerType); var handler = scope.ResolveOptional(subscription.HandlerType);
if (handler == null) continue; if (handler == null) continue;
var eventType = _subsManager.GetEventTypeByName(eventName); var eventType = _subsManager.GetEventTypeByName(eventName);
var integrationEvent = JsonConvert.DeserializeObject(message, eventType); var integrationEvent = JsonSerializer.Deserialize(message, eventType);
var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType); var concreteType = typeof(IIntegrationEventHandler<>).MakeGenericType(eventType);
await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent }); await (Task)concreteType.GetMethod("Handle").Invoke(handler, new object[] { integrationEvent });
} }

View File

@ -12,8 +12,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,6 +1,6 @@
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events; using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using Newtonsoft.Json;
using System; using System;
using System.Text.Json;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
@ -13,8 +13,11 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
{ {
EventId = @event.Id; EventId = @event.Id;
CreationTime = @event.CreationDate; CreationTime = @event.CreationDate;
EventTypeName = @event.GetType().FullName; EventTypeName = @event.GetType().FullName;
Content = JsonConvert.SerializeObject(@event); Content = JsonSerializer.Serialize(@event, @event.GetType(), new JsonSerializerOptions
{
WriteIndented = true
});
State = EventStateEnum.NotPublished; State = EventStateEnum.NotPublished;
TimesSent = 0; TimesSent = 0;
TransactionId = transactionId.ToString(); TransactionId = transactionId.ToString();
@ -32,8 +35,8 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF
public string TransactionId { get; private set; } public string TransactionId { get; private set; }
public IntegrationEventLogEntry DeserializeJsonContent(Type type) public IntegrationEventLogEntry DeserializeJsonContent(Type type)
{ {
IntegrationEvent = JsonConvert.DeserializeObject(Content, type) as IntegrationEvent; IntegrationEvent = JsonSerializer.Deserialize(Content, type, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }) as IntegrationEvent;
return this; return this;
} }
} }

View File

@ -0,0 +1,120 @@
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using StackExchange.Redis;
using System;
namespace OpenTelemetry.Customization.Extensions
{
public static class OpenTelemetryExtensions
{
public static IServiceCollection AddOpenTelemetry(this IServiceCollection services, OpenTelemetryConfig openTelemetryConfig)
{
if (openTelemetryConfig == null || openTelemetryConfig.ExportType == null)
{
return services;
}
return services.AddOpenTelemetryTracing((serviceProvider, tracerProviderBuilder) =>
{
// Configure resource
tracerProviderBuilder
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(openTelemetryConfig.ServiceName));
// Configure instrumentation
tracerProviderBuilder
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddGrpcClientInstrumentation()
.AddSqlClientInstrumentation();
// Configure exporter
switch (openTelemetryConfig.ExportType)
{
case "jaeger":
tracerProviderBuilder.AddJaegerExporter(options =>
{
options.AgentHost = openTelemetryConfig.ExportToolEndpoint;
});
break;
case "otlp":
tracerProviderBuilder.AddOtlpExporter(options =>
{
options.Endpoint = new Uri(openTelemetryConfig.ExportToolEndpoint);
var headers = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_TRACES_HEADERS")
?? Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_HEADERS");
options.Headers = headers;
});
break;
case "zipkin":
tracerProviderBuilder.AddZipkinExporter(options =>
{
options.Endpoint = new Uri(openTelemetryConfig.ExportToolEndpoint);
});
break;
default:
tracerProviderBuilder.AddConsoleExporter();
break;
}
});
}
public static IServiceCollection AddOpenTelemetry(this IServiceCollection services, ConnectionMultiplexer connectionMultiplexer, OpenTelemetryConfig openTelemetryConfig)
{
if (openTelemetryConfig == null || openTelemetryConfig.ExportType == null)
{
return services;
}
return services.AddOpenTelemetryTracing((serviceProvider, tracerProviderBuilder) =>
{
// Configure resource
tracerProviderBuilder
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(openTelemetryConfig.ServiceName));
// Configure instrumentation
tracerProviderBuilder
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddGrpcClientInstrumentation()
.AddRedisInstrumentation(connectionMultiplexer);
// Configure exporter
switch (openTelemetryConfig.ExportType)
{
case "jaeger":
tracerProviderBuilder.AddJaegerExporter(options =>
{
options.AgentHost = openTelemetryConfig.ExportToolEndpoint;
});
break;
case "otlp":
tracerProviderBuilder.AddOtlpExporter(options =>
{
options.Endpoint = new Uri(openTelemetryConfig.ExportToolEndpoint);
var headers = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_TRACES_HEADERS")
?? Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_HEADERS");
options.Headers = headers;
});
break;
case "zipkin":
tracerProviderBuilder.AddZipkinExporter(options =>
{
options.Endpoint = new Uri(openTelemetryConfig.ExportToolEndpoint);
});
break;
default:
tracerProviderBuilder.AddConsoleExporter();
break;
}
});
}
}
}

View File

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
<PackageReference Include="OpenTelemetry" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc2" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenTelemetry.Customization
{
public class OpenTelemetryConfig
{
public string ServiceName { get; set; }
public string ExportType { get; set; }
public string ExportToolEndpoint { get; set; }
}
}

View File

@ -9,6 +9,13 @@
<LangVersion>preview</LangVersion> <LangVersion>preview</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Extensions\**" />
<Content Remove="Extensions\**" />
<EmbeddedResource Remove="Extensions\**" />
<None Remove="Extensions\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Update="web.config"> <Content Update="web.config">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
@ -21,6 +28,8 @@
<PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.1" /> <PackageReference Include="AspNetCore.HealthChecks.Redis" Version="5.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" /> <PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.1" />
<PackageReference Include="Azure.Identity" Version="1.4.0" />
<PackageReference Include="Google.Protobuf" Version="3.14.0" /> <PackageReference Include="Google.Protobuf" Version="3.14.0" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.34.0" /> <PackageReference Include="Grpc.AspNetCore.Server" Version="2.34.0" />
<PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" /> <PackageReference Include="Grpc.Tools" Version="2.34.0" PrivateAssets="All" />
@ -30,8 +39,6 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics.HealthChecks" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" /> <PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.11" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.2" /> <PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="5.0.2" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" /> <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" /> <PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
@ -42,18 +49,6 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc2" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc2" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Protobuf Include="Proto\basket.proto" GrpcServices="Server" Generator="MSBuild:Compile" /> <Protobuf Include="Proto\basket.proto" GrpcServices="Server" Generator="MSBuild:Compile" />
<Content Include="@(Protobuf)" /> <Content Include="@(Protobuf)" />
@ -64,6 +59,7 @@
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusRabbitMQ\EventBusRabbitMQ.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBusServiceBus\EventBusServiceBus.csproj" />
<ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" /> <ProjectReference Include="..\..\..\BuildingBlocks\EventBus\EventBus\EventBus.csproj" />
<ProjectReference Include="..\..\..\OpenTelemetry\OpenTelemetry.Customization.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app WORKDIR /app
EXPOSE 80 EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim AS build FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src WORKDIR /src
# It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles # It's important to keep lines from here down to "COPY . ." identical in all Dockerfiles
@ -13,6 +13,7 @@ COPY "ApiGateways/Mobile.Bff.Shopping/aggregator/Mobile.Shopping.HttpAggregator.
COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" COPY "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj" "ApiGateways/Web.Bff.Shopping/aggregator/Web.Shopping.HttpAggregator.csproj"
COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" COPY "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj" "BuildingBlocks/Devspaces.Support/Devspaces.Support.csproj"
COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj" COPY "BuildingBlocks/EventBus/EventBus/EventBus.csproj" "BuildingBlocks/EventBus/EventBus/EventBus.csproj"
COPY "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj" "BuildingBlocks/EventBus/EventBus.Tests/EventBus.Tests.csproj"
COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" COPY "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj" "BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj"
COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" COPY "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj" "BuildingBlocks/EventBus/EventBusServiceBus/EventBusServiceBus.csproj"
COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" COPY "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj" "BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj"
@ -38,6 +39,8 @@ COPY "Web/WebhookClient/WebhookClient.csproj" "Web/WebhookClient/WebhookClient.c
COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj" COPY "Web/WebMVC/WebMVC.csproj" "Web/WebMVC/WebMVC.csproj"
COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj" COPY "Web/WebSPA/WebSPA.csproj" "Web/WebSPA/WebSPA.csproj"
COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj" COPY "Web/WebStatus/WebStatus.csproj" "Web/WebStatus/WebStatus.csproj"
COPY "OpenTelemetry/OpenTelemetry.Customization.csproj" "OpenTelemetry/OpenTelemetry.Customization.csproj"
COPY "docker-compose.dcproj" "docker-compose.dcproj" COPY "docker-compose.dcproj" "docker-compose.dcproj"

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0.102-ca-patch-buster-slim FROM mcr.microsoft.com/dotnet/sdk:5.0
ARG BUILD_CONFIGURATION=Debug ARG BUILD_CONFIGURATION=Debug
ENV ASPNETCORE_ENVIRONMENT=Development ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_USE_POLLING_FILE_WATCHER=true ENV DOTNET_USE_POLLING_FILE_WATCHER=true

View File

@ -1,10 +1,10 @@
using Microsoft.eShopOnContainers.Services.Basket.API.Model; using Microsoft.eShopOnContainers.Services.Basket.API.Model;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using StackExchange.Redis; using StackExchange.Redis;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Text.Json;
namespace Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories namespace Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories
{ {
@ -43,12 +43,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Reposit
return null; return null;
} }
return JsonConvert.DeserializeObject<CustomerBasket>(data); return JsonSerializer.Deserialize<CustomerBasket>(data, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
} }
public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket basket) public async Task<CustomerBasket> UpdateBasketAsync(CustomerBasket basket)
{ {
var created = await _database.StringSetAsync(basket.BuyerId, JsonConvert.SerializeObject(basket)); var created = await _database.StringSetAsync(basket.BuyerId, JsonSerializer.Serialize(basket));
if (!created) if (!created)
{ {

View File

@ -1,66 +0,0 @@
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using StackExchange.Redis;
using System;
static class OpenTelemetryExtensions
{
public static void AddOpenTelemetry(ConnectionMultiplexer connectionMultiplexer)
{
var exportType = Environment.GetEnvironmentVariable("OTEL_USE_EXPORTER")?.ToLower();
if (exportType == null)
{
return;
}
var tracerProviderBuilder = Sdk.CreateTracerProviderBuilder();
// Configure resource
tracerProviderBuilder
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("Basket.API"));
// Configure instrumentation
tracerProviderBuilder
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddRedisInstrumentation(connectionMultiplexer);
// Configure exporter
switch (exportType)
{
case "jaeger":
tracerProviderBuilder.AddJaegerExporter(options =>
{
var agentHost = Environment.GetEnvironmentVariable("OTEL_EXPORTER_JAEGER_AGENTHOST");
options.AgentHost = agentHost;
});
break;
case "otlp":
tracerProviderBuilder.AddOtlpExporter(options =>
{
var endpoint = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")
?? Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_ENDPOINT");
options.Endpoint = new Uri(endpoint);
var headers = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_TRACES_HEADERS")
?? Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_HEADERS");
options.Headers = headers;
});
break;
case "zipkin":
tracerProviderBuilder.AddZipkinExporter(options =>
{
var endpoint = Environment.GetEnvironmentVariable("OTEL_EXPORTER_ZIPKIN_ENDPOINT");
options.Endpoint = new Uri(endpoint);
});
break;
default:
tracerProviderBuilder.AddConsoleExporter();
break;
}
tracerProviderBuilder.Build();
}
}

View File

@ -5,10 +5,12 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.eShopOnContainers.Services.Basket.API; using Microsoft.eShopOnContainers.Services.Basket.API;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Azure.Identity;
using Serilog; using Serilog;
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
using Azure.Core;
var configuration = GetConfiguration(); var configuration = GetConfiguration();
@ -88,10 +90,11 @@ IConfiguration GetConfiguration()
if (config.GetValue<bool>("UseVault", false)) if (config.GetValue<bool>("UseVault", false))
{ {
builder.AddAzureKeyVault( TokenCredential credential = new ClientSecretCredential(
$"https://{config["Vault:Name"]}.vault.azure.net/", config["Vault:TenantId"],
config["Vault:ClientId"], config["Vault:ClientId"],
config["Vault:ClientSecret"]); config["Vault:ClientSecret"]);
builder.AddAzureKeyVault(new Uri($"https://{config["Vault:Name"]}.vault.azure.net/"), credential);
} }
return builder.Build(); return builder.Build();
@ -109,4 +112,4 @@ public class Program
public static string Namespace = typeof(Startup).Namespace; public static string Namespace = typeof(Startup).Namespace;
public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1); public static string AppName = Namespace.Substring(Namespace.LastIndexOf('.', Namespace.LastIndexOf('.') - 1) + 1);
} }

Some files were not shown because too many files have changed in this diff Show More