From 694afa1c6eaa81d90b7d5c7b94dc74deb9641171 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 09:26:41 -0700 Subject: [PATCH 01/26] Replace eShop with eShop on recipes --- .github/workflows/test.yaml | 36 +- ...ontainer.app.spec.ts => eshop.app.spec.ts} | 0 samples/eshop/README.md | 50 ++- samples/eshop/environments/aws.bicep | 54 +++ samples/eshop/environments/azure.bicep | 49 +++ samples/eshop/environments/containers.bicep | 32 ++ samples/eshop/eshop.bicep | 220 ++++++++++ samples/eshop/eshop/README.md | 39 ++ samples/eshop/{ => eshop}/envoy/Dockerfile | 0 samples/eshop/{ => eshop}/envoy/README.md | 2 +- samples/eshop/{ => eshop}/envoy/envoy.yaml | 0 .../eshop/eshop/iac/environments/aws.bicep | 53 +++ .../eshop/eshop/iac/environments/azure.bicep | 43 ++ .../eshop/iac/environments/containers.bicep | 32 ++ samples/eshop/{ => eshop}/iac/eshop.bicep | 106 ++--- samples/eshop/eshop/iac/infra/infra.bicep | 165 ++++++++ .../eshop/eshop/iac/infra/networking.bicep | 275 ++++++++++++ samples/eshop/eshop/iac/services/basket.bicep | 116 +++++ .../{ => eshop}/iac/services/catalog.bicep | 30 +- .../eshop/eshop/iac/services/identity.bicep | 165 ++++++++ .../eshop/eshop/iac/services/ordering.bicep | 244 +++++++++++ .../{ => eshop}/iac/services/payment.bicep | 21 +- samples/eshop/eshop/iac/services/seq.bicep | 36 ++ samples/eshop/eshop/iac/services/web.bicep | 190 +++++++++ .../eshop/eshop/iac/services/webhooks.bicep | 141 ++++++ .../eshop/iac/services/webshopping.bicep | 178 ++++++++ .../eshop/eshop/iac/services/webstatus.bicep | 142 +++++++ samples/eshop/iac/infra/aws.bicep | 379 ----------------- samples/eshop/iac/infra/azure.bicep | 400 ------------------ samples/eshop/iac/infra/containers.bicep | 343 --------------- samples/eshop/iac/infra/links.bicep | 52 --- samples/eshop/infra/infra.bicep | 165 ++++++++ .../{iac/services => infra}/networking.bicep | 0 samples/eshop/{iac => }/services/basket.bicep | 45 +- samples/eshop/services/catalog.bicep | 97 +++++ .../eshop/{iac => }/services/identity.bicep | 22 +- .../eshop/{iac => }/services/ordering.bicep | 59 +-- samples/eshop/services/payment.bicep | 55 +++ samples/eshop/{iac => }/services/seq.bicep | 0 samples/eshop/{iac => }/services/web.bicep | 21 +- .../eshop/{iac => }/services/webhooks.bicep | 41 +- .../{iac => }/services/webshopping.bicep | 23 +- .../eshop/{iac => }/services/webstatus.bicep | 14 +- samples/eshop/src/README.md | 3 + samples/eshop/src/envoy/Dockerfile | 3 + samples/eshop/src/envoy/README.md | 14 + samples/eshop/src/envoy/envoy.yaml | 143 +++++++ 47 files changed, 2819 insertions(+), 1479 deletions(-) rename playwright/tests/eshop/{container.app.spec.ts => eshop.app.spec.ts} (100%) create mode 100644 samples/eshop/environments/aws.bicep create mode 100644 samples/eshop/environments/azure.bicep create mode 100644 samples/eshop/environments/containers.bicep create mode 100644 samples/eshop/eshop.bicep create mode 100644 samples/eshop/eshop/README.md rename samples/eshop/{ => eshop}/envoy/Dockerfile (100%) rename samples/eshop/{ => eshop}/envoy/README.md (94%) rename samples/eshop/{ => eshop}/envoy/envoy.yaml (100%) create mode 100644 samples/eshop/eshop/iac/environments/aws.bicep create mode 100644 samples/eshop/eshop/iac/environments/azure.bicep create mode 100644 samples/eshop/eshop/iac/environments/containers.bicep rename samples/eshop/{ => eshop}/iac/eshop.bicep (68%) create mode 100644 samples/eshop/eshop/iac/infra/infra.bicep create mode 100644 samples/eshop/eshop/iac/infra/networking.bicep create mode 100644 samples/eshop/eshop/iac/services/basket.bicep rename samples/eshop/{ => eshop}/iac/services/catalog.bicep (69%) create mode 100644 samples/eshop/eshop/iac/services/identity.bicep create mode 100644 samples/eshop/eshop/iac/services/ordering.bicep rename samples/eshop/{ => eshop}/iac/services/payment.bicep (67%) create mode 100644 samples/eshop/eshop/iac/services/seq.bicep create mode 100644 samples/eshop/eshop/iac/services/web.bicep create mode 100644 samples/eshop/eshop/iac/services/webhooks.bicep create mode 100644 samples/eshop/eshop/iac/services/webshopping.bicep create mode 100644 samples/eshop/eshop/iac/services/webstatus.bicep delete mode 100644 samples/eshop/iac/infra/aws.bicep delete mode 100644 samples/eshop/iac/infra/azure.bicep delete mode 100644 samples/eshop/iac/infra/containers.bicep delete mode 100644 samples/eshop/iac/infra/links.bicep create mode 100644 samples/eshop/infra/infra.bicep rename samples/eshop/{iac/services => infra}/networking.bicep (100%) rename samples/eshop/{iac => }/services/basket.bicep (71%) create mode 100644 samples/eshop/services/catalog.bicep rename samples/eshop/{iac => }/services/identity.bicep (88%) rename samples/eshop/{iac => }/services/ordering.bicep (78%) create mode 100644 samples/eshop/services/payment.bicep rename samples/eshop/{iac => }/services/seq.bicep (100%) rename samples/eshop/{iac => }/services/web.bicep (89%) rename samples/eshop/{iac => }/services/webhooks.bicep (80%) rename samples/eshop/{iac => }/services/webshopping.bicep (89%) rename samples/eshop/{iac => }/services/webstatus.bicep (92%) create mode 100644 samples/eshop/src/README.md create mode 100644 samples/eshop/src/envoy/Dockerfile create mode 100644 samples/eshop/src/envoy/README.md create mode 100644 samples/eshop/src/envoy/envoy.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b8c6b5e2..5c38f6cb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,26 +52,27 @@ jobs: app: myapp path: ./samples/volumes/app.bicep enableDapr: false - - name: eshop + - name: eshop (containers) runOnPullRequest: true app: eshop + env: containers-eshop-env path: ./samples/eshop/iac/eshop.bicep - uiTestFile: tests/eshop/container.app.spec.ts + uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - - name: eshop-azure + - name: eshop (Azure) runOnPullRequest: false - app: eshop-azure + app: eshop + env: azure-eshop-env path: ./samples/eshop/iac/eshop.bicep - args: -p platform=azure -p appName=eshop-azure - uiTestFile: tests/eshop/container.app.spec.ts + uiTestFile: tests/eshop/eshop.app.spec.ts credential: azure enableDapr: false - - name: eshop-aws + - name: eshop (AWS) runOnPullRequest: false - app: eshop-aws-${{ github.run_id }}-${{ github.run_attempt }} + app: eshop + env: aws-eshop-env path: ./samples/eshop/iac/eshop.bicep - args: -p platform=aws -p eksClusterName=eks-samplestest-${{ github.run_id }}-${{ github.run_attempt }}-eshop-aws -p appName=eshop-aws-${{ github.run_id }}-${{ github.run_attempt }} - uiTestFile: tests/eshop/container.app.spec.ts + uiTestFile: tests/eshop/eshop.app.spec.ts credential: aws enableDapr: false env: @@ -162,12 +163,9 @@ jobs: echo "Waiting for EKS cluster to be created..." sleep 60 done + aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} timeout-minutes: 60 continue-on-error: false - - name: Install k3d - if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential == 'aws' - run: | - aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} - name: Download k3d if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential != 'aws' run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash @@ -223,6 +221,16 @@ jobs: rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi # Deploy application and run tests + - name: Set Radius environment + if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.env != '' + run: | + rad env switch ${{ matrix.env }} + if [[ "${{ matrix.credential }}" == "azure" ]]; then + rad env update ${{ matrix.env }} --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} + fi + if [[ "${{ matrix.credential }}" == "aws" ]]; then + rad env update ${{ matrix.env }} --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} + fi - name: Deploy app if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad deploy ${{ matrix.path }} ${{ matrix.args }} diff --git a/playwright/tests/eshop/container.app.spec.ts b/playwright/tests/eshop/eshop.app.spec.ts similarity index 100% rename from playwright/tests/eshop/container.app.spec.ts rename to playwright/tests/eshop/eshop.app.spec.ts diff --git a/samples/eshop/README.md b/samples/eshop/README.md index f858478c..2f8725f5 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -1,6 +1,4 @@ -# eShop on Radius reference application - -Visit the [Project Radius docs](https://radapp.dev/getting-started/reference-apps/eshop/) to learn more and try it out. +# eShop on Recipes reference application ## Source @@ -14,26 +12,40 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) 1. Clone the repository and switch to the app directory: ```bash - git clone https://github.com/radius-project/samples.git + git clone https://github.com/project-radius/samples.git cd samples/reference-apps/eshop ``` -1. Deploy the app (choose which type of hosting infrastructure you wish to use): +1. Deploy the environment (choose which type of hosting infrastructure you wish to use): + ```bash + # Containers + rad deploy environments/containers.bicep - ### Containerized infrastructure - - ```bash - rad deploy iac/eshop.bicep - ``` + # Azure + rad deploy environments/azure.bicep - ### Azure infrastructure - - ```bash - rad deploy iac/eshop.bicep -p platform=azure - ``` + # AWS + rad deploy environments/aws.bicep -p awsAccountId= -p awsRegion= -p eksClusterName= + ``` +1. Switch to your new environment (choose which type of hosting infrastructure you wish to use): + ```bash + # Containers + rad env switch containers-eshop-env + + # Azure + rad env switch azure-eshop-env + + # AWS + rad env switch aws-eshop-env + ``` +1. Set credentials: + ```bash + # AWS + rad credential register aws --aws-access-key-id --aws-secret-access-key - ### AWS infrastructure - + # Azure + rad credential register azure --client-id --client-secret --tenant-id + ``` +1. Deploy the application: ```bash - rad deploy iac/eshop.bicep -p platform=aws -p eksClusterName= + rad deploy eshop.bicep -p adminLogin= or SA -p adminPassword= ``` - diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep new file mode 100644 index 00000000..5d2d2135 --- /dev/null +++ b/samples/eshop/environments/aws.bicep @@ -0,0 +1,54 @@ +import radius as rad + +@description('Account ID of the AWS account resources should be deployed in') +param awsAccountId string + +@description('AWS region that resources should be deployed in') +param awsRegion string + +@description('Name of your EKS cluster') +param eksClusterName string + +resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { + name: 'aws-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'aws-eshop' + } + providers: { + aws: { + scope: '/planes/aws/aws/accounts/${awsAccountId}/regions/${awsRegion}' + } + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-29' + parameters: { + eksClusterName: eksClusterName + } + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/aws/rediscaches:edge' + parameters: { + eksClusterName: eksClusterName + } + } + } + // Use containerized RabbitMQ instead of Amazon SQS + // https://github.com/radius-project/bicep-types-aws/blob/main/docs/reference/limitations.md + 'Applications.Messaging/rabbitMQQueues': { + rabbitmqmessagequeue: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + } + } + } + } +} diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep new file mode 100644 index 00000000..a78eedc3 --- /dev/null +++ b/samples/eshop/environments/azure.bicep @@ -0,0 +1,49 @@ +import radius as rad + +@description('Azure ResourceGroup name') +param azureResourceGroup string = resourceGroup().name + +@description('Azure SubscriptionId') +param azureSubscription string = subscription().subscriptionId + +resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { + name: 'azure-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'azure-eshop' + } + providers: { + azure: { + scope: '/subscriptions/${azureSubscription}/resourceGroups/${azureResourceGroup}' + } + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:latest' + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' + } + } + 'Applications.Messaging/rabbitMQQueues': { + rabbitmqmessagequeue: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + } + } + 'Applications.Core/extenders': { + servicebus: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/extender-servicebus:latest' + } + } + } + } +} diff --git a/samples/eshop/environments/containers.bicep b/samples/eshop/environments/containers.bicep new file mode 100644 index 00000000..8f842cf9 --- /dev/null +++ b/samples/eshop/environments/containers.bicep @@ -0,0 +1,32 @@ +import radius as rad + +resource containersEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { + name: 'containers-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'containers-eshop' + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radiusdev.azurecr.io/recipes/local-dev/sqldatabases:pr-29' + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rediscaches:edge' + } + } + 'Applications.Messaging/rabbitMQQueues': { + rabbitmqmessagequeue: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + } + } + } + } +} diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep new file mode 100644 index 00000000..c363bc61 --- /dev/null +++ b/samples/eshop/eshop.bicep @@ -0,0 +1,220 @@ +import radius as rad + +// Parameters ------------------------------------------------------- + +@description('Name of the application. Defaults to "eshop"') +param applicationName string = 'eshop' + +@description('Radius environment ID. Set automatically by Radius') +param environment string + +@description('SQL administrator username') +param adminLogin string = 'SA' + +@description('SQL administrator password') +@secure() +param adminPassword string = newGuid() + +// Variables --------------------------------------------------------- + +@description('Container image tag to use for eshop images') +var TAG = 'linux-dotnet7' + +// Get the environment name from the environment ID +var environmentName = last(split(environment, '/')) +resource eshopEnvironment 'Applications.Core/environments@2023-10-01-preview' existing = { + name: environmentName +} + +// Check if the environment has the rabbitmqqueues recipe enabled +// If it does not, use Azure ServiceBus +var AZURESERVICEBUSENABLED = contains(eshopEnvironment.properties.recipes, 'Applications.Messaging/rabbitmqqueues') ? 'False' : 'True' + +// Application -------------------------------------------------------- + +resource eshopApplication 'Applications.Core/applications@2023-10-01-preview' = { + name: applicationName + properties: { + environment: environment + } +} + +// Infrastructure ------------------------------------------------------ + +module infra 'infra/infra.bicep' = { + name: 'infra' + params: { + application: eshopApplication.id + environment: environment + adminLogin: adminLogin + adminPassword: adminPassword + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +// Networking ---------------------------------------------------------- + +module networking 'infra/networking.bicep' = { + name: 'networking' + params: { + application: eshopApplication.id + } +} + +// Services ------------------------------------------------------------ + +module basket 'services/basket.bicep' = { + name: 'basket' + params: { + application: eshopApplication.id + TAG: TAG + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + basketHttpName: networking.outputs.basketHttp + basketGrpcName: networking.outputs.basketGrpc + redisBasketName: infra.outputs.redisBasket + eventBusConnectionString: infra.outputs.eventBusConnectionString + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +module catalog 'services/catalog.bicep' = { + name: 'catalog' + params: { + application: eshopApplication.id + TAG: TAG + catalogGrpcName: networking.outputs.catalogGrpc + catalogHttpName: networking.outputs.catalogHttp + gatewayName: networking.outputs.gateway + sqlCatalogDbName: infra.outputs.sqlCatalogDb + eventBusConnectionString: infra.outputs.eventBusConnectionString + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +module identity 'services/identity.bicep' = { + name: 'identity' + params: { + application: eshopApplication.id + TAG: TAG + basketHttpName: networking.outputs.basketHttp + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + orderingHttpName: networking.outputs.orderingHttp + redisKeystoreName: infra.outputs.redisKeystore + sqlIdentityDbName: infra.outputs.sqlIdentityDb + webhooksclientHttpName: networking.outputs.webhooksclientHttp + webhooksHttpName: networking.outputs.webhooksHttp + webmvcHttpName: networking.outputs.webmvcHttp + webshoppingaggHttpName: networking.outputs.webshoppingaggHttp + } +} + +module ordering 'services/ordering.bicep' = { + name: 'ordering' + params: { + application: eshopApplication.id + TAG: TAG + basketHttpName: networking.outputs.basketHttp + catalogHttpName: networking.outputs.catalogHttp + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + orderbgtasksHttpName: networking.outputs.orderbgtasksHttp + orderingGrpcName: networking.outputs.orderingGrpc + orderingHttpName: networking.outputs.orderingHttp + orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp + redisKeystoreName: infra.outputs.redisKeystore + sqlOrderingDbName: infra.outputs.sqlOrderingDb + eventBusConnectionString: infra.outputs.eventBusConnectionString + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +module payment 'services/payment.bicep' = { + name: 'payment' + params: { + application: eshopApplication.id + TAG: TAG + paymentHttpName: networking.outputs.paymentHttp + eventBusConnectionString: infra.outputs.eventBusConnectionString + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +module seq 'services/seq.bicep' = { + name: 'seq' + params: { + application: eshopApplication.id + seqHttpName: networking.outputs.seqHttp + } +} + +module web 'services/web.bicep' = { + name: 'web' + params: { + application: eshopApplication.id + TAG: TAG + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp + redisKeystoreName: infra.outputs.redisKeystore + webmvcHttpName: networking.outputs.webmvcHttp + webshoppingaggHttpName: networking.outputs.webshoppingaggHttp + webshoppingapigwHttpName: networking.outputs.webshoppingapigwHttp + webspaHttpName: networking.outputs.webspaHttp + } +} + +module webhooks 'services/webhooks.bicep' = { + name: 'webhooks' + params: { + application: eshopApplication.id + TAG: TAG + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + sqlWebhooksDbName: infra.outputs.sqlWebhooksDb + webhooksclientHttpName: networking.outputs.webhooksclientHttp + webhooksHttpName: networking.outputs.webhooksHttp + eventBusConnectionString: infra.outputs.eventBusConnectionString + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED + } +} + +module webshopping 'services/webshopping.bicep' = { + name: 'webshopping' + params: { + application: eshopApplication.id + TAG: TAG + basketGrpcName: networking.outputs.basketGrpc + basketHttpName: networking.outputs.basketHttp + catalogGrpcName: networking.outputs.catalogGrpc + catalogHttpName: networking.outputs.catalogHttp + gatewayName: networking.outputs.gateway + identityHttpName: networking.outputs.identityHttp + orderingGrpcName: networking.outputs.orderingGrpc + orderingHttpName: networking.outputs.basketHttp + paymentHttpName: networking.outputs.paymentHttp + webshoppingaggHttpName: networking.outputs.webshoppingaggHttp + webshoppingapigwHttp2Name: networking.outputs.webshoppingapigwHttp2 + webshoppingapigwHttpName: networking.outputs.webshoppingapigwHttp + } +} + +module webstatus 'services/webstatus.bicep' = { + name: 'webstatus' + params: { + application: eshopApplication.id + TAG: TAG + basketHttpName: networking.outputs.basketHttp + catalogHttpName: networking.outputs.catalogHttp + identityHttpName: networking.outputs.identityHttp + orderbgtasksHttpName: networking.outputs.orderbgtasksHttp + orderingHttpName: networking.outputs.orderingHttp + orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp + paymentHttpName: networking.outputs.paymentHttp + webmvcHttpName: networking.outputs.webmvcHttp + webshoppingaggHttpName: networking.outputs.webshoppingaggHttp + webspaHttpName: networking.outputs.webspaHttp + webstatusHttpName: networking.outputs.webstatusHttp + } +} diff --git a/samples/eshop/eshop/README.md b/samples/eshop/eshop/README.md new file mode 100644 index 00000000..5b06a7ff --- /dev/null +++ b/samples/eshop/eshop/README.md @@ -0,0 +1,39 @@ +# eShop on Radius reference application + +Visit the [Project Radius docs](https://radapp.dev/getting-started/reference-apps/eshop/) to learn more and try it out. + +## Source + +This reference app is a "radified" version of the [eShop on containers](https://github.com/dotnet-architecture/eShopOnContainers) .NET reference application. + +## Deploy + +1. Have a kubernetes cluster handy from the [supported clusters](https://docs.radapp.dev/operations/platforms/kubernetes/supported-clusters/). + - (AWS only) Make sure that each of the Subnets in your EKS cluster Subnet Group are within the list of [supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html) +1. [Install the rad CLI](https://radapp.dev/getting-started/) +1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) +1. Clone the repository and switch to the app directory: + ```bash + git clone https://github.com/project-radius/samples.git + cd samples/reference-apps/eshop + ``` +1. Deploy the app (choose which type of hosting infrastructure you wish to use): + + ### Containerized infrastructure + + ```bash + rad deploy iac/eshop.bicep + ``` + + ### Azure infrastructure + + ```bash + rad deploy iac/eshop.bicep -p platform=azure + ``` + + ### AWS infrastructure + + ```bash + rad deploy iac/eshop.bicep -p platform=aws -p eksClusterName= + ``` + diff --git a/samples/eshop/envoy/Dockerfile b/samples/eshop/eshop/envoy/Dockerfile similarity index 100% rename from samples/eshop/envoy/Dockerfile rename to samples/eshop/eshop/envoy/Dockerfile diff --git a/samples/eshop/envoy/README.md b/samples/eshop/eshop/envoy/README.md similarity index 94% rename from samples/eshop/envoy/README.md rename to samples/eshop/eshop/envoy/README.md index b542a623..d459ed4f 100644 --- a/samples/eshop/envoy/README.md +++ b/samples/eshop/eshop/envoy/README.md @@ -1,6 +1,6 @@ # Envoy for eshop -Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/radius-project/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. +Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. diff --git a/samples/eshop/envoy/envoy.yaml b/samples/eshop/eshop/envoy/envoy.yaml similarity index 100% rename from samples/eshop/envoy/envoy.yaml rename to samples/eshop/eshop/envoy/envoy.yaml diff --git a/samples/eshop/eshop/iac/environments/aws.bicep b/samples/eshop/eshop/iac/environments/aws.bicep new file mode 100644 index 00000000..4022cc9f --- /dev/null +++ b/samples/eshop/eshop/iac/environments/aws.bicep @@ -0,0 +1,53 @@ +import radius as rad + +@description('Account ID of the AWS account resources should be deployed in') +param awsAccountId string + +@description('AWS region that resources should be deployed in') +param awsRegion string + +@description('Name of your EKS cluster') +param eksClusterName string + +resource awsEshopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { + name: 'aws-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'aws-eshop' + } + providers: { + aws: { + scope: '/planes/aws/aws/accounts/${awsAccountId}/regions/${awsRegion}' + } + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-29' + parameters: { + eksClusterName: eksClusterName + } + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/aws/rediscaches:edge' + parameters: { + eksClusterName: eksClusterName + } + } + } + // Temporarily using containerized rabbitmq until we can use SQS or AmazonMQ + 'Applications.Messaging/rabbitMQQueues': { + rabbitmqmessagequeue: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + } + } + } + } +} diff --git a/samples/eshop/eshop/iac/environments/azure.bicep b/samples/eshop/eshop/iac/environments/azure.bicep new file mode 100644 index 00000000..5708f5a5 --- /dev/null +++ b/samples/eshop/eshop/iac/environments/azure.bicep @@ -0,0 +1,43 @@ +import radius as rad + +@description('Azure ResourceGroup name') +param azureResourceGroup string = resourceGroup().name + +@description('Azure SubscriptionId') +param azureSubscription string = subscription().subscriptionId + +resource azureEShopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { + name: 'azure-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'azure-eshop' + } + providers: { + azure: { + scope: '/subscriptions/${azureSubscription}/resourceGroups/${azureResourceGroup}' + } + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:latest' + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' + } + } + 'Applications.Core/extenders': { + servicebus: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/azure/extender-servicebus:latest' + } + } + } + } +} diff --git a/samples/eshop/eshop/iac/environments/containers.bicep b/samples/eshop/eshop/iac/environments/containers.bicep new file mode 100644 index 00000000..6fd47e85 --- /dev/null +++ b/samples/eshop/eshop/iac/environments/containers.bicep @@ -0,0 +1,32 @@ +import radius as rad + +resource containersEShopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { + name: 'containers-eshop-env' + properties: { + compute: { + kind: 'kubernetes' + resourceId: 'self' + namespace: 'containers-eshop' + } + recipes: { + 'Applications.Datastores/sqlDatabases': { + sqldatabase: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/sqldatabases:edge' + } + } + 'Applications.Datastores/redisCaches': { + rediscache: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rediscaches:edge' + } + } + 'Applications.Messaging/rabbitMQQueues': { + rabbitmqmessagequeue: { + templateKind: 'bicep' + templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + } + } + } + } +} diff --git a/samples/eshop/iac/eshop.bicep b/samples/eshop/eshop/iac/eshop.bicep similarity index 68% rename from samples/eshop/iac/eshop.bicep rename to samples/eshop/eshop/iac/eshop.bicep index 2f6b0308..ca171bfd 100644 --- a/samples/eshop/iac/eshop.bicep +++ b/samples/eshop/eshop/iac/eshop.bicep @@ -1,6 +1,6 @@ import radius as rad -// Paramaters ------------------------------------------------------- +// Parameters ------------------------------------------------------- @description('Name of the eshop application. Defaults to "eshop"') param appName string = 'eshop' @@ -8,22 +8,14 @@ param appName string = 'eshop' @description('Radius environment ID. Set automatically by Radius') param environment string -@description('What type of infrastructure to use. Options are "containers", "azure", or "aws". Defaults to containers') -@allowed([ - 'containers' - 'azure' - 'aws' -]) -param platform string = 'containers' - @description('SQL administrator username') -param adminLogin string = (platform == 'containers') ? 'SA' : 'sqladmin' +param adminLogin string = 'SA' @description('SQL administrator password') @secure() param adminPassword string = newGuid() -@description('What container orchestrator to use. Defaults to K8S') +@description('Container orchestrator to use. Defaults to "K8S"') @allowed([ 'K8S' ]) @@ -32,31 +24,33 @@ param ORCHESTRATOR_TYPE string = 'K8S' @description('Optional App Insights Key') param APPLICATION_INSIGHTS_KEY string = '' -@description('Use Azure storage for custom resource images. Defaults to False') +@description('Use Azure storage for custom resource images. Defaults to "False"') @allowed([ 'True' 'False' ]) param AZURESTORAGEENABLED string = 'False' -var AZURESERVICEBUSENABLED = (platform == 'azure') ? 'True' : 'False' +@description('Use Azure Service Bus for messaging. Defaults to "False"') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string = 'False' -@description('Use dev spaces. Defaults to False') +@description('Use dev spaces. Defaults to "False"') @allowed([ 'True' 'False' ]) param ENABLEDEVSPACES string = 'False' -@description('Cotnainer image tag to use for eshop images. Defaults to linux-dotnet7') +@description('Container image tag to use for eshop images. Defaults to "linux-dotnet7"') param TAG string = 'linux-dotnet7' -@description('Name of your EKS cluster. Only used if deploying with AWS infrastructure.') -param eksClusterName string = '' - // Application -------------------------------------------------------- -resource eshop 'Applications.Core/applications@2023-10-01-preview' = { +resource eshop 'Applications.Core/applications@2022-03-15-privatepreview' = { name: appName properties: { environment: environment @@ -65,54 +59,20 @@ resource eshop 'Applications.Core/applications@2023-10-01-preview' = { // Infrastructure ------------------------------------------------------ -module containers 'infra/containers.bicep' = if (platform == 'containers') { - name: 'containers' - params: { - application: eshop.id - environment: environment - adminPassword: adminPassword - } -} - -module azure 'infra/azure.bicep' = if (platform == 'azure') { - name: 'azure' - // Temporarily disable linter rule until deployment engine returns Azure resource group location instead of UCP resource group location - #disable-next-line explicit-values-for-loc-params +module infra 'infra/infra.bicep' = { + name: 'infra' params: { application: eshop.id environment: environment adminLogin: adminLogin adminPassword: adminPassword + AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED } } -module aws 'infra/aws.bicep' = if (platform == 'aws') { - name: 'aws' - params: { - application: eshop.id - eksClusterName: eksClusterName - environment: environment - adminLogin: adminLogin - adminPassword: adminPassword - applicationName: appName - } -} - -// Portable Resources ----------------------------------------------------------- -// TODO: Switch to Recipes once ready - -module links 'infra/links.bicep' = { - name: 'links' - dependsOn: [ - containers - azure - aws - ] -} - // Networking ---------------------------------------------------------- -module networking 'services/networking.bicep' = { +module networking 'infra/networking.bicep' = { name: 'networking' params: { application: eshop.id @@ -132,10 +92,9 @@ module basket 'services/basket.bicep' = { identityHttpName: networking.outputs.identityHttp basketHttpName: networking.outputs.basketHttp basketGrpcName: networking.outputs.basketGrpc - rabbitmqName: links.outputs.rabbitmq - redisBasketName: links.outputs.redisBasket + redisBasketName: infra.outputs.redisBasket TAG: TAG - serviceBusConnectionString: (AZURESERVICEBUSENABLED == 'True') ? azure.outputs.serviceBusAuthConnectionString : '' + eventBusConnectionString: infra.outputs.eventBusConnectionString } } @@ -150,10 +109,9 @@ module catalog 'services/catalog.bicep' = { catalogHttpName: networking.outputs.catalogHttp gatewayName: networking.outputs.gateway ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - rabbitmqName: links.outputs.rabbitmq - sqlCatalogDbName: links.outputs.sqlCatalogDb + sqlCatalogDbName: infra.outputs.sqlCatalogDb TAG: TAG - serviceBusConnectionString: (AZURESERVICEBUSENABLED == 'True') ? azure.outputs.serviceBusAuthConnectionString : '' + eventBusConnectionString: infra.outputs.eventBusConnectionString } } @@ -167,8 +125,8 @@ module identity 'services/identity.bicep' = { gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp orderingHttpName: networking.outputs.orderingHttp - redisKeystoreName: links.outputs.redisKeystore - sqlIdentityDbName: links.outputs.sqlIdentityDb + redisKeystoreName: infra.outputs.redisKeystore + sqlIdentityDbName: infra.outputs.sqlIdentityDb TAG: TAG webhooksclientHttpName: networking.outputs.webhooksclientHttp webhooksHttpName: networking.outputs.webhooksHttp @@ -192,11 +150,10 @@ module ordering 'services/ordering.bicep' = { orderingGrpcName: networking.outputs.orderingGrpc orderingHttpName: networking.outputs.orderingHttp orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp - rabbitmqName: links.outputs.rabbitmq - redisKeystoreName: links.outputs.redisKeystore - sqlOrderingDbName: links.outputs.sqlOrderingDb + redisKeystoreName: infra.outputs.redisKeystore + sqlOrderingDbName: infra.outputs.sqlOrderingDb TAG: TAG - serviceBusConnectionString: (AZURESERVICEBUSENABLED == 'True') ? azure.outputs.serviceBusAuthConnectionString : '' + eventBusConnectionString: infra.outputs.eventBusConnectionString } } @@ -208,9 +165,8 @@ module payment 'services/payment.bicep' = { AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE paymentHttpName: networking.outputs.paymentHttp - rabbitmqName: links.outputs.rabbitmq TAG: TAG - serviceBusConnectionString: (AZURESERVICEBUSENABLED == 'True') ? azure.outputs.serviceBusAuthConnectionString : '' + eventBusConnectionString: infra.outputs.eventBusConnectionString } } @@ -231,7 +187,7 @@ module web 'services/web.bicep' = { identityHttpName: networking.outputs.identityHttp ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp - redisKeystoreName: links.outputs.redisKeystore + redisKeystoreName: infra.outputs.redisKeystore TAG: TAG webmvcHttpName: networking.outputs.webmvcHttp webshoppingaggHttpName: networking.outputs.webshoppingaggHttp @@ -248,12 +204,11 @@ module webhooks 'services/webhooks.bicep' = { gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - rabbitmqName: links.outputs.rabbitmq - sqlWebhooksDbName: links.outputs.sqlWebhooksDb + sqlWebhooksDbName: infra.outputs.sqlWebhooksDb TAG: TAG webhooksclientHttpName: networking.outputs.webhooksclientHttp webhooksHttpName: networking.outputs.webhooksHttp - serviceBusConnectionString: (AZURESERVICEBUSENABLED == 'True') ? azure.outputs.serviceBusAuthConnectionString : '' + eventBusConnectionString: infra.outputs.eventBusConnectionString } } @@ -271,7 +226,6 @@ module webshopping 'services/webshopping.bicep' = { orderingGrpcName: networking.outputs.orderingGrpc orderingHttpName: networking.outputs.basketHttp paymentHttpName: networking.outputs.paymentHttp - rabbitmqName: links.outputs.rabbitmq TAG: TAG webshoppingaggHttpName: networking.outputs.webshoppingaggHttp webshoppingapigwHttp2Name: networking.outputs.webshoppingapigwHttp2 diff --git a/samples/eshop/eshop/iac/infra/infra.bicep b/samples/eshop/eshop/iac/infra/infra.bicep new file mode 100644 index 00000000..9cd58018 --- /dev/null +++ b/samples/eshop/eshop/iac/infra/infra.bicep @@ -0,0 +1,165 @@ +import radius as rad + +@description('Radius environment ID') +param environment string + +@description('Radius application ID') +param application string + +@description('SQL administrator username') +@secure() +param adminLogin string + +@description('SQL administrator password') +@secure() +param adminPassword string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +// Links --------------------------------------------------------------- + +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { + name: 'identitydb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'IdentityDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { + name: 'catalogdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'CatalogDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { + name: 'orderingdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'OrderingDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { + name: 'webhooksdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'WebhooksDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { + name: 'keystore-data' + properties: { + application: application + environment: environment + recipe: { + name: 'rediscache' + } + } +} + +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { + name: 'basket-data' + properties: { + application: application + environment: environment + recipe: { + name: 'rediscache' + } + } +} + +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = if (AZURESERVICEBUSENABLED == 'False') { + name: 'rabbitmq' + properties: { + application: application + environment: environment + recipe: { + name: 'rabbitmqmessagequeue' + } + } +} + +resource servicebus 'Applications.Core/extenders@2022-03-15-privatepreview' = if (AZURESERVICEBUSENABLED == 'True') { + name: 'servicebus' + properties: { + application: application + environment: environment + recipe: { + name: 'servicebus' + parameters: { + topicName: 'eshop_event_bus' + subscriptions: ['Basket', 'Catalog', 'Ordering', 'GracePeriod', 'Payment', 'backgroundtasks', 'Ordering.signalrhub', 'Webhooks'] + } + } + } +} + +// Outputs ------------------------------------ + +@description('The name of the SQL Identity Link') +output sqlIdentityDb string = sqlIdentityDb.name + +@description('The name of the SQL Catalog Link') +output sqlCatalogDb string = sqlCatalogDb.name + +@description('The name of the SQL Ordering Link') +output sqlOrderingDb string = sqlOrderingDb.name + +@description('The name of the SQL Webhooks Link') +output sqlWebhooksDb string = sqlWebhooksDb.name + +@description('The name of the Redis Keystore Link') +output redisKeystore string = redisKeystore.name + +@description('The name of the Redis Basket Link') +output redisBasket string = redisBasket.name + +@description('The name of the RabbitMQ Link') +output rabbitmq string = rabbitmq.name + +@description('The name of the Service Bus Link') +output servicebus string = servicebus.name + +@description('Event Bus connection string') +output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.secrets('connectionString') : rabbitmq.properties.host diff --git a/samples/eshop/eshop/iac/infra/networking.bicep b/samples/eshop/eshop/iac/infra/networking.bicep new file mode 100644 index 00000000..2ceb05d3 --- /dev/null +++ b/samples/eshop/eshop/iac/infra/networking.bicep @@ -0,0 +1,275 @@ +import radius as rad + +// PARAMETERS ------------------------------------------------------------ +@description('Radius application ID') +param application string + +// GATEWAY --------------------------------------------------------- + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' = { + name: 'gateway' + properties: { + application: application + routes: [ + { + path: '/identity-api' + destination: identityHttp.id + } + { + path: '/ordering-api' + destination: orderingHttp.id + } + { + path: '/basket-api' + destination: basketHttp.id + } + { + path: '/webhooks-api' + destination: webhooksHttp.id + } + { + path: '/webshoppingagg' + destination: webshoppingaggHttp.id + } + { + path: '/webshoppingapigw' + destination: webshoppingapigwHttp.id + } + { + path: '/webhooks-web' + destination: webhooksclientHttp.id + } + { + path: '/webstatus' + destination: webstatusHttp.id + } + { + path: '/' + destination: webspaHttp.id + } + { + path: '/webmvc' + destination: webmvcHttp.id + } + ] + } +} + + +// ROUTES ---------------------------------------------------------- + +resource basketHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'basket-http' + properties: { + application: application + port: 5103 + } +} + +resource basketGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'basket-grpc' + properties: { + application: application + port: 9103 + } +} + +resource catalogHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'catalog-http' + properties: { + application: application + port: 5101 + } +} + +resource catalogGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'catalog-grpc' + properties: { + application: application + port: 9101 + } +} + +resource identityHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'identity-http' + properties: { + application: application + port: 5105 + } +} + +resource orderingHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'ordering-http' + properties: { + application: application + port: 5102 + } +} + +resource orderingGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'ordering-grpc' + properties: { + application: application + port: 9102 + } +} + +resource orderingsignalrhubHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'orderingsignalrhub-http' + properties: { + application: application + port: 5112 + } +} + +resource orderbgtasksHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'orderbgtasks-http' + properties: { + application: application + port: 5111 + } +} + +resource paymentHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'payment-http' + properties: { + application: application + port: 5108 + } +} + +resource seqHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'seq-http' + properties: { + application: application + port: 5340 + } +} + +resource webspaHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webspa-http' + properties: { + application: application + port: 5104 + } +} + +resource webmvcHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webmvc-http' + properties: { + application: application + port: 5100 + } +} + +resource webhooksHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webhooks-http' + properties: { + application: application + port: 5113 + } +} + +resource webhooksclientHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webhooksclient-http' + properties: { + application: application + port: 5114 + hostname: '/webhooks-web' + } +} + +resource webshoppingaggHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webshoppingagg-http' + properties: { + application: application + port: 5121 + } +} + +resource webshoppingapigwHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webshoppingapigw-http' + properties: { + application: application + port: 5202 + } +} + +resource webshoppingapigwHttp2 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webshoppingapigw-http-2' + properties: { + application: application + port: 15202 + } +} + +resource webstatusHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { + name: 'webstatus-http' + properties: { + application: application + port: 8107 + } +} + +// OUTPUTS -------------------------------------------------------------------- + +@description('Name of the Gateway') +output gateway string = gateway.name + +@description('Name of the Basket HTTP route') +output basketHttp string = basketHttp.name + +@description('Name of the Basket gRPC route') +output basketGrpc string = basketGrpc.name + +@description('Name of the Catalog HTTP route') +output catalogHttp string = catalogHttp.name + +@description('Name of the Catalog gRPC route') +output catalogGrpc string = catalogGrpc.name + +@description('Name of the Identity HTTP route') +output identityHttp string = identityHttp.name + +@description('Name of the Ordering HTTP route') +output orderingHttp string = orderingHttp.name + +@description('Name of the Ordering gRPC route') +output orderingGrpc string = orderingGrpc.name + +@description('Name of the Ordering SignalR Hub HTTP route') +output orderingsignalrhubHttp string = orderingsignalrhubHttp.name + +@description('Name of the Ordering Background Tasks HTTP route') +output orderbgtasksHttp string = orderbgtasksHttp.name + +@description('Name of the Payment HTTP route') +output paymentHttp string = paymentHttp.name + +@description('Name of the SEQ HTTP route') +output seqHttp string = seqHttp.name + +@description('Name of the WebSPA HTTP route') +output webspaHttp string = webspaHttp.name + +@description('Name of the WebMVC HTTP route') +output webmvcHttp string = webmvcHttp.name + +@description('Name of the Webhooks HTTP route') +output webhooksHttp string = webhooksHttp.name + +@description('Name of the Webhooks Client HTTP route') +output webhooksclientHttp string = webhooksclientHttp.name + +@description('Name of the WebShopping Aggregator HTTP route') +output webshoppingaggHttp string = webshoppingaggHttp.name + +@description('Name of the WebShopping API Gateway HTTP route') +output webshoppingapigwHttp string = webshoppingapigwHttp.name + +@description('Name of the WebShopping API Gateway HTTP route') +output webshoppingapigwHttp2 string = webshoppingapigwHttp2.name + +@description('Name of the WebStatus HTTP route') +output webstatusHttp string = webstatusHttp.name + diff --git a/samples/eshop/eshop/iac/services/basket.bicep b/samples/eshop/eshop/iac/services/basket.bicep new file mode 100644 index 00000000..ad1b4cc0 --- /dev/null +++ b/samples/eshop/eshop/iac/services/basket.bicep @@ -0,0 +1,116 @@ +import radius as rad + +// Parameters --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Optional App Insights Key') +param APPLICATION_INSIGHTS_KEY string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Use Azure Service Bus for messaging') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +@description('The name of the Radius Gateway') +param gatewayName string + +@description('The name of the Identity HTTP Route') +param identityHttpName string + +@description('The name of the Basket HTTP Route') +param basketHttpName string + +@description('The name of the Basket gRPC Route') +param basketGrpcName string + +@description('The name of the Redis Basket Link') +param redisBasketName string + +@description('The connection string for the event bus') +@secure() +param eventBusConnectionString string + +// Container ------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/basket-api +resource basket 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'basket-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/basket.api:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + UseLoadTest: 'False' + PATH_BASE: '/basket-api' + OrchestratorType: ORCHESTRATOR_TYPE + PORT: '80' + GRPC_PORT: '81' + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + ConnectionString: redisBasket.connectionString() + EventBusConnection: eventBusConnectionString + identityUrl: identityHttp.properties.url + IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: basketHttp.id + } + grpc: { + containerPort: 81 + provides: basketGrpc.id + } + } + } + connections: { + redis: { + source: redisBasket.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// Networking ------------------------------------------- + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketHttpName +} + +resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketGrpcName +} + +// Links ------------------------------------------ + +resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { + name: redisBasketName +} diff --git a/samples/eshop/iac/services/catalog.bicep b/samples/eshop/eshop/iac/services/catalog.bicep similarity index 69% rename from samples/eshop/iac/services/catalog.bicep rename to samples/eshop/eshop/iac/services/catalog.bicep index b63479e1..a4d7a3ce 100644 --- a/samples/eshop/iac/services/catalog.bicep +++ b/samples/eshop/eshop/iac/services/catalog.bicep @@ -28,7 +28,7 @@ param AZURESTORAGEENABLED string ]) param AZURESERVICEBUSENABLED string -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -40,23 +40,21 @@ param catalogHttpName string @description('The name of the Catalog gRPC Route') param catalogGrpcName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - -@description('The name of the Catalog SQL portable resource') +@description('The name of the Catalog SQL Link') param sqlCatalogDbName string -@description('The connection string of the Azure Service Bus') +@description('The connection string for the event bus') @secure() -param serviceBusConnectionString string +param eventBusConnectionString string // VARIABLES ----------------------------------------------------------------------------------- + var PICBASEURL = '${gateway.properties.url}/webshoppingapigw/c/api/v1/catalog/items/[0]/pic' // CONTAINERS ------------------------------------------------------------------- // Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/catalog-api -resource catalog 'Applications.Core/containers@2023-10-01-preview' = { +resource catalog 'Applications.Core/containers@2022-03-15-privatepreview' = { name: 'catalog-api' properties: { application: application @@ -74,7 +72,7 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = { ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlCatalogDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -97,24 +95,20 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = { // NETWORKING ------------------------------------------------------ -resource gateway 'Applications.Core/gateways@2023-10-01-preview' existing = { +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { name: gatewayName } -resource catalogHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { +resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { name: catalogHttpName } -resource catalogGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { +resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { name: catalogGrpcName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlCatalogDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/eshop/iac/services/identity.bicep b/samples/eshop/eshop/iac/services/identity.bicep new file mode 100644 index 00000000..81130344 --- /dev/null +++ b/samples/eshop/eshop/iac/services/identity.bicep @@ -0,0 +1,165 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('Optional App Insights Key') +param APPLICATION_INSIGHTS_KEY string + +@description('Use dev spaces') +@allowed([ + 'True' + 'False' +]) +param ENABLEDEVSPACES string + +@description('Container image tag to use for eshop images. Defaults to linux-dotnet7') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('Name of the Identity HTTP Route') +param identityHttpName string + +@description('Name of the Basket HTTP Route') +param basketHttpName string + +@description('Name of the Ordering HTTP Route') +param orderingHttpName string + +@description('Name of the WebShoppingAgg HTTP Route') +param webshoppingaggHttpName string + +@description('Name of the Webhooks HTTP Route') +param webhooksHttpName string + +@description('Name of the WebhooksClient HTTP Route') +param webhooksclientHttpName string + +@description('Name of the WebMVC HTTP Route') +param webmvcHttpName string + +@description('Name of the Identity SQL Database Link') +param sqlIdentityDbName string + +@description('Name of the Keystore Redis Link') +param redisKeystoreName string + +// CONTAINERS ------------------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/identity-api +resource identity 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'identity-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/identity.api:${TAG}' + env: { + PATH_BASE: '/identity-api' + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + OrchestratorType: 'K8S' + IsClusterEnv: 'True' + DPConnectionString: redisKeystore.connectionString() + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + XamarinCallback: '' + EnableDevspaces: ENABLEDEVSPACES + ConnectionString: sqlIdentityDb.connectionString() + MvcClient: '${gateway.properties.url}/${webmvcHttp.properties.hostname}' + SpaClient: gateway.properties.url + BasketApiClient: '${gateway.properties.url}/${basketHttp.properties.hostname}' + OrderingApiClient: '${gateway.properties.url}/${orderingHttp.properties.hostname}' + WebShoppingAggClient: '${gateway.properties.url}/${webshoppingaggHttp.properties.hostname}' + WebhooksApiClient: '${gateway.properties.url}/${webhooksHttp.properties.hostname}' + WebhooksWebClient: '${gateway.properties.url}/${webhooksclientHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: identityHttp.id + } + } + } + connections: { + redis: { + source: redisKeystore.id + disableDefaultEnvVars: true + } + sql: { + source: sqlIdentityDb.id + disableDefaultEnvVars: true + } + webmvc: { + source: webmvcHttp.id + disableDefaultEnvVars: true + } + basket: { + source: basketHttp.id + disableDefaultEnvVars: true + } + ordering: { + source: orderingHttp.id + disableDefaultEnvVars: true + } + webshoppingagg: { + source: webshoppingaggHttp.id + disableDefaultEnvVars: true + } + webhooks: { + source: webhooksHttp.id + disableDefaultEnvVars: true + } + webhoolsclient: { + source: webhooksclientHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// NETWORKING ------------------------------------------------------ + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketHttpName +} + +resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingHttpName +} + +resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingaggHttpName +} + +resource webhooksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webhooksHttpName +} + +resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webhooksclientHttpName +} + +resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webmvcHttpName +} + +// LINKS ----------------------------------------------------------- + +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { + name: sqlIdentityDbName +} + +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { + name: redisKeystoreName +} diff --git a/samples/eshop/eshop/iac/services/ordering.bicep b/samples/eshop/eshop/iac/services/ordering.bicep new file mode 100644 index 00000000..b78f9343 --- /dev/null +++ b/samples/eshop/eshop/iac/services/ordering.bicep @@ -0,0 +1,244 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Optional App Insights Key') +param APPLICATION_INSIGHTS_KEY string + +@description('Use Azure Service Bus for messaging') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('Name of the Identity HTTP Route') +param identityHttpName string + +@description('Name of the Basket HTTP Route') +param basketHttpName string + +@description('The name of the Catalog HTTP Route') +param catalogHttpName string + +@description('Name of the Ordering HTTP Route') +param orderingHttpName string + +@description('Name of the Ordering gRPC Route') +param orderingGrpcName string + +@description('Name of the Ordering SignalR Hub HTTP Route') +param orderingsignalrhubHttpName string + +@description('Name of the Ordering background tasks HTTP Route') +param orderbgtasksHttpName string + +@description('Name of the Keystore Redis Link') +param redisKeystoreName string + +@description('Name of the Ordering SQL Link') +param sqlOrderingDbName string + +@description('The connection string for the event bus') +@secure() +param eventBusConnectionString string + +// CONTAINERS ------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-api +resource ordering 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'ordering-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/ordering.api:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + UseCustomizationData: 'False' + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + CheckUpdateTime: '30000' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + OrchestratorType: ORCHESTRATOR_TYPE + UseLoadTest: 'False' + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' + 'Serilog__MinimumLevel__Override__ordering-api': 'Verbose' + PATH_BASE: '/ordering-api' + GRPC_PORT: '81' + PORT: '80' + ConnectionString: sqlOrderingDb.connectionString() + EventBusConnection: eventBusConnectionString + identityUrl: identityHttp.properties.url + IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: orderingHttp.id + } + grpc: { + containerPort: 81 + provides: orderingGrpc.id + } + } + } + connections: { + sql: { + source: sqlOrderingDb.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-backgroundtasks +resource orderbgtasks 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'ordering-backgroundtasks' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/ordering.backgroundtasks:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + UseCustomizationData: 'False' + CheckUpdateTime: '30000' + GracePeriodTime: '1' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + UseLoadTest: 'False' + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' + OrchestratorType: ORCHESTRATOR_TYPE + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + ConnectionString: sqlOrderingDb.connectionString() + EventBusConnection: eventBusConnectionString + } + ports: { + http: { + containerPort: 80 + provides: orderbgtasksHttp.id + } + } + } + connections: { + sql: { + source: sqlOrderingDb.id + disableDefaultEnvVars: true + } + } + } +} + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-signalrhub +resource orderingsignalrhub 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'ordering-signalrhub' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/ordering.signalrhub:${TAG}' + env: { + PATH_BASE: '/payment-api' + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + OrchestratorType: ORCHESTRATOR_TYPE + IsClusterEnv: 'True' + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + EventBusConnection: eventBusConnectionString + SignalrStoreConnectionString: redisKeystore.connectionString() + identityUrl: identityHttp.properties.url + IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: orderingsignalrhubHttp.id + } + } + } + connections: { + redis: { + source: redisKeystore.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + ordering: { + source: orderingHttp.id + disableDefaultEnvVars: true + } + catalog: { + source: catalogHttp.id + disableDefaultEnvVars: true + } + basket: { + source: basketHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// NETWORKING ------------------------------------------------------ + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketHttpName +} + +resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: catalogHttpName +} + +resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingHttpName +} + +resource orderingGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingGrpcName +} + +resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingsignalrhubHttpName +} + +resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderbgtasksHttpName +} + +// LINKS ----------------------------------------------------------- + +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { + name: redisKeystoreName +} + +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { + name: sqlOrderingDbName +} diff --git a/samples/eshop/iac/services/payment.bicep b/samples/eshop/eshop/iac/services/payment.bicep similarity index 67% rename from samples/eshop/iac/services/payment.bicep rename to samples/eshop/eshop/iac/services/payment.bicep index e0fa6f08..2bbaa9d2 100644 --- a/samples/eshop/iac/services/payment.bicep +++ b/samples/eshop/eshop/iac/services/payment.bicep @@ -21,23 +21,20 @@ param APPLICATION_INSIGHTS_KEY string ]) param AZURESERVICEBUSENABLED string -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Payment HTTP route') param paymentHttpName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - -@description('The connection string of the Azure Service Bus') +@description('The connection string for the event bus') @secure() -param serviceBusConnectionString string +param eventBusConnectionString string // CONTAINERS --------------------------------------------------------- // Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/payment-api -resource payment 'Applications.Core/containers@2023-10-01-preview' = { +resource payment 'Applications.Core/containers@2022-03-15-privatepreview' = { name: 'payment-api' properties: { application: application @@ -49,7 +46,7 @@ resource payment 'Applications.Core/containers@2023-10-01-preview' = { 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -63,12 +60,6 @@ resource payment 'Applications.Core/containers@2023-10-01-preview' = { // NETWORKING ------------------------------------------------------ -resource paymentHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { +resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { name: paymentHttpName } - -// PORTABLE RESOURCES ----------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/eshop/iac/services/seq.bicep b/samples/eshop/eshop/iac/services/seq.bicep new file mode 100644 index 00000000..b8074b9f --- /dev/null +++ b/samples/eshop/eshop/iac/services/seq.bicep @@ -0,0 +1,36 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('Name of the SEQ Http Route') +param seqHttpName string + +// CONTAINERS ------------------------------------------------------------ + +resource seq 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'seq' + properties: { + application: application + container: { + image: 'datalust/seq:latest' + env: { + ACCEPT_EULA: 'Y' + } + ports: { + web: { + containerPort: 80 + provides: seqHttp.id + } + } + } + } +} + +// NETWORKING --------------------------------------------------------------- + +resource seqHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: seqHttpName +} diff --git a/samples/eshop/eshop/iac/services/web.bicep b/samples/eshop/eshop/iac/services/web.bicep new file mode 100644 index 00000000..6d466b62 --- /dev/null +++ b/samples/eshop/eshop/iac/services/web.bicep @@ -0,0 +1,190 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Optional App Insights Key') +param APPLICATION_INSIGHTS_KEY string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('Ordering SignalR Hub Http Route name') +param orderingsignalrhubHttpName string + +@description('Identity Http Route name') +param identityHttpName string + +@description('Web MVC Http Route name') +param webmvcHttpName string + +@description('Web SPA Http Route name') +param webspaHttpName string + +@description('Web Shopping Aggregator Http Route name') +param webshoppingaggHttpName string + +@description('Web shopping API GW HTTP Route name') +param webshoppingapigwHttpName string + +@description('Name of the Keystore Redis Link name') +param redisKeystoreName string + +// CONTAINER -------------------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webspa +resource webspa 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'web-spa' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webspa:${TAG}' + env: { + PATH_BASE: '/' + ASPNETCORE_ENVIRONMENT: 'Production' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + UseCustomizationData: 'False' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + OrchestratorType: ORCHESTRATOR_TYPE + IsClusterEnv: 'True' + CallBackUrl: '${gateway.properties.url}/' + DPConnectionString: redisKeystore.connectionString() + IdentityUrl: '${gateway.properties.url}/identity-api' + IdentityUrlHC: '${identityHttp.properties.url}/hc' + PurchaseUrl: '${gateway.properties.url}/webshoppingapigw' + SignalrHubUrl: orderingsignalrhubHttp.properties.url + } + ports: { + http: { + containerPort: 80 + provides: webspaHttp.id + } + } + } + connections: { + redis: { + source: redisKeystore.id + disableDefaultEnvVars: true + } + webshoppingagg: { + source: webshoppingaggHttp.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + webshoppingapigw: { + source: webshoppingapigwHttp.id + disableDefaultEnvVars: true + } + orderingsignalrhub: { + source: orderingsignalrhubHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webmvc +resource webmvc 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webmvc' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webmvc:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + PATH_BASE: '/webmvc' + UseCustomizationData: 'False' + DPConnectionString: redisKeystore.connectionString() + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + UseLoadTest: 'False' + OrchestratorType: ORCHESTRATOR_TYPE + IsClusterEnv: 'True' + ExternalPurchaseUrl: '${gateway.properties.url}/${webshoppingapigwHttp.properties.hostname}' + CallBackUrl: '${gateway.properties.url}/webmvc' + IdentityUrl: '${gateway.properties.url}/identity-api' + IdentityUrlHC: '${identityHttp.properties.url}/hc' + PurchaseUrl: webshoppingapigwHttp.properties.url + SignalrHubUrl: orderingsignalrhubHttp.properties.url + } + ports: { + http: { + containerPort: 80 + provides: webmvcHttp.id + } + } + } + connections: { + redis: { + source: redisKeystore.id + disableDefaultEnvVars: true + } + webshoppingagg: { + source: webshoppingaggHttp.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + webshoppingapigw: { + source: webshoppingapigwHttp.id + disableDefaultEnvVars: true + } + orderingsignalrhub: { + source: orderingsignalrhubHttp.id + disableDefaultEnvVars: true + } + } + } +} + +// NETWORKING ---------------------------------------------- + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingsignalrhubHttpName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webmvcHttpName +} + +resource webspaHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webspaHttpName +} + +resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingaggHttpName +} + +resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingapigwHttpName +} + +// LINKS ------------------------------------------------------ + +resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { + name: redisKeystoreName +} diff --git a/samples/eshop/eshop/iac/services/webhooks.bicep b/samples/eshop/eshop/iac/services/webhooks.bicep new file mode 100644 index 00000000..bfe4d0b2 --- /dev/null +++ b/samples/eshop/eshop/iac/services/webhooks.bicep @@ -0,0 +1,141 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Use Azure Service Bus for messaging') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +@description('Container image tag to use for eshop images. Defaults to linux-dotnet7') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('Name of the Identity HTTP Route') +param identityHttpName string + +@description('Name of the Webhooks HTTP Route') +param webhooksHttpName string + +@description('Name of the WebhooksClient HTTP Route') +param webhooksclientHttpName string + +@description('The name of the Webhooks SQL Link') +param sqlWebhooksDbName string + +@description('The connection string for the event bus') +@secure() +param eventBusConnectionString string + +// CONTAINERS ----------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webhooks-api +resource webhooks 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webhooks-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webhooks.api:${TAG}' + env: { + PATH_BASE: '/webhooks-api' + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + OrchestratorType: ORCHESTRATOR_TYPE + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + ConnectionString: sqlWebhooksDb.connectionString() + EventBusConnection: eventBusConnectionString + identityUrl: identityHttp.properties.url + IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: webhooksHttp.id + } + } + } + connections: { + sql: { + source: sqlWebhooksDb.id + disableDefaultEnvVars: true + } + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + } + } +} + + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webhooks-web +resource webhooksclient 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webhooks-client' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webhooks.client:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Production' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + PATH_BASE: '/webhooks-web' + Token: 'WebHooks-Demo-Web' + CallBackUrl: '${gateway.properties.url}/${webhooksclientHttp.properties.hostname}' + SelfUrl: webhooksclientHttp.properties.url + WebhooksUrl: webhooksHttp.properties.url + IdentityUrl: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: webhooksclientHttp.id + } + } + } + connections: { + webhooks: { + source: webhooksHttp.id + } + identity: { + source: identityHttp.id + } + } + } +} + +// NETWORKING ---------------------------------------------- + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource webhooksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webhooksHttpName +} + +resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webhooksclientHttpName +} + +// LINKS ----------------------------------------------------------- + +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { + name: sqlWebhooksDbName +} diff --git a/samples/eshop/eshop/iac/services/webshopping.bicep b/samples/eshop/eshop/iac/services/webshopping.bicep new file mode 100644 index 00000000..93afb086 --- /dev/null +++ b/samples/eshop/eshop/iac/services/webshopping.bicep @@ -0,0 +1,178 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('Basket Http Route name') +param basketHttpName string + +@description('Basket gRPC Route name') +param basketGrpcName string + +@description('Ordering Http Route name') +param orderingHttpName string + +@description('Ordering gRPC Route name') +param orderingGrpcName string + +@description('Identity Http Route name') +param identityHttpName string + +@description('Catalog Http Route name') +param catalogHttpName string + +@description('Catalog gRPC Route name') +param catalogGrpcName string + +@description('Payment Http Route name') +param paymentHttpName string + +@description('Web shopping API GW HTTP Route name') +param webshoppingapigwHttpName string + +@description('Web shopping API GW HTTP Route 2 name') +param webshoppingapigwHttp2Name string + +@description('Web Shopping Aggregator Http Route name') +param webshoppingaggHttpName string + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webshoppingagg +resource webshoppingagg 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webshoppingagg' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webshoppingagg:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + PATH_BASE: '/webshoppingagg' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + OrchestratorType: ORCHESTRATOR_TYPE + IsClusterEnv: 'True' + urls__basket: basketHttp.properties.url + urls__catalog: catalogHttp.properties.url + urls__orders: orderingHttp.properties.url + urls__identity: identityHttp.properties.url + urls__grpcBasket: basketGrpc.properties.url + urls__grpcCatalog: catalogGrpc.properties.url + urls__grpcOrdering: orderingGrpc.properties.url + CatalogUrlHC: '${catalogHttp.properties.url}/hc' + OrderingUrlHC: '${orderingHttp.properties.url}/hc' + IdentityUrlHC: '${identityHttp.properties.url}/hc' + BasketUrlHC: '${basketHttp.properties.url}/hc' + PaymentUrlHC: '${paymentHttp.properties.url}/hc' + IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' + } + ports: { + http: { + containerPort: 80 + provides: webshoppingaggHttp.id + } + } + } + connections: { + identity: { + source: identityHttp.id + disableDefaultEnvVars: true + } + ordering: { + source: orderingHttp.id + disableDefaultEnvVars: true + } + catalog: { + source: catalogHttp.id + disableDefaultEnvVars: true + } + basket: { + source: basketHttp.id + disableDefaultEnvVars: true + } + } + } +} + + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/apigwws +resource webshoppingapigw 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webshoppingapigw' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop-envoy:0.1.4' + ports: { + http: { + containerPort: 80 + provides: webshoppingapigwHttp.id + } + http2: { + containerPort: 8001 + provides: webshoppingapigwHttp2.id + } + } + } + } +} + +// NETWORKING ---------------------------------------------- + +resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { + name: gatewayName +} + +resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketGrpcName +} + +resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: catalogGrpcName +} + +resource orderingGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingGrpcName +} + +resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: catalogHttpName +} + +resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketHttpName +} + +resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingHttpName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: paymentHttpName +} + +resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingaggHttpName +} + +resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingapigwHttpName +} + +resource webshoppingapigwHttp2 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingapigwHttp2Name +} diff --git a/samples/eshop/eshop/iac/services/webstatus.bicep b/samples/eshop/eshop/iac/services/webstatus.bicep new file mode 100644 index 00000000..e1e9cf9e --- /dev/null +++ b/samples/eshop/eshop/iac/services/webstatus.bicep @@ -0,0 +1,142 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('What container orchestrator to use') +@allowed([ + 'K8S' +]) +param ORCHESTRATOR_TYPE string + +@description('Optional App Insights Key') +param APPLICATION_INSIGHTS_KEY string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Basket Http Route name') +param basketHttpName string + +@description('Ordering Http Route name') +param orderingHttpName string + +@description('Ordering SignalR Hub Http Route name') +param orderingsignalrhubHttpName string + +@description('Ordering Background Tasks Http Route name') +param orderbgtasksHttpName string + +@description('Identity Http Route name') +param identityHttpName string + +@description('Catalog Http Route name') +param catalogHttpName string + +@description('Payment Http Route name') +param paymentHttpName string + +@description('Web MVC Http Route name') +param webmvcHttpName string + +@description('Web SPA Http Route name') +param webspaHttpName string + +@description('Web Shopping Aggregator Http Route name') +param webshoppingaggHttpName string + +@description('Web Status Http Route name') +param webstatusHttpName string + +// CONTAINAERS --------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webstatus +resource webstatus 'Applications.Core/containers@2022-03-15-privatepreview' = { + name: 'webstatus' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/webstatus:${TAG}' + env: { + ASPNETCORE_ENVIRONMENT: 'Development' + ASPNETCORE_URLS: 'http://0.0.0.0:80' + HealthChecksUI__HealthChecks__0__Name: 'WebMVC HTTP Check' + HealthChecksUI__HealthChecks__0__Uri: '${webmvcHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__1__Name: 'WebSPA HTTP Check' + HealthChecksUI__HealthChecks__1__Uri: '${webspaHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__2__Name: 'Web Shopping Aggregator GW HTTP Check' + HealthChecksUI__HealthChecks__2__Uri: '${webshoppingaggHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__4__Name: 'Ordering HTTP Check' + HealthChecksUI__HealthChecks__4__Uri: '${orderingHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__5__Name: 'Basket HTTP Check' + HealthChecksUI__HealthChecks__5__Uri: '${basketHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__6__Name: 'Catalog HTTP Check' + HealthChecksUI__HealthChecks__6__Uri: '${catalogHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__7__Name: 'Identity HTTP Check' + HealthChecksUI__HealthChecks__7__Uri: '${identityHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__8__Name: 'Payments HTTP Check' + HealthChecksUI__HealthChecks__8__Uri: '${paymentHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__9__Name: 'Ordering SignalRHub HTTP Check' + HealthChecksUI__HealthChecks__9__Uri: '${orderingsignalrhubHttp.properties.url}/hc' + HealthChecksUI__HealthChecks__10__Name: 'Ordering HTTP Background Check' + HealthChecksUI__HealthChecks__10__Uri: '${orderbgtasksHttp.properties.url}/hc' + ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + OrchestratorType: ORCHESTRATOR_TYPE + } + ports: { + http: { + containerPort: 80 + provides: webstatusHttp.id + } + } + } + } +} + +// NETWORKING ---------------------------------------------- + +resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: catalogHttpName +} + +resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: basketHttpName +} + +resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingHttpName +} + +resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderingsignalrhubHttpName +} + +resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: orderbgtasksHttpName +} + +resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: identityHttpName +} + +resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: paymentHttpName +} + +resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webmvcHttpName +} + +resource webspaHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webspaHttpName +} + +resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webshoppingaggHttpName +} + +resource webstatusHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { + name: webstatusHttpName +} diff --git a/samples/eshop/iac/infra/aws.bicep b/samples/eshop/iac/infra/aws.bicep deleted file mode 100644 index 23180522..00000000 --- a/samples/eshop/iac/infra/aws.bicep +++ /dev/null @@ -1,379 +0,0 @@ -import radius as radius -import aws as aws - -@description('Radius environment ID') -param environment string - -@description('Radius application ID') -param application string - -@description('Radius application name') -param applicationName string - -@description('SQL administrator username') -param adminLogin string - -@description('SQL administrator password') -@secure() -param adminPassword string - -@description('Name of the EKS cluster where the application will be run. Used to setup subnet groups') -param eksClusterName string - -// Infrastructure ------------------------------------------------------------ - -resource eksCluster 'AWS.EKS/Cluster@default' existing = { - alias: eksClusterName - properties: { - Name: eksClusterName - } -} - -var sqlSubnetGroupName = 'eshopsqlsg${uniqueString(application)}' -resource sqlSubnetGroup 'AWS.RDS/DBSubnetGroup@default' = { - alias: sqlSubnetGroupName - properties: { - DBSubnetGroupName: sqlSubnetGroupName - DBSubnetGroupDescription: sqlSubnetGroupName - SubnetIds: eksCluster.properties.ResourcesVpcConfig.SubnetIds - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var identityDbIdentifier = 'eshopidentitysql${uniqueString(application)}' -resource identityDb 'AWS.RDS/DBInstance@default' = { - alias: identityDbIdentifier - properties: { - DBInstanceIdentifier: identityDbIdentifier - Engine: 'sqlserver-ex' - EngineVersion: '15.00.4153.1.v1' - DBInstanceClass: 'db.t3.large' - AllocatedStorage: '20' - MaxAllocatedStorage: 30 - MasterUsername: adminLogin - MasterUserPassword: adminPassword - Port: '1433' - DBSubnetGroupName: sqlSubnetGroup.properties.DBSubnetGroupName - VPCSecurityGroups: [eksCluster.properties.ClusterSecurityGroupId] - PreferredMaintenanceWindow: 'Mon:00:00-Mon:03:00' - PreferredBackupWindow: '03:00-06:00' - LicenseModel: 'license-included' - Timezone: 'GMT Standard Time' - CharacterSetName: 'Latin1_General_CI_AS' - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var catalogDbIdentifier = 'eshopcatalogsql${uniqueString(application)}' -resource catalogDb 'AWS.RDS/DBInstance@default' = { - alias: catalogDbIdentifier - properties: { - DBInstanceIdentifier: catalogDbIdentifier - Engine: 'sqlserver-ex' - EngineVersion: '15.00.4153.1.v1' - DBInstanceClass: 'db.t3.large' - AllocatedStorage: '20' - MaxAllocatedStorage: 30 - MasterUsername: adminLogin - MasterUserPassword: adminPassword - Port: '1433' - DBSubnetGroupName: sqlSubnetGroup.properties.DBSubnetGroupName - VPCSecurityGroups: [eksCluster.properties.ClusterSecurityGroupId] - PreferredMaintenanceWindow: 'Mon:00:00-Mon:03:00' - PreferredBackupWindow: '03:00-06:00' - LicenseModel: 'license-included' - Timezone: 'GMT Standard Time' - CharacterSetName: 'Latin1_General_CI_AS' - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var orderingDbIdentifier = 'eshoporderingsql${uniqueString(application)}' -resource orderingDb 'AWS.RDS/DBInstance@default' = { - alias: orderingDbIdentifier - properties: { - DBInstanceIdentifier: orderingDbIdentifier - Engine: 'sqlserver-ex' - EngineVersion: '15.00.4153.1.v1' - DBInstanceClass: 'db.t3.large' - AllocatedStorage: '20' - MaxAllocatedStorage: 30 - MasterUsername: adminLogin - MasterUserPassword: adminPassword - Port: '1433' - DBSubnetGroupName: sqlSubnetGroup.properties.DBSubnetGroupName - VPCSecurityGroups: [eksCluster.properties.ClusterSecurityGroupId] - PreferredMaintenanceWindow: 'Mon:00:00-Mon:03:00' - PreferredBackupWindow: '03:00-06:00' - LicenseModel: 'license-included' - Timezone: 'GMT Standard Time' - CharacterSetName: 'Latin1_General_CI_AS' - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var webhooksDbIdentifier = 'eshopwebhookssql${uniqueString(application)}' -resource webhooksDb 'AWS.RDS/DBInstance@default' = { - alias: webhooksDbIdentifier - properties: { - DBInstanceIdentifier: webhooksDbIdentifier - Engine: 'sqlserver-ex' - EngineVersion: '15.00.4153.1.v1' - DBInstanceClass: 'db.t3.large' - AllocatedStorage: '20' - MaxAllocatedStorage: 30 - MasterUsername: adminLogin - MasterUserPassword: adminPassword - Port: '1433' - DBSubnetGroupName: sqlSubnetGroup.properties.DBSubnetGroupName - VPCSecurityGroups: [eksCluster.properties.ClusterSecurityGroupId] - PreferredMaintenanceWindow: 'Mon:00:00-Mon:03:00' - PreferredBackupWindow: '03:00-06:00' - LicenseModel: 'license-included' - Timezone: 'GMT Standard Time' - CharacterSetName: 'Latin1_General_CI_AS' - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var redisSubnetGroupName = 'eshopredissg${uniqueString(application)}' -resource redisSubnetGroup 'AWS.MemoryDB/SubnetGroup@default' = { - alias: redisSubnetGroupName - properties: { - SubnetGroupName: redisSubnetGroupName - SubnetIds: eksCluster.properties.ResourcesVpcConfig.SubnetIds - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var keystoreCacheName = 'eshopkeystore${uniqueString(application)}' -resource keystoreCache 'AWS.MemoryDB/Cluster@default' = { - alias: keystoreCacheName - properties: { - ClusterName: keystoreCacheName - NodeType: 'db.t4g.small' - ACLName: 'open-access' - SecurityGroupIds: [eksCluster.properties.ClusterSecurityGroupId] - SubnetGroupName: redisSubnetGroup.properties.SubnetGroupName - NumReplicasPerShard: 0 - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -var basketCacheName = 'eshopbasket${uniqueString(application)}' -resource basketCache 'AWS.MemoryDB/Cluster@default' = { - alias: basketCacheName - properties: { - ClusterName: basketCacheName - NodeType: 'db.t4g.small' - ACLName: 'open-access' - SecurityGroupIds: [eksCluster.properties.ClusterSecurityGroupId] - SubnetGroupName: redisSubnetGroup.name - NumReplicasPerShard: 0 - Tags: [ - { - Key: 'RadiusApplication' - Value: applicationName - } - ] - } -} - -// TEMP: Using containerized rabbitMQ instead of AWS SNS until AWS nonidempotency is resolved -resource rabbitmqContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'rabbitmq-container-eshop-event-bus' - properties: { - application: application - container: { - image: 'rabbitmq:3.9' - env: {} - ports: { - rabbitmq: { - containerPort: 5672 - provides: rabbitmqRoute.id - } - } - } - } -} - -resource rabbitmqRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'rabbitmq-route-eshop-event-bus' - properties: { - application: application - port: 5672 - } -} - -// Portable Resources ---------------------------------------------------------------------------- -// TODO: Move the portable resource definitions into the application and use Recipes instead - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'identitydb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: 'IdentityDb' - server: identityDb.properties.Endpoint.Address - port: int(identityDb.properties.Endpoint.Port) - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${identityDb.properties.Endpoint.Address},${identityDb.properties.Endpoint.Port};Initial Catalog=IdentityDb;User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'catalogdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: 'CatalogDb' - server: catalogDb.properties.Endpoint.Address - port: int(catalogDb.properties.Endpoint.Port) - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${catalogDb.properties.Endpoint.Address},${catalogDb.properties.Endpoint.Port};Initial Catalog=CatalogDb;User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'orderingdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: 'OrderingDb' - server: orderingDb.properties.Endpoint.Address - port: int(orderingDb.properties.Endpoint.Port) - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${orderingDb.properties.Endpoint.Address},${orderingDb.properties.Endpoint.Port};Initial Catalog=OrderingDb;User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'webhooksdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: 'WebhooksDb' - server: webhooksDb.properties.Endpoint.Address - port: int(webhooksDb.properties.Endpoint.Port) - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${webhooksDb.properties.Endpoint.Address},${webhooksDb.properties.Endpoint.Port};Initial Catalog=WebhooksDb;User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - } -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'keystore-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: keystoreCache.properties.ClusterEndpoint.Address - port: keystoreCache.properties.ClusterEndpoint.Port - secrets: { - connectionString: '${keystoreCache.properties.ClusterEndpoint.Address}:${keystoreCache.properties.ClusterEndpoint.Port},ssl=true' - } - } -} - -resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'basket-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: basketCache.properties.ClusterEndpoint.Address - port: basketCache.properties.ClusterEndpoint.Port - secrets: { - connectionString: '${basketCache.properties.ClusterEndpoint.Address}:${basketCache.properties.ClusterEndpoint.Port},ssl=true' - } - } -} - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' = { - name: 'eshop-event-bus' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - queue: 'eshop-event-bus' - host: rabbitmqRoute.properties.hostname - port: rabbitmqRoute.properties.port - username: 'guest' - secrets: { - password: 'guest' - } - } -} - -// Outputs ------------------------------------ - -@description('The name of the SQL Identity portable resource') -output sqlIdentityDb string = sqlIdentityDb.name - -@description('The name of the SQL Catalog portable resource') -output sqlCatalogDb string = sqlCatalogDb.name - -@description('The name of the SQL Ordering portable resource') -output sqlOrderingDb string = sqlOrderingDb.name - -@description('The name of the SQL Webhooks portable resource') -output sqlWebhooksDb string = sqlWebhooksDb.name - -@description('The name of the Redis Keystore portable resource') -output redisKeystore string = redisKeystore.name - -@description('The name of the Redis Basket portable resource') -output redisBasket string = redisBasket.name - -@description('The name of the RabbitMQ portable resource') -output rabbitmq string = rabbitmq.name diff --git a/samples/eshop/iac/infra/azure.bicep b/samples/eshop/iac/infra/azure.bicep deleted file mode 100644 index e2817a0b..00000000 --- a/samples/eshop/iac/infra/azure.bicep +++ /dev/null @@ -1,400 +0,0 @@ -import radius as rad -import az as az - -@description('Azure region to deploy resources into') -param location string = resourceGroup().location - -@description('Radius environment ID') -param environment string - -@description('Radius application ID') -param application string - -@description('SQL administrator username') -param adminLogin string - -@description('SQL administrator password') -@secure() -param adminPassword string - -var sqlPort = 1433 - -// Infrastructure ------------------------------------------------------------ -// TODO: Move the infrastructure into Recipes - -resource servicebus 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = { - name: 'eshop${uniqueString(resourceGroup().id)}' - location: location - sku: { - name: 'Standard' - tier: 'Standard' - } - - resource topic 'topics' = { - name: 'eshop_event_bus' - properties: { - defaultMessageTimeToLive: 'P14D' - maxSizeInMegabytes: 1024 - requiresDuplicateDetection: false - enableBatchedOperations: true - supportOrdering: false - enablePartitioning: true - enableExpress: false - } - - resource rootRule 'authorizationRules' = { - name: 'Root' - properties: { - rights: [ - 'Manage' - 'Send' - 'Listen' - ] - } - } - - resource basket 'subscriptions' = { - name: 'Basket' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource catalog 'subscriptions' = { - name: 'Catalog' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource ordering 'subscriptions' = { - name: 'Ordering' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource graceperiod 'subscriptions' = { - name: 'GracePeriod' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource payment 'subscriptions' = { - name: 'Payment' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource backgroundTasks 'subscriptions' = { - name: 'backgroundtasks' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource OrderingSignalrHub 'subscriptions' = { - name: 'Ordering.signalrhub' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - resource webhooks 'subscriptions' = { - name: 'Webhooks' - properties: { - requiresSession: false - defaultMessageTimeToLive: 'P14D' - deadLetteringOnMessageExpiration: true - deadLetteringOnFilterEvaluationExceptions: true - maxDeliveryCount: 10 - enableBatchedOperations: true - } - } - - } - -} - -resource sql 'Microsoft.Sql/servers@2021-02-01-preview' = { - name: 'eshopsql${uniqueString(resourceGroup().id)}' - location: location - properties: { - administratorLogin: adminLogin - administratorLoginPassword: adminPassword - } - - resource allowEverything 'firewallRules' = { - name: 'allow-everrything' - properties: { - startIpAddress: '0.0.0.0' - endIpAddress: '255.255.255.255' - } - } - - resource identityDb 'databases' = { - name: 'IdentityDb' - location: location - sku: { - name: 'Standard' - tier: 'Standard' - } - } - - resource catalogDb 'databases' = { - name: 'CatalogDb' - location: location - sku: { - name: 'Standard' - tier: 'Standard' - } - } - - resource orderingDb 'databases' = { - name: 'OrderingDb' - location: location - sku: { - name: 'Standard' - tier: 'Standard' - } - } - - resource webhooksDb 'databases' = { - name: 'WebhooksDb' - location: location - sku: { - name: 'Standard' - tier: 'Standard' - } - } - -} - -resource keystoreCache 'Microsoft.Cache/redis@2020-12-01' = { - name: 'eshopkeystore${uniqueString(resourceGroup().id)}' - location: location - properties: { - enableNonSslPort: false - minimumTlsVersion: '1.2' - sku: { - family: 'C' - capacity: 1 - name: 'Basic' - } - } -} - -resource basketCache 'Microsoft.Cache/redis@2020-12-01' = { - name: 'eshopbasket${uniqueString(resourceGroup().id)}' - location: location - properties: { - enableNonSslPort: false - minimumTlsVersion: '1.2' - sku: { - family: 'C' - capacity: 1 - name: 'Basic' - } - } -} - -// Portable Resources ---------------------------------------------------------------------------- -// TODO: Move the portable resource definitions into the application and use Recipes instead - -// Need to deploy a blank rabbitmq instance to let Bicep successfully deploy -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' = { - name: 'eshop-event-bus' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - queue: 'eshop-event-bus' - host: 'test' - port: 5672 - secrets: { - uri: 'test' - } - } -} - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'identitydb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: sql::identityDb.name - server: sql.properties.fullyQualifiedDomainName - port: sqlPort - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sql.properties.fullyQualifiedDomainName},${sqlPort};Initial Catalog=${sql::identityDb.name};User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - resources: [ - { - id: sql::identityDb.id - } - ] - } -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'catalogdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: sql::catalogDb.name - server: sql.properties.fullyQualifiedDomainName - port: sqlPort - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sql.properties.fullyQualifiedDomainName},${sqlPort};Initial Catalog=${sql::catalogDb.name};User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - resources: [ - { - id: sql::catalogDb.id - } - ] - } -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'orderingdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: sql::orderingDb.name - server: sql.properties.fullyQualifiedDomainName - port: sqlPort - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sql.properties.fullyQualifiedDomainName},${sqlPort};Initial Catalog=${sql::orderingDb.name};User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - resources: [ - { - id: sql::orderingDb.id - } - ] - } -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'webhooksdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - database: sql::webhooksDb.name - server: sql.properties.fullyQualifiedDomainName - port: sqlPort - username: adminLogin - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sql.properties.fullyQualifiedDomainName},${sqlPort};Initial Catalog=${sql::webhooksDb.name};User Id=${adminLogin};Password=${adminPassword};Encrypt=false' - } - resources: [ - { - id: sql::webhooksDb.id - } - ] - } -} - -resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'basket-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: basketCache.properties.hostName - port: basketCache.properties.sslPort - secrets: { - password: basketCache.listKeys().primaryKey - connectionString: '${basketCache.properties.hostName}:${basketCache.properties.sslPort},password=${basketCache.listKeys().primaryKey},ssl=True,abortConnect=False' - } - } -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'keystore-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: keystoreCache.properties.hostName - port: keystoreCache.properties.sslPort - secrets: { - password: keystoreCache.listKeys().primaryKey - connectionString: '${keystoreCache.properties.hostName}:${keystoreCache.properties.sslPort},password=${keystoreCache.listKeys().primaryKey},ssl=True,abortConnect=False' - } - } -} - -// Outputs ------------------------------------ - -@description('The ID of the auth rule') -#disable-next-line outputs-should-not-contain-secrets -output serviceBusAuthConnectionString string = servicebus::topic::rootRule.listKeys().primaryConnectionString - -@description('The name of the RabbitMQ Queue') -output rabbitMqQueue string = rabbitmq.name - -@description('The name of the SQL Identity portable resource') -output sqlIdentityDb string = sqlIdentityDb.name - -@description('The name of the SQL Catalog portable resource') -output sqlCatalogDb string = sqlCatalogDb.name - -@description('The name of the SQL Ordering portable resource') -output sqlOrderingDb string = sqlOrderingDb.name - -@description('The name of the SQL Webhooks portable resource') -output sqlWebhooksDb string = sqlWebhooksDb.name - -@description('The name of the Redis Keystore portable resource') -output redisKeystore string = redisKeystore.name - -@description('The name of the Redis Basket portable resource') -output redisBasket string = redisBasket.name diff --git a/samples/eshop/iac/infra/containers.bicep b/samples/eshop/iac/infra/containers.bicep deleted file mode 100644 index 75d975c6..00000000 --- a/samples/eshop/iac/infra/containers.bicep +++ /dev/null @@ -1,343 +0,0 @@ -import radius as rad - -@description('Radius environment ID') -param environment string - -@description('Radius application ID') -param application string - -@description('SQL administrator password') -@secure() -param adminPassword string - -var adminUsername = 'sa' - -// Infrastructure ------------------------------------------------- - -resource rabbitmqContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'rabbitmq-container-eshop-event-bus' - properties: { - application: application - container: { - image: 'rabbitmq:3.9' - env: {} - ports: { - rabbitmq: { - containerPort: 5672 - provides: rabbitmqRoute.id - } - } - } - } -} - -resource rabbitmqRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'rabbitmq-route-eshop-event-bus' - properties: { - application: application - port: 5672 - } -} - -resource sqlIdentityContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'sql-server-identitydb' - properties: { - application: application - container: { - image: 'mcr.microsoft.com/mssql/server:2019-latest' - env: { - ACCEPT_EULA: 'Y' - MSSQL_PID: 'Developer' - MSSQL_SA_PASSWORD: adminPassword - } - ports: { - sql: { - containerPort: 1433 - provides: sqlIdentityRoute.id - } - } - } - } -} - -resource sqlIdentityRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'sql-route-identitydb' - properties: { - application: application - port: 1433 - } -} - -resource sqlCatalogContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'sql-server-catalogdb' - properties: { - application: application - container: { - image: 'mcr.microsoft.com/mssql/server:2019-latest' - env: { - ACCEPT_EULA: 'Y' - MSSQL_PID: 'Developer' - MSSQL_SA_PASSWORD: adminPassword - } - ports: { - sql: { - containerPort: 1433 - provides: sqlCatalogRoute.id - } - } - } - } -} - -resource sqlCatalogRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'sql-route-catalogdb' - properties: { - application: application - port: 1433 - } -} - -resource sqlOrderingContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'sql-server-orderingdb' - properties: { - application: application - container: { - image: 'mcr.microsoft.com/mssql/server:2019-latest' - env: { - ACCEPT_EULA: 'Y' - MSSQL_PID: 'Developer' - MSSQL_SA_PASSWORD: adminPassword - } - ports: { - sql: { - containerPort: 1433 - provides: sqlOrderingRoute.id - } - } - } - } -} - -resource sqlOrderingRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'sql-route-orderingdb' - properties: { - application: application - port: 1433 - } -} - -resource sqlWebhooksContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'sql-server-webhooksdb' - properties: { - application: application - container: { - image: 'mcr.microsoft.com/mssql/server:2019-latest' - env: { - ACCEPT_EULA: 'Y' - MSSQL_PID: 'Developer' - MSSQL_SA_PASSWORD: adminPassword - } - ports: { - sql: { - containerPort: 1433 - provides: sqlWebhooksRoute.id - } - } - } - } -} - -resource sqlWebhooksRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'sql-route-webhooksdb' - properties: { - application: application - port: 1433 - } -} - -resource redisBasketContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'redis-container-basket-data' - properties: { - application: application - container: { - image: 'redis:6.2' - env: {} - ports: { - redis: { - containerPort: 6379 - provides: redisBasketRoute.id - } - } - } - } -} - -resource redisBasketRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'redis-route-basket-data' - properties: { - application: application - port: 6379 - } -} - -resource redisKeystoreContainer 'Applications.Core/containers@2023-10-01-preview' = { - name: 'redis-container-keystore-data' - properties: { - application: application - container: { - image: 'redis:6.2' - env: {} - ports: { - redis: { - containerPort: 6379 - provides: redisKeystoreRoute.id - } - } - } - } -} - -resource redisKeystoreRoute 'Applications.Core/httproutes@2023-10-01-preview' = { - name: 'redis-route-keystore-data' - properties: { - application: application - port: 6379 - } -} - -// Portable Resources --------------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' = { - name: 'eshop-event-bus' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - queue: 'eshop-event-bus' - host: rabbitmqRoute.properties.hostname - port: rabbitmqRoute.properties.port - username: 'guest' - secrets: { - password: 'guest' - } - } -} - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'identitydb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - server: sqlIdentityRoute.properties.hostname - database: 'IdentityDb' - port: sqlIdentityRoute.properties.port - username: adminUsername - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sqlIdentityRoute.properties.hostname},${sqlIdentityRoute.properties.port};Initial Catalog=IdentityDb;User Id=${adminUsername};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'catalogdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - server: sqlCatalogRoute.properties.hostname - database: 'CatalogDb' - port: sqlCatalogRoute.properties.port - username: adminUsername - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sqlCatalogRoute.properties.hostname},${sqlCatalogRoute.properties.port};Initial Catalog=CatalogDb;User Id=${adminUsername};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'orderingdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - server: sqlOrderingRoute.properties.hostname - database: 'OrderingDb' - port: sqlOrderingRoute.properties.port - username: adminUsername - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sqlOrderingRoute.properties.hostname},${sqlOrderingRoute.properties.port};Initial Catalog=OrderingDb;User Id=${adminUsername};Password=${adminPassword};Encrypt=false' - } - } -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { - name: 'webhooksdb' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - server: sqlWebhooksRoute.properties.hostname - database: 'WebhooksDb' - port: sqlWebhooksRoute.properties.port - username: adminUsername - secrets: { - password: adminPassword - connectionString: 'Server=tcp:${sqlWebhooksRoute.properties.hostname},${sqlWebhooksRoute.properties.port};Initial Catalog=WebhooksDb;User Id=${adminUsername};Password=${adminPassword};Encrypt=false' - } - } -} - -resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'basket-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: redisBasketRoute.properties.hostname - port: redisBasketRoute.properties.port - secrets: { - connectionString: '${redisBasketRoute.properties.hostname}:${redisBasketRoute.properties.port},abortConnect=False' - } - } -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' = { - name: 'keystore-data' - properties: { - application: application - environment: environment - resourceProvisioning: 'manual' - host: redisKeystoreRoute.properties.hostname - port: redisKeystoreRoute.properties.port - secrets: { - connectionString: '${redisKeystoreRoute.properties.hostname}:${redisKeystoreRoute.properties.port},abortConnect=False' - } - } -} - -// Outputs ------------------------------------ - -@description('The name of the SQL Identity portable resource') -output sqlIdentityDb string = sqlIdentityDb.name - -@description('The name of the SQL Catalog portable resource') -output sqlCatalogDb string = sqlCatalogDb.name - -@description('The name of the SQL Ordering portable resource') -output sqlOrderingDb string = sqlOrderingDb.name - -@description('The name of the SQL Webhooks portable resource') -output sqlWebhooksDb string = sqlWebhooksDb.name - -@description('The name of the Redis Keystore portable resource') -output redisKeystore string = redisKeystore.name - -@description('The name of the Redis Basket portable resource') -output redisBasket string = redisBasket.name - -@description('The name of the RabbitMQ portable resource') -output rabbitmq string = rabbitmq.name diff --git a/samples/eshop/iac/infra/links.bicep b/samples/eshop/iac/infra/links.bicep deleted file mode 100644 index a20c8bdd..00000000 --- a/samples/eshop/iac/infra/links.bicep +++ /dev/null @@ -1,52 +0,0 @@ -import radius as rad - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { - name: 'identitydb' -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { - name: 'catalogdb' -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { - name: 'orderingdb' -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { - name: 'webhooksdb' -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { - name: 'keystore-data' -} - -resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { - name: 'basket-data' -} - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: 'eshop-event-bus' -} - -// Outputs -------------------------------------------------------------------------- - -@description('The name of the SQL Database for Identity.') -output sqlIdentityDb string = sqlIdentityDb.name - -@description('The name of the SQL Database for Catalog.') -output sqlCatalogDb string = sqlCatalogDb.name - -@description('The name of the SQL Database for Ordering.') -output sqlOrderingDb string = sqlOrderingDb.name - -@description('The name of the SQL Database for Webhooks.') -output sqlWebhooksDb string = sqlWebhooksDb.name - -@description('The name of the Redis Cache for Keystore.') -output redisKeystore string = redisKeystore.name - -@description('The name of the Redis Cache for Basket.') -output redisBasket string = redisBasket.name - -@description('The name of the RabbitMQ Message Queue.') -output rabbitmq string = rabbitmq.name diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep new file mode 100644 index 00000000..8bd53a0e --- /dev/null +++ b/samples/eshop/infra/infra.bicep @@ -0,0 +1,165 @@ +import radius as rad + +@description('Radius environment ID') +param environment string + +@description('Radius application ID') +param application string + +@description('SQL administrator username') +@secure() +param adminLogin string + +@description('SQL administrator password') +@secure() +param adminPassword string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +// Links --------------------------------------------------------------- + +resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { + name: 'identitydb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'IdentityDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { + name: 'catalogdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'CatalogDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { + name: 'orderingdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'OrderingDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { + name: 'webhooksdb' + properties: { + application: application + environment: environment + recipe: { + name: 'sqldatabase' + parameters: { + database: 'WebhooksDb' + adminLogin: adminLogin + adminPassword: adminPassword + } + } + } +} + +resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' = { + name: 'keystore-data' + properties: { + application: application + environment: environment + recipe: { + name: 'rediscache' + } + } +} + +resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' = { + name: 'basket-data' + properties: { + application: application + environment: environment + recipe: { + name: 'rediscache' + } + } +} + +resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' = if (AZURESERVICEBUSENABLED == 'False') { + name: 'rabbitmq' + properties: { + application: application + environment: environment + recipe: { + name: 'rabbitmqmessagequeue' + } + } +} + +resource servicebus 'Applications.Core/extenders@2023-10-01-preview' = if (AZURESERVICEBUSENABLED == 'True') { + name: 'servicebus' + properties: { + application: application + environment: environment + recipe: { + name: 'servicebus' + parameters: { + topicName: 'eshop_event_bus' + subscriptions: ['Basket', 'Catalog', 'Ordering', 'GracePeriod', 'Payment', 'backgroundtasks', 'Ordering.signalrhub', 'Webhooks'] + } + } + } +} + +// Outputs ------------------------------------ + +@description('The name of the SQL Identity Link') +output sqlIdentityDb string = sqlIdentityDb.name + +@description('The name of the SQL Catalog Link') +output sqlCatalogDb string = sqlCatalogDb.name + +@description('The name of the SQL Ordering Link') +output sqlOrderingDb string = sqlOrderingDb.name + +@description('The name of the SQL Webhooks Link') +output sqlWebhooksDb string = sqlWebhooksDb.name + +@description('The name of the Redis Keystore Link') +output redisKeystore string = redisKeystore.name + +@description('The name of the Redis Basket Link') +output redisBasket string = redisBasket.name + +@description('The name of the RabbitMQ Link') +output rabbitmq string = rabbitmq.name + +@description('The name of the Service Bus Link') +output servicebus string = servicebus.name + +@description('Event Bus connection string') +output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.secrets('connectionString') : rabbitmq.properties.host diff --git a/samples/eshop/iac/services/networking.bicep b/samples/eshop/infra/networking.bicep similarity index 100% rename from samples/eshop/iac/services/networking.bicep rename to samples/eshop/infra/networking.bicep diff --git a/samples/eshop/iac/services/basket.bicep b/samples/eshop/services/basket.bicep similarity index 71% rename from samples/eshop/iac/services/basket.bicep rename to samples/eshop/services/basket.bicep index d4023022..fba757c8 100644 --- a/samples/eshop/iac/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -5,25 +5,9 @@ import radius as rad @description('Radius application ID') param application string -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use Azure Service Bus for messaging.') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - @description('The name of the Radius Gateway') param gatewayName string @@ -36,15 +20,19 @@ param basketHttpName string @description('The name of the Basket gRPC Route') param basketGrpcName string -@description('The name of the Redis Basket portable resource') +@description('The name of the Redis Basket Link') param redisBasketName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - -@description('The connection string of the Azure Service Bus') +@description('The connection string for the event bus') @secure() -param serviceBusConnectionString string +param eventBusConnectionString string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string // Container ------------------------------------- @@ -58,15 +46,14 @@ resource basket 'Applications.Core/containers@2023-10-01-preview' = { env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY UseLoadTest: 'False' PATH_BASE: '/basket-api' - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' PORT: '80' GRPC_PORT: '81' AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: redisBasket.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -112,12 +99,8 @@ resource basketGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing = name: basketGrpcName } -// Portable Resource ------------------------------------------ +// Links ------------------------------------------ resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisBasketName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep new file mode 100644 index 00000000..574cc464 --- /dev/null +++ b/samples/eshop/services/catalog.bicep @@ -0,0 +1,97 @@ +import radius as rad + +// Parameters --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Name of the Gateway') +param gatewayName string + +@description('The name of the Catalog HTTP Route') +param catalogHttpName string + +@description('The name of the Catalog gRPC Route') +param catalogGrpcName string + +@description('The name of the Catalog SQL Link') +param sqlCatalogDbName string + +@description('The connection string for the event bus') +@secure() +param eventBusConnectionString string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +// VARIABLES ----------------------------------------------------------------------------------- + +var PICBASEURL = '${gateway.properties.url}/webshoppingapigw/c/api/v1/catalog/items/[0]/pic' + +// CONTAINERS ------------------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/catalog-api +resource catalog 'Applications.Core/containers@2023-10-01-preview' = { + name: 'catalog-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/catalog.api:${TAG}' + env: { + UseCustomizationData: 'False' + PATH_BASE: '/catalog-api' + ASPNETCORE_ENVIRONMENT: 'Development' + ORCHESTRATOR_TYPE: 'K8S' + PORT: '80' + GRPC_PORT: '81' + PicBaseUrl: PICBASEURL + AzureStorageEnabled: 'False' + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + ConnectionString: sqlCatalogDb.connectionString() + EventBusConnection: eventBusConnectionString + } + ports: { + http: { + containerPort: 80 + provides: catalogHttp.id + } + grpc: { + containerPort: 81 + provides: catalogGrpc.id + } + } + } + connections: { + sql: { + source: sqlCatalogDb.id + } + } + } +} + +// NETWORKING ------------------------------------------------------ + +resource gateway 'Applications.Core/gateways@2023-10-01-preview' existing = { + name: gatewayName +} + +resource catalogHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { + name: catalogHttpName +} + +resource catalogGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { + name: catalogGrpcName +} + +// LINKS ----------------------------------------------------------- + +resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { + name: sqlCatalogDbName +} diff --git a/samples/eshop/iac/services/identity.bicep b/samples/eshop/services/identity.bicep similarity index 88% rename from samples/eshop/iac/services/identity.bicep rename to samples/eshop/services/identity.bicep index 4bcce43d..caa0b685 100644 --- a/samples/eshop/iac/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -5,17 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use dev spaces') -@allowed([ - 'True' - 'False' -]) -param ENABLEDEVSPACES string - -@description('Cotnainer image tag to use for eshop images. Defaults to linux-dotnet7') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -42,10 +32,10 @@ param webhooksclientHttpName string @description('Name of the WebMVC HTTP Route') param webmvcHttpName string -@description('Name of the Identity SQL Database portable resource') +@description('Name of the Identity SQL Database Link') param sqlIdentityDbName string -@description('Name of the Keystore Redis portable resource') +@description('Name of the Keystore Redis Link') param redisKeystoreName string // CONTAINERS ------------------------------------------------------------------- @@ -64,9 +54,9 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = { OrchestratorType: 'K8S' IsClusterEnv: 'True' DPConnectionString: redisKeystore.connectionString() - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY + ApplicationInsights__InstrumentationKey: '' XamarinCallback: '' - EnableDevspaces: ENABLEDEVSPACES + EnableDevspaces: 'False' ConnectionString: sqlIdentityDb.connectionString() MvcClient: '${gateway.properties.url}/${webmvcHttp.properties.hostname}' SpaClient: gateway.properties.url @@ -154,7 +144,7 @@ resource webmvcHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = name: webmvcHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlIdentityDbName diff --git a/samples/eshop/iac/services/ordering.bicep b/samples/eshop/services/ordering.bicep similarity index 78% rename from samples/eshop/iac/services/ordering.bicep rename to samples/eshop/services/ordering.bicep index fa5018c4..816a51b0 100644 --- a/samples/eshop/iac/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -5,23 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -48,18 +32,22 @@ param orderingsignalrhubHttpName string @description('Name of the Ordering background tasks HTTP Route') param orderbgtasksHttpName string -@description('Name of the Keystore Redis portable resource') +@description('Name of the Keystore Redis Link') param redisKeystoreName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - -@description('Name of the Ordering SQL portable resource') +@description('Name of the Ordering SQL Link') param sqlOrderingDbName string -@description('The connection string of the Azure Service Bus') +@description('The connection string for the event bus') @secure() -param serviceBusConnectionString string +param eventBusConnectionString string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string // CONTAINERS ------------------------------------------------------- @@ -76,8 +64,7 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = { UseCustomizationData: 'False' AzureServiceBusEnabled: AZURESERVICEBUSENABLED CheckUpdateTime: '30000' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' UseLoadTest: 'False' 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' 'Serilog__MinimumLevel__Override__ordering-api': 'Verbose' @@ -85,7 +72,7 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = { GRPC_PORT: '81' PORT: '80' ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -126,13 +113,12 @@ resource orderbgtasks 'Applications.Core/containers@2023-10-01-preview' = { UseCustomizationData: 'False' CheckUpdateTime: '30000' GracePeriodTime: '1' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY UseLoadTest: 'False' 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -161,12 +147,11 @@ resource orderingsignalrhub 'Applications.Core/containers@2023-10-01-preview' = PATH_BASE: '/payment-api' ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE + OrchestratorType: 'K8S' IsClusterEnv: 'True' AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host - SignalrStoreConnectionString: '${redisKeystore.properties.host}:${redisKeystore.properties.port},password=${redisKeystore.password()},abortConnect=False' + EventBusConnection: eventBusConnectionString + SignalrStoreConnectionString: redisKeystore.connectionString() identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -236,7 +221,7 @@ resource orderbgtasksHttp 'Applications.Core/httpRoutes@2023-10-01-preview' exis name: orderbgtasksHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisKeystoreName @@ -245,7 +230,3 @@ resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlOrderingDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/services/payment.bicep b/samples/eshop/services/payment.bicep new file mode 100644 index 00000000..1b59c143 --- /dev/null +++ b/samples/eshop/services/payment.bicep @@ -0,0 +1,55 @@ +import radius as rad + +// PARAMETERS --------------------------------------------------------- + +@description('Radius application ID') +param application string + +@description('Container image tag to use for eshop images') +param TAG string + +@description('Name of the Payment HTTP route') +param paymentHttpName string + +@description('The connection string for the event bus') +@secure() +param eventBusConnectionString string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + +// CONTAINERS --------------------------------------------------------- + +// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/payment-api +resource payment 'Applications.Core/containers@2023-10-01-preview' = { + name: 'payment-api' + properties: { + application: application + container: { + image: 'radius.azurecr.io/eshop/payment.api:${TAG}' + env: { + 'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': 'Verbose' + 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' + ORCHESTRATOR_TYPE: 'K8S' + AzureServiceBusEnabled: AZURESERVICEBUSENABLED + EventBusConnection: eventBusConnectionString + } + ports: { + http: { + containerPort: 80 + provides: paymentHttp.id + } + } + } + } +} + +// NETWORKING ------------------------------------------------------ + +resource paymentHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { + name: paymentHttpName +} diff --git a/samples/eshop/iac/services/seq.bicep b/samples/eshop/services/seq.bicep similarity index 100% rename from samples/eshop/iac/services/seq.bicep rename to samples/eshop/services/seq.bicep diff --git a/samples/eshop/iac/services/web.bicep b/samples/eshop/services/web.bicep similarity index 89% rename from samples/eshop/iac/services/web.bicep rename to samples/eshop/services/web.bicep index c075f186..fad524cc 100644 --- a/samples/eshop/iac/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -5,16 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -38,7 +29,7 @@ param webshoppingaggHttpName string @description('Web shopping API GW HTTP Route name') param webshoppingapigwHttpName string -@description('Name of the Keystore Redis portable resource') +@description('Name of the Keystore Redis Link name') param redisKeystoreName string // CONTAINER -------------------------------------------------------------------- @@ -55,8 +46,7 @@ resource webspa 'Applications.Core/containers@2023-10-01-preview' = { ASPNETCORE_ENVIRONMENT: 'Production' ASPNETCORE_URLS: 'http://0.0.0.0:80' UseCustomizationData: 'False' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' IsClusterEnv: 'True' CallBackUrl: '${gateway.properties.url}/' DPConnectionString: redisKeystore.connectionString() @@ -110,9 +100,8 @@ resource webmvc 'Applications.Core/containers@2023-10-01-preview' = { PATH_BASE: '/webmvc' UseCustomizationData: 'False' DPConnectionString: redisKeystore.connectionString() - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY UseLoadTest: 'False' - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' IsClusterEnv: 'True' ExternalPurchaseUrl: '${gateway.properties.url}/${webshoppingapigwHttp.properties.hostname}' CallBackUrl: '${gateway.properties.url}/webmvc' @@ -183,7 +172,7 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2023-10-01-preview' name: webshoppingapigwHttpName } -// PORTABLE RESOURCES ------------------------------------------------------ +// LINKS ------------------------------------------------------ resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisKeystoreName diff --git a/samples/eshop/iac/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep similarity index 80% rename from samples/eshop/iac/services/webhooks.bicep rename to samples/eshop/services/webhooks.bicep index 90993388..e0d6c157 100644 --- a/samples/eshop/iac/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -5,20 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Cotnainer image tag to use for eshop images. Defaults to linux-dotnet7') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -33,15 +20,19 @@ param webhooksHttpName string @description('Name of the WebhooksClient HTTP Route') param webhooksclientHttpName string -@description('The name of the Webhooks SQL portable resource') +@description('The name of the Webhooks SQL Link') param sqlWebhooksDbName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - -@description('The connection string of the Azure Service Bus') +@description('The connection string for the event bus') @secure() -param serviceBusConnectionString string +param eventBusConnectionString string + +@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string // CONTAINERS ----------------------------------------------------------- @@ -56,10 +47,10 @@ resource webhooks 'Applications.Core/containers@2023-10-01-preview' = { PATH_BASE: '/webhooks-api' ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlWebhooksDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString identityUrl: identityHttp.properties.url IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' } @@ -137,12 +128,8 @@ resource webhooksclientHttp 'Applications.Core/httpRoutes@2023-10-01-preview' ex name: webhooksclientHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlWebhooksDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/iac/services/webshopping.bicep b/samples/eshop/services/webshopping.bicep similarity index 89% rename from samples/eshop/iac/services/webshopping.bicep rename to samples/eshop/services/webshopping.bicep index 09bda8fd..51da63b6 100644 --- a/samples/eshop/iac/services/webshopping.bicep +++ b/samples/eshop/services/webshopping.bicep @@ -5,13 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Name of the Gateway') @@ -50,9 +44,6 @@ param webshoppingapigwHttp2Name string @description('Web Shopping Aggregator Http Route name') param webshoppingaggHttpName string -@description('The name of the RabbitMQ portable resource') -param rabbitmqName string - // Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webshoppingagg resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = { name: 'webshoppingagg' @@ -64,7 +55,7 @@ resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = { ASPNETCORE_ENVIRONMENT: 'Development' PATH_BASE: '/webshoppingagg' ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' IsClusterEnv: 'True' urls__basket: basketHttp.properties.url urls__catalog: catalogHttp.properties.url @@ -88,10 +79,6 @@ resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = { } } connections: { - rabbitmq: { - source: rabbitmq.id - disableDefaultEnvVars: true - } identity: { source: identityHttp.id disableDefaultEnvVars: true @@ -183,9 +170,3 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2023-10-01-preview' resource webshoppingapigwHttp2 'Applications.Core/httpRoutes@2023-10-01-preview' existing = { name: webshoppingapigwHttp2Name } - -// PORTABLE RESOURCES -------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' existing = { - name: rabbitmqName -} diff --git a/samples/eshop/iac/services/webstatus.bicep b/samples/eshop/services/webstatus.bicep similarity index 92% rename from samples/eshop/iac/services/webstatus.bicep rename to samples/eshop/services/webstatus.bicep index 45292539..71f63376 100644 --- a/samples/eshop/iac/services/webstatus.bicep +++ b/samples/eshop/services/webstatus.bicep @@ -5,16 +5,7 @@ import radius as rad @description('Radius application ID') param application string -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Cotnainer image tag to use for eshop images') +@description('Container image tag to use for eshop images') param TAG string @description('Basket Http Route name') @@ -82,8 +73,7 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = { HealthChecksUI__HealthChecks__9__Uri: '${orderingsignalrhubHttp.properties.url}/hc' HealthChecksUI__HealthChecks__10__Name: 'Ordering HTTP Background Check' HealthChecksUI__HealthChecks__10__Uri: '${orderbgtasksHttp.properties.url}/hc' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE + ORCHESTRATOR_TYPE: 'K8S' } ports: { http: { diff --git a/samples/eshop/src/README.md b/samples/eshop/src/README.md new file mode 100644 index 00000000..83dfb523 --- /dev/null +++ b/samples/eshop/src/README.md @@ -0,0 +1,3 @@ +# eShopOnContainers Source Code + +The eShopOnContainers source code is available [here](https://github.com/dotnet-architecture/eShopOnContainers). diff --git a/samples/eshop/src/envoy/Dockerfile b/samples/eshop/src/envoy/Dockerfile new file mode 100644 index 00000000..18194c1c --- /dev/null +++ b/samples/eshop/src/envoy/Dockerfile @@ -0,0 +1,3 @@ +FROM envoyproxy/envoy:v1.11.1 +COPY envoy.yaml /etc/envoy/envoy.yaml +CMD ["/usr/local/bin/envoy", "-c", "/etc/envoy/envoy.yaml"] diff --git a/samples/eshop/src/envoy/README.md b/samples/eshop/src/envoy/README.md new file mode 100644 index 00000000..d459ed4f --- /dev/null +++ b/samples/eshop/src/envoy/README.md @@ -0,0 +1,14 @@ +# Envoy for eshop + +Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. + +What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. + +The routing configuration is in [envoy.yaml](envoy.yaml). See the `route_config` section specifically. + +To build the docker image, run `docker build . -t radius.azurecr.io/eshop-envoy:0.1.`. + +Where NUMBER is one greater than the latest version made. To view versions, see https://ms.portal.azure.com/#view/Microsoft_Azure_ContainerRegistries/RepositoryBlade/id/%2Fsubscriptions%2F66d1209e-1382-45d3-99bb-650e6bf63fc0%2FresourceGroups%2Fassets%2Fproviders%2FMicrosoft.ContainerRegistry%2Fregistries%2Fradius/repository/eshop-envoy. + +To push the image, run `az acr login -n radius` and then `docker push radius.azurecr.io/eshop-envoy:0.1.`. + diff --git a/samples/eshop/src/envoy/envoy.yaml b/samples/eshop/src/envoy/envoy.yaml new file mode 100644 index 00000000..1eeec0b6 --- /dev/null +++ b/samples/eshop/src/envoy/envoy.yaml @@ -0,0 +1,143 @@ +admin: + access_log_path: "/dev/stdout" + address: + socket_address: + address: 0.0.0.0 + port_value: 8001 +static_resources: + listeners: + - address: + socket_address: + address: 0.0.0.0 + port_value: 80 + filter_chains: + - filters: + - name: envoy.http_connection_manager + config: + codec_type: auto + stat_prefix: ingress_http + route_config: + name: eshop_backend_route + virtual_hosts: + - name: eshop_backend + domains: + - "*" + routes: + - name: "c-short" + match: + prefix: "/webshoppingapigw/c/" + route: + auto_host_rewrite: true + prefix_rewrite: "/catalog-api/" + cluster: catalog + - name: "c-long" + match: + prefix: "/webshoppingapigw/catalog-api/" + route: + auto_host_rewrite: true + cluster: catalog + - name: "o-short" + match: + prefix: "/webshoppingapigw/o/" + route: + auto_host_rewrite: true + prefix_rewrite: "/ordering-api/" + cluster: ordering + - name: "o-long" + match: + prefix: "/webshoppingapigw/ordering-api/" + route: + auto_host_rewrite: true + cluster: ordering + - name: "h-long" + match: + prefix: "/webshoppingapigw/hub/notificationhub" + route: + auto_host_rewrite: true + cluster: signalr-hub + timeout: 300s + upgrade_configs: + upgrade_type: "websocket" + enabled: true + - name: "b-short" + match: + prefix: "/webshoppingapigw/b/" + route: + auto_host_rewrite: true + prefix_rewrite: "/basket-api/" + cluster: basket + - name: "b-long" + match: + prefix: "/webshoppingapigw/basket-api/" + route: + auto_host_rewrite: true + cluster: basket + - name: "agg" + match: + prefix: "/webshoppingapigw/" + route: + auto_host_rewrite: true + prefix_rewrite: "/" + cluster: shoppingagg + http_filters: + - name: envoy.router + access_log: + - name: envoy.file_access_log + filter: + not_health_check_filter: {} + config: + json_format: + time: "%START_TIME%" + protocol: "%PROTOCOL%" + duration: "%DURATION%" + request_method: "%REQ(:METHOD)%" + request_host: "%REQ(HOST)%" + path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" + response_flags: "%RESPONSE_FLAGS%" + route_name: "%ROUTE_NAME%" + upstream_host: "%UPSTREAM_HOST%" + upstream_cluster: "%UPSTREAM_CLUSTER%" + upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" + path: "/tmp/access.log" + clusters: + - name: shoppingagg + connect_timeout: 0.25s + type: strict_dns + lb_policy: round_robin + hosts: + - socket_address: + address: webshoppingagg-http + port_value: 5121 + - name: catalog + connect_timeout: 0.25s + type: strict_dns + lb_policy: round_robin + hosts: + - socket_address: + address: catalog-http + port_value: 5101 + - name: basket + connect_timeout: 0.25s + type: strict_dns + lb_policy: round_robin + hosts: + - socket_address: + address: basket-http + port_value: 5103 + - name: ordering + connect_timeout: 0.25s + type: strict_dns + lb_policy: round_robin + hosts: + - socket_address: + address: ordering-http + port_value: 5102 + - name: signalr-hub + connect_timeout: 0.25s + type: strict_dns + lb_policy: round_robin + hosts: + - socket_address: + address: orderingsignalrhub-http + port_value: 5112 + \ No newline at end of file From ce9af5642f02fb07ba9d29b80bea9a2d0cc2d81a Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 09:32:16 -0700 Subject: [PATCH 02/26] PR --- samples/eshop/README.md | 2 +- samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/containers.bicep | 2 +- samples/eshop/eshop/README.md | 39 --- samples/eshop/eshop/envoy/Dockerfile | 3 - samples/eshop/eshop/envoy/README.md | 14 - samples/eshop/eshop/envoy/envoy.yaml | 143 --------- .../eshop/eshop/iac/environments/aws.bicep | 53 ---- .../eshop/eshop/iac/environments/azure.bicep | 43 --- .../eshop/iac/environments/containers.bicep | 32 -- samples/eshop/eshop/iac/eshop.bicep | 255 ---------------- samples/eshop/eshop/iac/infra/infra.bicep | 165 ----------- .../eshop/eshop/iac/infra/networking.bicep | 275 ------------------ samples/eshop/eshop/iac/services/basket.bicep | 116 -------- .../eshop/eshop/iac/services/catalog.bicep | 114 -------- .../eshop/eshop/iac/services/identity.bicep | 165 ----------- .../eshop/eshop/iac/services/ordering.bicep | 244 ---------------- .../eshop/eshop/iac/services/payment.bicep | 65 ----- samples/eshop/eshop/iac/services/seq.bicep | 36 --- samples/eshop/eshop/iac/services/web.bicep | 190 ------------ .../eshop/eshop/iac/services/webhooks.bicep | 141 --------- .../eshop/iac/services/webshopping.bicep | 178 ------------ .../eshop/eshop/iac/services/webstatus.bicep | 142 --------- samples/eshop/infra/infra.bicep | 2 +- samples/eshop/services/basket.bicep | 2 +- samples/eshop/services/catalog.bicep | 2 +- samples/eshop/services/identity.bicep | 2 +- samples/eshop/services/ordering.bicep | 2 +- samples/eshop/services/web.bicep | 4 +- samples/eshop/services/webhooks.bicep | 2 +- samples/eshop/src/envoy/README.md | 2 +- 31 files changed, 12 insertions(+), 2425 deletions(-) delete mode 100644 samples/eshop/eshop/README.md delete mode 100644 samples/eshop/eshop/envoy/Dockerfile delete mode 100644 samples/eshop/eshop/envoy/README.md delete mode 100644 samples/eshop/eshop/envoy/envoy.yaml delete mode 100644 samples/eshop/eshop/iac/environments/aws.bicep delete mode 100644 samples/eshop/eshop/iac/environments/azure.bicep delete mode 100644 samples/eshop/eshop/iac/environments/containers.bicep delete mode 100644 samples/eshop/eshop/iac/eshop.bicep delete mode 100644 samples/eshop/eshop/iac/infra/infra.bicep delete mode 100644 samples/eshop/eshop/iac/infra/networking.bicep delete mode 100644 samples/eshop/eshop/iac/services/basket.bicep delete mode 100644 samples/eshop/eshop/iac/services/catalog.bicep delete mode 100644 samples/eshop/eshop/iac/services/identity.bicep delete mode 100644 samples/eshop/eshop/iac/services/ordering.bicep delete mode 100644 samples/eshop/eshop/iac/services/payment.bicep delete mode 100644 samples/eshop/eshop/iac/services/seq.bicep delete mode 100644 samples/eshop/eshop/iac/services/web.bicep delete mode 100644 samples/eshop/eshop/iac/services/webhooks.bicep delete mode 100644 samples/eshop/eshop/iac/services/webshopping.bicep delete mode 100644 samples/eshop/eshop/iac/services/webstatus.bicep diff --git a/samples/eshop/README.md b/samples/eshop/README.md index 2f8725f5..01a7b302 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -12,7 +12,7 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) 1. Clone the repository and switch to the app directory: ```bash - git clone https://github.com/project-radius/samples.git + git clone https://github.com/radius-project/samples.git cd samples/reference-apps/eshop ``` 1. Deploy the environment (choose which type of hosting infrastructure you wish to use): diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 5d2d2135..f89d7f8a 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -26,7 +26,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/sqlDatabases': { sqldatabase: { templateKind: 'bicep' - templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-29' + templatePath: 'radius.azurecr.io/recipes/aws/sqldatabases:edge' parameters: { eksClusterName: eksClusterName } diff --git a/samples/eshop/environments/containers.bicep b/samples/eshop/environments/containers.bicep index 8f842cf9..ae6bb238 100644 --- a/samples/eshop/environments/containers.bicep +++ b/samples/eshop/environments/containers.bicep @@ -12,7 +12,7 @@ resource containersEShopEnv 'Applications.Core/environments@2023-10-01-preview' 'Applications.Datastores/sqlDatabases': { sqldatabase: { templateKind: 'bicep' - templatePath: 'radiusdev.azurecr.io/recipes/local-dev/sqldatabases:pr-29' + templatePath: 'radius.azurecr.io/recipes/local-dev/sqldatabases:edge' } } 'Applications.Datastores/redisCaches': { diff --git a/samples/eshop/eshop/README.md b/samples/eshop/eshop/README.md deleted file mode 100644 index 5b06a7ff..00000000 --- a/samples/eshop/eshop/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# eShop on Radius reference application - -Visit the [Project Radius docs](https://radapp.dev/getting-started/reference-apps/eshop/) to learn more and try it out. - -## Source - -This reference app is a "radified" version of the [eShop on containers](https://github.com/dotnet-architecture/eShopOnContainers) .NET reference application. - -## Deploy - -1. Have a kubernetes cluster handy from the [supported clusters](https://docs.radapp.dev/operations/platforms/kubernetes/supported-clusters/). - - (AWS only) Make sure that each of the Subnets in your EKS cluster Subnet Group are within the list of [supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html) -1. [Install the rad CLI](https://radapp.dev/getting-started/) -1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) -1. Clone the repository and switch to the app directory: - ```bash - git clone https://github.com/project-radius/samples.git - cd samples/reference-apps/eshop - ``` -1. Deploy the app (choose which type of hosting infrastructure you wish to use): - - ### Containerized infrastructure - - ```bash - rad deploy iac/eshop.bicep - ``` - - ### Azure infrastructure - - ```bash - rad deploy iac/eshop.bicep -p platform=azure - ``` - - ### AWS infrastructure - - ```bash - rad deploy iac/eshop.bicep -p platform=aws -p eksClusterName= - ``` - diff --git a/samples/eshop/eshop/envoy/Dockerfile b/samples/eshop/eshop/envoy/Dockerfile deleted file mode 100644 index 18194c1c..00000000 --- a/samples/eshop/eshop/envoy/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM envoyproxy/envoy:v1.11.1 -COPY envoy.yaml /etc/envoy/envoy.yaml -CMD ["/usr/local/bin/envoy", "-c", "/etc/envoy/envoy.yaml"] diff --git a/samples/eshop/eshop/envoy/README.md b/samples/eshop/eshop/envoy/README.md deleted file mode 100644 index d459ed4f..00000000 --- a/samples/eshop/eshop/envoy/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Envoy for eshop - -Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. - -What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. - -The routing configuration is in [envoy.yaml](envoy.yaml). See the `route_config` section specifically. - -To build the docker image, run `docker build . -t radius.azurecr.io/eshop-envoy:0.1.`. - -Where NUMBER is one greater than the latest version made. To view versions, see https://ms.portal.azure.com/#view/Microsoft_Azure_ContainerRegistries/RepositoryBlade/id/%2Fsubscriptions%2F66d1209e-1382-45d3-99bb-650e6bf63fc0%2FresourceGroups%2Fassets%2Fproviders%2FMicrosoft.ContainerRegistry%2Fregistries%2Fradius/repository/eshop-envoy. - -To push the image, run `az acr login -n radius` and then `docker push radius.azurecr.io/eshop-envoy:0.1.`. - diff --git a/samples/eshop/eshop/envoy/envoy.yaml b/samples/eshop/eshop/envoy/envoy.yaml deleted file mode 100644 index 1eeec0b6..00000000 --- a/samples/eshop/eshop/envoy/envoy.yaml +++ /dev/null @@ -1,143 +0,0 @@ -admin: - access_log_path: "/dev/stdout" - address: - socket_address: - address: 0.0.0.0 - port_value: 8001 -static_resources: - listeners: - - address: - socket_address: - address: 0.0.0.0 - port_value: 80 - filter_chains: - - filters: - - name: envoy.http_connection_manager - config: - codec_type: auto - stat_prefix: ingress_http - route_config: - name: eshop_backend_route - virtual_hosts: - - name: eshop_backend - domains: - - "*" - routes: - - name: "c-short" - match: - prefix: "/webshoppingapigw/c/" - route: - auto_host_rewrite: true - prefix_rewrite: "/catalog-api/" - cluster: catalog - - name: "c-long" - match: - prefix: "/webshoppingapigw/catalog-api/" - route: - auto_host_rewrite: true - cluster: catalog - - name: "o-short" - match: - prefix: "/webshoppingapigw/o/" - route: - auto_host_rewrite: true - prefix_rewrite: "/ordering-api/" - cluster: ordering - - name: "o-long" - match: - prefix: "/webshoppingapigw/ordering-api/" - route: - auto_host_rewrite: true - cluster: ordering - - name: "h-long" - match: - prefix: "/webshoppingapigw/hub/notificationhub" - route: - auto_host_rewrite: true - cluster: signalr-hub - timeout: 300s - upgrade_configs: - upgrade_type: "websocket" - enabled: true - - name: "b-short" - match: - prefix: "/webshoppingapigw/b/" - route: - auto_host_rewrite: true - prefix_rewrite: "/basket-api/" - cluster: basket - - name: "b-long" - match: - prefix: "/webshoppingapigw/basket-api/" - route: - auto_host_rewrite: true - cluster: basket - - name: "agg" - match: - prefix: "/webshoppingapigw/" - route: - auto_host_rewrite: true - prefix_rewrite: "/" - cluster: shoppingagg - http_filters: - - name: envoy.router - access_log: - - name: envoy.file_access_log - filter: - not_health_check_filter: {} - config: - json_format: - time: "%START_TIME%" - protocol: "%PROTOCOL%" - duration: "%DURATION%" - request_method: "%REQ(:METHOD)%" - request_host: "%REQ(HOST)%" - path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" - response_flags: "%RESPONSE_FLAGS%" - route_name: "%ROUTE_NAME%" - upstream_host: "%UPSTREAM_HOST%" - upstream_cluster: "%UPSTREAM_CLUSTER%" - upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" - path: "/tmp/access.log" - clusters: - - name: shoppingagg - connect_timeout: 0.25s - type: strict_dns - lb_policy: round_robin - hosts: - - socket_address: - address: webshoppingagg-http - port_value: 5121 - - name: catalog - connect_timeout: 0.25s - type: strict_dns - lb_policy: round_robin - hosts: - - socket_address: - address: catalog-http - port_value: 5101 - - name: basket - connect_timeout: 0.25s - type: strict_dns - lb_policy: round_robin - hosts: - - socket_address: - address: basket-http - port_value: 5103 - - name: ordering - connect_timeout: 0.25s - type: strict_dns - lb_policy: round_robin - hosts: - - socket_address: - address: ordering-http - port_value: 5102 - - name: signalr-hub - connect_timeout: 0.25s - type: strict_dns - lb_policy: round_robin - hosts: - - socket_address: - address: orderingsignalrhub-http - port_value: 5112 - \ No newline at end of file diff --git a/samples/eshop/eshop/iac/environments/aws.bicep b/samples/eshop/eshop/iac/environments/aws.bicep deleted file mode 100644 index 4022cc9f..00000000 --- a/samples/eshop/eshop/iac/environments/aws.bicep +++ /dev/null @@ -1,53 +0,0 @@ -import radius as rad - -@description('Account ID of the AWS account resources should be deployed in') -param awsAccountId string - -@description('AWS region that resources should be deployed in') -param awsRegion string - -@description('Name of your EKS cluster') -param eksClusterName string - -resource awsEshopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { - name: 'aws-eshop-env' - properties: { - compute: { - kind: 'kubernetes' - resourceId: 'self' - namespace: 'aws-eshop' - } - providers: { - aws: { - scope: '/planes/aws/aws/accounts/${awsAccountId}/regions/${awsRegion}' - } - } - recipes: { - 'Applications.Datastores/sqlDatabases': { - sqldatabase: { - templateKind: 'bicep' - templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-29' - parameters: { - eksClusterName: eksClusterName - } - } - } - 'Applications.Datastores/redisCaches': { - rediscache: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/aws/rediscaches:edge' - parameters: { - eksClusterName: eksClusterName - } - } - } - // Temporarily using containerized rabbitmq until we can use SQS or AmazonMQ - 'Applications.Messaging/rabbitMQQueues': { - rabbitmqmessagequeue: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' - } - } - } - } -} diff --git a/samples/eshop/eshop/iac/environments/azure.bicep b/samples/eshop/eshop/iac/environments/azure.bicep deleted file mode 100644 index 5708f5a5..00000000 --- a/samples/eshop/eshop/iac/environments/azure.bicep +++ /dev/null @@ -1,43 +0,0 @@ -import radius as rad - -@description('Azure ResourceGroup name') -param azureResourceGroup string = resourceGroup().name - -@description('Azure SubscriptionId') -param azureSubscription string = subscription().subscriptionId - -resource azureEShopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { - name: 'azure-eshop-env' - properties: { - compute: { - kind: 'kubernetes' - resourceId: 'self' - namespace: 'azure-eshop' - } - providers: { - azure: { - scope: '/subscriptions/${azureSubscription}/resourceGroups/${azureResourceGroup}' - } - } - recipes: { - 'Applications.Datastores/sqlDatabases': { - sqldatabase: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:latest' - } - } - 'Applications.Datastores/redisCaches': { - rediscache: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' - } - } - 'Applications.Core/extenders': { - servicebus: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/extender-servicebus:latest' - } - } - } - } -} diff --git a/samples/eshop/eshop/iac/environments/containers.bicep b/samples/eshop/eshop/iac/environments/containers.bicep deleted file mode 100644 index 6fd47e85..00000000 --- a/samples/eshop/eshop/iac/environments/containers.bicep +++ /dev/null @@ -1,32 +0,0 @@ -import radius as rad - -resource containersEShopEnv 'Applications.Core/environments@2022-03-15-privatepreview' = { - name: 'containers-eshop-env' - properties: { - compute: { - kind: 'kubernetes' - resourceId: 'self' - namespace: 'containers-eshop' - } - recipes: { - 'Applications.Datastores/sqlDatabases': { - sqldatabase: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/sqldatabases:edge' - } - } - 'Applications.Datastores/redisCaches': { - rediscache: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rediscaches:edge' - } - } - 'Applications.Messaging/rabbitMQQueues': { - rabbitmqmessagequeue: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' - } - } - } - } -} diff --git a/samples/eshop/eshop/iac/eshop.bicep b/samples/eshop/eshop/iac/eshop.bicep deleted file mode 100644 index ca171bfd..00000000 --- a/samples/eshop/eshop/iac/eshop.bicep +++ /dev/null @@ -1,255 +0,0 @@ -import radius as rad - -// Parameters ------------------------------------------------------- - -@description('Name of the eshop application. Defaults to "eshop"') -param appName string = 'eshop' - -@description('Radius environment ID. Set automatically by Radius') -param environment string - -@description('SQL administrator username') -param adminLogin string = 'SA' - -@description('SQL administrator password') -@secure() -param adminPassword string = newGuid() - -@description('Container orchestrator to use. Defaults to "K8S"') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string = 'K8S' - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string = '' - -@description('Use Azure storage for custom resource images. Defaults to "False"') -@allowed([ - 'True' - 'False' -]) -param AZURESTORAGEENABLED string = 'False' - -@description('Use Azure Service Bus for messaging. Defaults to "False"') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string = 'False' - -@description('Use dev spaces. Defaults to "False"') -@allowed([ - 'True' - 'False' -]) -param ENABLEDEVSPACES string = 'False' - -@description('Container image tag to use for eshop images. Defaults to "linux-dotnet7"') -param TAG string = 'linux-dotnet7' - -// Application -------------------------------------------------------- - -resource eshop 'Applications.Core/applications@2022-03-15-privatepreview' = { - name: appName - properties: { - environment: environment - } -} - -// Infrastructure ------------------------------------------------------ - -module infra 'infra/infra.bicep' = { - name: 'infra' - params: { - application: eshop.id - environment: environment - adminLogin: adminLogin - adminPassword: adminPassword - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - } -} - -// Networking ---------------------------------------------------------- - -module networking 'infra/networking.bicep' = { - name: 'networking' - params: { - application: eshop.id - } -} - -// Services ------------------------------------------------------------ - -module basket 'services/basket.bicep' = { - name: 'basket' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - basketHttpName: networking.outputs.basketHttp - basketGrpcName: networking.outputs.basketGrpc - redisBasketName: infra.outputs.redisBasket - TAG: TAG - eventBusConnectionString: infra.outputs.eventBusConnectionString - } -} - -module catalog 'services/catalog.bicep' = { - name: 'catalog' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - AZURESTORAGEENABLED: AZURESTORAGEENABLED - catalogGrpcName: networking.outputs.catalogGrpc - catalogHttpName: networking.outputs.catalogHttp - gatewayName: networking.outputs.gateway - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - sqlCatalogDbName: infra.outputs.sqlCatalogDb - TAG: TAG - eventBusConnectionString: infra.outputs.eventBusConnectionString - } -} - -module identity 'services/identity.bicep' = { - name: 'identity' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - basketHttpName: networking.outputs.basketHttp - ENABLEDEVSPACES: ENABLEDEVSPACES - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - orderingHttpName: networking.outputs.orderingHttp - redisKeystoreName: infra.outputs.redisKeystore - sqlIdentityDbName: infra.outputs.sqlIdentityDb - TAG: TAG - webhooksclientHttpName: networking.outputs.webhooksclientHttp - webhooksHttpName: networking.outputs.webhooksHttp - webmvcHttpName: networking.outputs.webmvcHttp - webshoppingaggHttpName: networking.outputs.webshoppingaggHttp - } -} - -module ordering 'services/ordering.bicep' = { - name: 'ordering' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - basketHttpName: networking.outputs.basketHttp - catalogHttpName: networking.outputs.catalogHttp - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - orderbgtasksHttpName: networking.outputs.orderbgtasksHttp - orderingGrpcName: networking.outputs.orderingGrpc - orderingHttpName: networking.outputs.orderingHttp - orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp - redisKeystoreName: infra.outputs.redisKeystore - sqlOrderingDbName: infra.outputs.sqlOrderingDb - TAG: TAG - eventBusConnectionString: infra.outputs.eventBusConnectionString - } -} - -module payment 'services/payment.bicep' = { - name: 'payment' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - paymentHttpName: networking.outputs.paymentHttp - TAG: TAG - eventBusConnectionString: infra.outputs.eventBusConnectionString - } -} - -module seq 'services/seq.bicep' = { - name: 'seq' - params: { - application: eshop.id - seqHttpName: networking.outputs.seqHttp - } -} - -module web 'services/web.bicep' = { - name: 'web' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp - redisKeystoreName: infra.outputs.redisKeystore - TAG: TAG - webmvcHttpName: networking.outputs.webmvcHttp - webshoppingaggHttpName: networking.outputs.webshoppingaggHttp - webshoppingapigwHttpName: networking.outputs.webshoppingapigwHttp - webspaHttpName: networking.outputs.webspaHttp - } -} - -module webhooks 'services/webhooks.bicep' = { - name: 'webhooks' - params: { - application: eshop.id - AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - sqlWebhooksDbName: infra.outputs.sqlWebhooksDb - TAG: TAG - webhooksclientHttpName: networking.outputs.webhooksclientHttp - webhooksHttpName: networking.outputs.webhooksHttp - eventBusConnectionString: infra.outputs.eventBusConnectionString - } -} - -module webshopping 'services/webshopping.bicep' = { - name: 'webshopping' - params: { - application: eshop.id - basketGrpcName: networking.outputs.basketGrpc - basketHttpName: networking.outputs.basketHttp - catalogGrpcName: networking.outputs.catalogGrpc - catalogHttpName: networking.outputs.catalogHttp - gatewayName: networking.outputs.gateway - identityHttpName: networking.outputs.identityHttp - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - orderingGrpcName: networking.outputs.orderingGrpc - orderingHttpName: networking.outputs.basketHttp - paymentHttpName: networking.outputs.paymentHttp - TAG: TAG - webshoppingaggHttpName: networking.outputs.webshoppingaggHttp - webshoppingapigwHttp2Name: networking.outputs.webshoppingapigwHttp2 - webshoppingapigwHttpName: networking.outputs.webshoppingapigwHttp - } -} - -module webstatus 'services/webstatus.bicep' = { - name: 'webstatus' - params: { - application: eshop.id - APPLICATION_INSIGHTS_KEY: APPLICATION_INSIGHTS_KEY - basketHttpName: networking.outputs.basketHttp - catalogHttpName: networking.outputs.catalogHttp - identityHttpName: networking.outputs.identityHttp - ORCHESTRATOR_TYPE: ORCHESTRATOR_TYPE - orderbgtasksHttpName: networking.outputs.orderbgtasksHttp - orderingHttpName: networking.outputs.orderingHttp - orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp - paymentHttpName: networking.outputs.paymentHttp - TAG: TAG - webmvcHttpName: networking.outputs.webmvcHttp - webshoppingaggHttpName: networking.outputs.webshoppingaggHttp - webspaHttpName: networking.outputs.webspaHttp - webstatusHttpName: networking.outputs.webstatusHttp - } -} diff --git a/samples/eshop/eshop/iac/infra/infra.bicep b/samples/eshop/eshop/iac/infra/infra.bicep deleted file mode 100644 index 9cd58018..00000000 --- a/samples/eshop/eshop/iac/infra/infra.bicep +++ /dev/null @@ -1,165 +0,0 @@ -import radius as rad - -@description('Radius environment ID') -param environment string - -@description('Radius application ID') -param application string - -@description('SQL administrator username') -@secure() -param adminLogin string - -@description('SQL administrator password') -@secure() -param adminPassword string - -@description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -// Links --------------------------------------------------------------- - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { - name: 'identitydb' - properties: { - application: application - environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'IdentityDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } - } -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { - name: 'catalogdb' - properties: { - application: application - environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'CatalogDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } - } -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { - name: 'orderingdb' - properties: { - application: application - environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'OrderingDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } - } -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { - name: 'webhooksdb' - properties: { - application: application - environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'WebhooksDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } - } -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { - name: 'keystore-data' - properties: { - application: application - environment: environment - recipe: { - name: 'rediscache' - } - } -} - -resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { - name: 'basket-data' - properties: { - application: application - environment: environment - recipe: { - name: 'rediscache' - } - } -} - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = if (AZURESERVICEBUSENABLED == 'False') { - name: 'rabbitmq' - properties: { - application: application - environment: environment - recipe: { - name: 'rabbitmqmessagequeue' - } - } -} - -resource servicebus 'Applications.Core/extenders@2022-03-15-privatepreview' = if (AZURESERVICEBUSENABLED == 'True') { - name: 'servicebus' - properties: { - application: application - environment: environment - recipe: { - name: 'servicebus' - parameters: { - topicName: 'eshop_event_bus' - subscriptions: ['Basket', 'Catalog', 'Ordering', 'GracePeriod', 'Payment', 'backgroundtasks', 'Ordering.signalrhub', 'Webhooks'] - } - } - } -} - -// Outputs ------------------------------------ - -@description('The name of the SQL Identity Link') -output sqlIdentityDb string = sqlIdentityDb.name - -@description('The name of the SQL Catalog Link') -output sqlCatalogDb string = sqlCatalogDb.name - -@description('The name of the SQL Ordering Link') -output sqlOrderingDb string = sqlOrderingDb.name - -@description('The name of the SQL Webhooks Link') -output sqlWebhooksDb string = sqlWebhooksDb.name - -@description('The name of the Redis Keystore Link') -output redisKeystore string = redisKeystore.name - -@description('The name of the Redis Basket Link') -output redisBasket string = redisBasket.name - -@description('The name of the RabbitMQ Link') -output rabbitmq string = rabbitmq.name - -@description('The name of the Service Bus Link') -output servicebus string = servicebus.name - -@description('Event Bus connection string') -output eventBusConnectionString string = (AZURESERVICEBUSENABLED == 'True') ? servicebus.secrets('connectionString') : rabbitmq.properties.host diff --git a/samples/eshop/eshop/iac/infra/networking.bicep b/samples/eshop/eshop/iac/infra/networking.bicep deleted file mode 100644 index 2ceb05d3..00000000 --- a/samples/eshop/eshop/iac/infra/networking.bicep +++ /dev/null @@ -1,275 +0,0 @@ -import radius as rad - -// PARAMETERS ------------------------------------------------------------ -@description('Radius application ID') -param application string - -// GATEWAY --------------------------------------------------------- - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' = { - name: 'gateway' - properties: { - application: application - routes: [ - { - path: '/identity-api' - destination: identityHttp.id - } - { - path: '/ordering-api' - destination: orderingHttp.id - } - { - path: '/basket-api' - destination: basketHttp.id - } - { - path: '/webhooks-api' - destination: webhooksHttp.id - } - { - path: '/webshoppingagg' - destination: webshoppingaggHttp.id - } - { - path: '/webshoppingapigw' - destination: webshoppingapigwHttp.id - } - { - path: '/webhooks-web' - destination: webhooksclientHttp.id - } - { - path: '/webstatus' - destination: webstatusHttp.id - } - { - path: '/' - destination: webspaHttp.id - } - { - path: '/webmvc' - destination: webmvcHttp.id - } - ] - } -} - - -// ROUTES ---------------------------------------------------------- - -resource basketHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'basket-http' - properties: { - application: application - port: 5103 - } -} - -resource basketGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'basket-grpc' - properties: { - application: application - port: 9103 - } -} - -resource catalogHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'catalog-http' - properties: { - application: application - port: 5101 - } -} - -resource catalogGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'catalog-grpc' - properties: { - application: application - port: 9101 - } -} - -resource identityHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'identity-http' - properties: { - application: application - port: 5105 - } -} - -resource orderingHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'ordering-http' - properties: { - application: application - port: 5102 - } -} - -resource orderingGrpc 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'ordering-grpc' - properties: { - application: application - port: 9102 - } -} - -resource orderingsignalrhubHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'orderingsignalrhub-http' - properties: { - application: application - port: 5112 - } -} - -resource orderbgtasksHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'orderbgtasks-http' - properties: { - application: application - port: 5111 - } -} - -resource paymentHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'payment-http' - properties: { - application: application - port: 5108 - } -} - -resource seqHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'seq-http' - properties: { - application: application - port: 5340 - } -} - -resource webspaHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webspa-http' - properties: { - application: application - port: 5104 - } -} - -resource webmvcHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webmvc-http' - properties: { - application: application - port: 5100 - } -} - -resource webhooksHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webhooks-http' - properties: { - application: application - port: 5113 - } -} - -resource webhooksclientHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webhooksclient-http' - properties: { - application: application - port: 5114 - hostname: '/webhooks-web' - } -} - -resource webshoppingaggHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webshoppingagg-http' - properties: { - application: application - port: 5121 - } -} - -resource webshoppingapigwHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webshoppingapigw-http' - properties: { - application: application - port: 5202 - } -} - -resource webshoppingapigwHttp2 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webshoppingapigw-http-2' - properties: { - application: application - port: 15202 - } -} - -resource webstatusHttp 'Applications.Core/httproutes@2022-03-15-privatepreview' = { - name: 'webstatus-http' - properties: { - application: application - port: 8107 - } -} - -// OUTPUTS -------------------------------------------------------------------- - -@description('Name of the Gateway') -output gateway string = gateway.name - -@description('Name of the Basket HTTP route') -output basketHttp string = basketHttp.name - -@description('Name of the Basket gRPC route') -output basketGrpc string = basketGrpc.name - -@description('Name of the Catalog HTTP route') -output catalogHttp string = catalogHttp.name - -@description('Name of the Catalog gRPC route') -output catalogGrpc string = catalogGrpc.name - -@description('Name of the Identity HTTP route') -output identityHttp string = identityHttp.name - -@description('Name of the Ordering HTTP route') -output orderingHttp string = orderingHttp.name - -@description('Name of the Ordering gRPC route') -output orderingGrpc string = orderingGrpc.name - -@description('Name of the Ordering SignalR Hub HTTP route') -output orderingsignalrhubHttp string = orderingsignalrhubHttp.name - -@description('Name of the Ordering Background Tasks HTTP route') -output orderbgtasksHttp string = orderbgtasksHttp.name - -@description('Name of the Payment HTTP route') -output paymentHttp string = paymentHttp.name - -@description('Name of the SEQ HTTP route') -output seqHttp string = seqHttp.name - -@description('Name of the WebSPA HTTP route') -output webspaHttp string = webspaHttp.name - -@description('Name of the WebMVC HTTP route') -output webmvcHttp string = webmvcHttp.name - -@description('Name of the Webhooks HTTP route') -output webhooksHttp string = webhooksHttp.name - -@description('Name of the Webhooks Client HTTP route') -output webhooksclientHttp string = webhooksclientHttp.name - -@description('Name of the WebShopping Aggregator HTTP route') -output webshoppingaggHttp string = webshoppingaggHttp.name - -@description('Name of the WebShopping API Gateway HTTP route') -output webshoppingapigwHttp string = webshoppingapigwHttp.name - -@description('Name of the WebShopping API Gateway HTTP route') -output webshoppingapigwHttp2 string = webshoppingapigwHttp2.name - -@description('Name of the WebStatus HTTP route') -output webstatusHttp string = webstatusHttp.name - diff --git a/samples/eshop/eshop/iac/services/basket.bicep b/samples/eshop/eshop/iac/services/basket.bicep deleted file mode 100644 index ad1b4cc0..00000000 --- a/samples/eshop/eshop/iac/services/basket.bicep +++ /dev/null @@ -1,116 +0,0 @@ -import radius as rad - -// Parameters --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('The name of the Radius Gateway') -param gatewayName string - -@description('The name of the Identity HTTP Route') -param identityHttpName string - -@description('The name of the Basket HTTP Route') -param basketHttpName string - -@description('The name of the Basket gRPC Route') -param basketGrpcName string - -@description('The name of the Redis Basket Link') -param redisBasketName string - -@description('The connection string for the event bus') -@secure() -param eventBusConnectionString string - -// Container ------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/basket-api -resource basket 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'basket-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/basket.api:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - UseLoadTest: 'False' - PATH_BASE: '/basket-api' - OrchestratorType: ORCHESTRATOR_TYPE - PORT: '80' - GRPC_PORT: '81' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: redisBasket.connectionString() - EventBusConnection: eventBusConnectionString - identityUrl: identityHttp.properties.url - IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: basketHttp.id - } - grpc: { - containerPort: 81 - provides: basketGrpc.id - } - } - } - connections: { - redis: { - source: redisBasket.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// Networking ------------------------------------------- - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketHttpName -} - -resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketGrpcName -} - -// Links ------------------------------------------ - -resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: redisBasketName -} diff --git a/samples/eshop/eshop/iac/services/catalog.bicep b/samples/eshop/eshop/iac/services/catalog.bicep deleted file mode 100644 index a4d7a3ce..00000000 --- a/samples/eshop/eshop/iac/services/catalog.bicep +++ /dev/null @@ -1,114 +0,0 @@ -import radius as rad - -// Parameters --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use Azure storage for custom resource images') -@allowed([ - 'True' - 'False' -]) -param AZURESTORAGEENABLED string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('The name of the Catalog HTTP Route') -param catalogHttpName string - -@description('The name of the Catalog gRPC Route') -param catalogGrpcName string - -@description('The name of the Catalog SQL Link') -param sqlCatalogDbName string - -@description('The connection string for the event bus') -@secure() -param eventBusConnectionString string - -// VARIABLES ----------------------------------------------------------------------------------- - -var PICBASEURL = '${gateway.properties.url}/webshoppingapigw/c/api/v1/catalog/items/[0]/pic' - -// CONTAINERS ------------------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/catalog-api -resource catalog 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'catalog-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/catalog.api:${TAG}' - env: { - UseCustomizationData: 'False' - PATH_BASE: '/catalog-api' - ASPNETCORE_ENVIRONMENT: 'Development' - OrchestratorType: ORCHESTRATOR_TYPE - PORT: '80' - GRPC_PORT: '81' - PicBaseUrl: PICBASEURL - AzureStorageEnabled: AZURESTORAGEENABLED - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlCatalogDb.connectionString() - EventBusConnection: eventBusConnectionString - } - ports: { - http: { - containerPort: 80 - provides: catalogHttp.id - } - grpc: { - containerPort: 81 - provides: catalogGrpc.id - } - } - } - connections: { - sql: { - source: sqlCatalogDb.id - } - } - } -} - -// NETWORKING ------------------------------------------------------ - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogHttpName -} - -resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogGrpcName -} - -// LINKS ----------------------------------------------------------- - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: sqlCatalogDbName -} diff --git a/samples/eshop/eshop/iac/services/identity.bicep b/samples/eshop/eshop/iac/services/identity.bicep deleted file mode 100644 index 81130344..00000000 --- a/samples/eshop/eshop/iac/services/identity.bicep +++ /dev/null @@ -1,165 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use dev spaces') -@allowed([ - 'True' - 'False' -]) -param ENABLEDEVSPACES string - -@description('Container image tag to use for eshop images. Defaults to linux-dotnet7') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('Name of the Identity HTTP Route') -param identityHttpName string - -@description('Name of the Basket HTTP Route') -param basketHttpName string - -@description('Name of the Ordering HTTP Route') -param orderingHttpName string - -@description('Name of the WebShoppingAgg HTTP Route') -param webshoppingaggHttpName string - -@description('Name of the Webhooks HTTP Route') -param webhooksHttpName string - -@description('Name of the WebhooksClient HTTP Route') -param webhooksclientHttpName string - -@description('Name of the WebMVC HTTP Route') -param webmvcHttpName string - -@description('Name of the Identity SQL Database Link') -param sqlIdentityDbName string - -@description('Name of the Keystore Redis Link') -param redisKeystoreName string - -// CONTAINERS ------------------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/identity-api -resource identity 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'identity-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/identity.api:${TAG}' - env: { - PATH_BASE: '/identity-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: 'K8S' - IsClusterEnv: 'True' - DPConnectionString: redisKeystore.connectionString() - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - XamarinCallback: '' - EnableDevspaces: ENABLEDEVSPACES - ConnectionString: sqlIdentityDb.connectionString() - MvcClient: '${gateway.properties.url}/${webmvcHttp.properties.hostname}' - SpaClient: gateway.properties.url - BasketApiClient: '${gateway.properties.url}/${basketHttp.properties.hostname}' - OrderingApiClient: '${gateway.properties.url}/${orderingHttp.properties.hostname}' - WebShoppingAggClient: '${gateway.properties.url}/${webshoppingaggHttp.properties.hostname}' - WebhooksApiClient: '${gateway.properties.url}/${webhooksHttp.properties.hostname}' - WebhooksWebClient: '${gateway.properties.url}/${webhooksclientHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: identityHttp.id - } - } - } - connections: { - redis: { - source: redisKeystore.id - disableDefaultEnvVars: true - } - sql: { - source: sqlIdentityDb.id - disableDefaultEnvVars: true - } - webmvc: { - source: webmvcHttp.id - disableDefaultEnvVars: true - } - basket: { - source: basketHttp.id - disableDefaultEnvVars: true - } - ordering: { - source: orderingHttp.id - disableDefaultEnvVars: true - } - webshoppingagg: { - source: webshoppingaggHttp.id - disableDefaultEnvVars: true - } - webhooks: { - source: webhooksHttp.id - disableDefaultEnvVars: true - } - webhoolsclient: { - source: webhooksclientHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// NETWORKING ------------------------------------------------------ - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketHttpName -} - -resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingHttpName -} - -resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingaggHttpName -} - -resource webhooksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webhooksHttpName -} - -resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webhooksclientHttpName -} - -resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webmvcHttpName -} - -// LINKS ----------------------------------------------------------- - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: sqlIdentityDbName -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: redisKeystoreName -} diff --git a/samples/eshop/eshop/iac/services/ordering.bicep b/samples/eshop/eshop/iac/services/ordering.bicep deleted file mode 100644 index b78f9343..00000000 --- a/samples/eshop/eshop/iac/services/ordering.bicep +++ /dev/null @@ -1,244 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('Name of the Identity HTTP Route') -param identityHttpName string - -@description('Name of the Basket HTTP Route') -param basketHttpName string - -@description('The name of the Catalog HTTP Route') -param catalogHttpName string - -@description('Name of the Ordering HTTP Route') -param orderingHttpName string - -@description('Name of the Ordering gRPC Route') -param orderingGrpcName string - -@description('Name of the Ordering SignalR Hub HTTP Route') -param orderingsignalrhubHttpName string - -@description('Name of the Ordering background tasks HTTP Route') -param orderbgtasksHttpName string - -@description('Name of the Keystore Redis Link') -param redisKeystoreName string - -@description('Name of the Ordering SQL Link') -param sqlOrderingDbName string - -@description('The connection string for the event bus') -@secure() -param eventBusConnectionString string - -// CONTAINERS ------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-api -resource ordering 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'ordering-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/ordering.api:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - CheckUpdateTime: '30000' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE - UseLoadTest: 'False' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - 'Serilog__MinimumLevel__Override__ordering-api': 'Verbose' - PATH_BASE: '/ordering-api' - GRPC_PORT: '81' - PORT: '80' - ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: eventBusConnectionString - identityUrl: identityHttp.properties.url - IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: orderingHttp.id - } - grpc: { - containerPort: 81 - provides: orderingGrpc.id - } - } - } - connections: { - sql: { - source: sqlOrderingDb.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-backgroundtasks -resource orderbgtasks 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'ordering-backgroundtasks' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/ordering.backgroundtasks:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - CheckUpdateTime: '30000' - GracePeriodTime: '1' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - UseLoadTest: 'False' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - OrchestratorType: ORCHESTRATOR_TYPE - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: eventBusConnectionString - } - ports: { - http: { - containerPort: 80 - provides: orderbgtasksHttp.id - } - } - } - connections: { - sql: { - source: sqlOrderingDb.id - disableDefaultEnvVars: true - } - } - } -} - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/ordering-signalrhub -resource orderingsignalrhub 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'ordering-signalrhub' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/ordering.signalrhub:${TAG}' - env: { - PATH_BASE: '/payment-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE - IsClusterEnv: 'True' - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: eventBusConnectionString - SignalrStoreConnectionString: redisKeystore.connectionString() - identityUrl: identityHttp.properties.url - IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: orderingsignalrhubHttp.id - } - } - } - connections: { - redis: { - source: redisKeystore.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - ordering: { - source: orderingHttp.id - disableDefaultEnvVars: true - } - catalog: { - source: catalogHttp.id - disableDefaultEnvVars: true - } - basket: { - source: basketHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// NETWORKING ------------------------------------------------------ - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketHttpName -} - -resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogHttpName -} - -resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingHttpName -} - -resource orderingGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingGrpcName -} - -resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingsignalrhubHttpName -} - -resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderbgtasksHttpName -} - -// LINKS ----------------------------------------------------------- - -resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: redisKeystoreName -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: sqlOrderingDbName -} diff --git a/samples/eshop/eshop/iac/services/payment.bicep b/samples/eshop/eshop/iac/services/payment.bicep deleted file mode 100644 index 2bbaa9d2..00000000 --- a/samples/eshop/eshop/iac/services/payment.bicep +++ /dev/null @@ -1,65 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Name of the Payment HTTP route') -param paymentHttpName string - -@description('The connection string for the event bus') -@secure() -param eventBusConnectionString string - -// CONTAINERS --------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/payment-api -resource payment 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'payment-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/payment.api:${TAG}' - env: { - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - 'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': 'Verbose' - 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' - OrchestratorType: ORCHESTRATOR_TYPE - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: eventBusConnectionString - } - ports: { - http: { - containerPort: 80 - provides: paymentHttp.id - } - } - } - } -} - -// NETWORKING ------------------------------------------------------ - -resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: paymentHttpName -} diff --git a/samples/eshop/eshop/iac/services/seq.bicep b/samples/eshop/eshop/iac/services/seq.bicep deleted file mode 100644 index b8074b9f..00000000 --- a/samples/eshop/eshop/iac/services/seq.bicep +++ /dev/null @@ -1,36 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('Name of the SEQ Http Route') -param seqHttpName string - -// CONTAINERS ------------------------------------------------------------ - -resource seq 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'seq' - properties: { - application: application - container: { - image: 'datalust/seq:latest' - env: { - ACCEPT_EULA: 'Y' - } - ports: { - web: { - containerPort: 80 - provides: seqHttp.id - } - } - } - } -} - -// NETWORKING --------------------------------------------------------------- - -resource seqHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: seqHttpName -} diff --git a/samples/eshop/eshop/iac/services/web.bicep b/samples/eshop/eshop/iac/services/web.bicep deleted file mode 100644 index 6d466b62..00000000 --- a/samples/eshop/eshop/iac/services/web.bicep +++ /dev/null @@ -1,190 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('Ordering SignalR Hub Http Route name') -param orderingsignalrhubHttpName string - -@description('Identity Http Route name') -param identityHttpName string - -@description('Web MVC Http Route name') -param webmvcHttpName string - -@description('Web SPA Http Route name') -param webspaHttpName string - -@description('Web Shopping Aggregator Http Route name') -param webshoppingaggHttpName string - -@description('Web shopping API GW HTTP Route name') -param webshoppingapigwHttpName string - -@description('Name of the Keystore Redis Link name') -param redisKeystoreName string - -// CONTAINER -------------------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webspa -resource webspa 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'web-spa' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webspa:${TAG}' - env: { - PATH_BASE: '/' - ASPNETCORE_ENVIRONMENT: 'Production' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - UseCustomizationData: 'False' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE - IsClusterEnv: 'True' - CallBackUrl: '${gateway.properties.url}/' - DPConnectionString: redisKeystore.connectionString() - IdentityUrl: '${gateway.properties.url}/identity-api' - IdentityUrlHC: '${identityHttp.properties.url}/hc' - PurchaseUrl: '${gateway.properties.url}/webshoppingapigw' - SignalrHubUrl: orderingsignalrhubHttp.properties.url - } - ports: { - http: { - containerPort: 80 - provides: webspaHttp.id - } - } - } - connections: { - redis: { - source: redisKeystore.id - disableDefaultEnvVars: true - } - webshoppingagg: { - source: webshoppingaggHttp.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - webshoppingapigw: { - source: webshoppingapigwHttp.id - disableDefaultEnvVars: true - } - orderingsignalrhub: { - source: orderingsignalrhubHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webmvc -resource webmvc 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webmvc' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webmvc:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/webmvc' - UseCustomizationData: 'False' - DPConnectionString: redisKeystore.connectionString() - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - UseLoadTest: 'False' - OrchestratorType: ORCHESTRATOR_TYPE - IsClusterEnv: 'True' - ExternalPurchaseUrl: '${gateway.properties.url}/${webshoppingapigwHttp.properties.hostname}' - CallBackUrl: '${gateway.properties.url}/webmvc' - IdentityUrl: '${gateway.properties.url}/identity-api' - IdentityUrlHC: '${identityHttp.properties.url}/hc' - PurchaseUrl: webshoppingapigwHttp.properties.url - SignalrHubUrl: orderingsignalrhubHttp.properties.url - } - ports: { - http: { - containerPort: 80 - provides: webmvcHttp.id - } - } - } - connections: { - redis: { - source: redisKeystore.id - disableDefaultEnvVars: true - } - webshoppingagg: { - source: webshoppingaggHttp.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - webshoppingapigw: { - source: webshoppingapigwHttp.id - disableDefaultEnvVars: true - } - orderingsignalrhub: { - source: orderingsignalrhubHttp.id - disableDefaultEnvVars: true - } - } - } -} - -// NETWORKING ---------------------------------------------- - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingsignalrhubHttpName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webmvcHttpName -} - -resource webspaHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webspaHttpName -} - -resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingaggHttpName -} - -resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingapigwHttpName -} - -// LINKS ------------------------------------------------------ - -resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: redisKeystoreName -} diff --git a/samples/eshop/eshop/iac/services/webhooks.bicep b/samples/eshop/eshop/iac/services/webhooks.bicep deleted file mode 100644 index bfe4d0b2..00000000 --- a/samples/eshop/eshop/iac/services/webhooks.bicep +++ /dev/null @@ -1,141 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Use Azure Service Bus for messaging') -@allowed([ - 'True' - 'False' -]) -param AZURESERVICEBUSENABLED string - -@description('Container image tag to use for eshop images. Defaults to linux-dotnet7') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('Name of the Identity HTTP Route') -param identityHttpName string - -@description('Name of the Webhooks HTTP Route') -param webhooksHttpName string - -@description('Name of the WebhooksClient HTTP Route') -param webhooksclientHttpName string - -@description('The name of the Webhooks SQL Link') -param sqlWebhooksDbName string - -@description('The connection string for the event bus') -@secure() -param eventBusConnectionString string - -// CONTAINERS ----------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webhooks-api -resource webhooks 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webhooks-api' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webhooks.api:${TAG}' - env: { - PATH_BASE: '/webhooks-api' - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: ORCHESTRATOR_TYPE - AzureServiceBusEnabled: AZURESERVICEBUSENABLED - ConnectionString: sqlWebhooksDb.connectionString() - EventBusConnection: eventBusConnectionString - identityUrl: identityHttp.properties.url - IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: webhooksHttp.id - } - } - } - connections: { - sql: { - source: sqlWebhooksDb.id - disableDefaultEnvVars: true - } - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - } - } -} - - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webhooks-web -resource webhooksclient 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webhooks-client' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webhooks.client:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Production' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - PATH_BASE: '/webhooks-web' - Token: 'WebHooks-Demo-Web' - CallBackUrl: '${gateway.properties.url}/${webhooksclientHttp.properties.hostname}' - SelfUrl: webhooksclientHttp.properties.url - WebhooksUrl: webhooksHttp.properties.url - IdentityUrl: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: webhooksclientHttp.id - } - } - } - connections: { - webhooks: { - source: webhooksHttp.id - } - identity: { - source: identityHttp.id - } - } - } -} - -// NETWORKING ---------------------------------------------- - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource webhooksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webhooksHttpName -} - -resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webhooksclientHttpName -} - -// LINKS ----------------------------------------------------------- - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: sqlWebhooksDbName -} diff --git a/samples/eshop/eshop/iac/services/webshopping.bicep b/samples/eshop/eshop/iac/services/webshopping.bicep deleted file mode 100644 index 93afb086..00000000 --- a/samples/eshop/eshop/iac/services/webshopping.bicep +++ /dev/null @@ -1,178 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Name of the Gateway') -param gatewayName string - -@description('Basket Http Route name') -param basketHttpName string - -@description('Basket gRPC Route name') -param basketGrpcName string - -@description('Ordering Http Route name') -param orderingHttpName string - -@description('Ordering gRPC Route name') -param orderingGrpcName string - -@description('Identity Http Route name') -param identityHttpName string - -@description('Catalog Http Route name') -param catalogHttpName string - -@description('Catalog gRPC Route name') -param catalogGrpcName string - -@description('Payment Http Route name') -param paymentHttpName string - -@description('Web shopping API GW HTTP Route name') -param webshoppingapigwHttpName string - -@description('Web shopping API GW HTTP Route 2 name') -param webshoppingapigwHttp2Name string - -@description('Web Shopping Aggregator Http Route name') -param webshoppingaggHttpName string - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webshoppingagg -resource webshoppingagg 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webshoppingagg' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webshoppingagg:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - PATH_BASE: '/webshoppingagg' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - OrchestratorType: ORCHESTRATOR_TYPE - IsClusterEnv: 'True' - urls__basket: basketHttp.properties.url - urls__catalog: catalogHttp.properties.url - urls__orders: orderingHttp.properties.url - urls__identity: identityHttp.properties.url - urls__grpcBasket: basketGrpc.properties.url - urls__grpcCatalog: catalogGrpc.properties.url - urls__grpcOrdering: orderingGrpc.properties.url - CatalogUrlHC: '${catalogHttp.properties.url}/hc' - OrderingUrlHC: '${orderingHttp.properties.url}/hc' - IdentityUrlHC: '${identityHttp.properties.url}/hc' - BasketUrlHC: '${basketHttp.properties.url}/hc' - PaymentUrlHC: '${paymentHttp.properties.url}/hc' - IdentityUrlExternal: '${gateway.properties.url}/${identityHttp.properties.hostname}' - } - ports: { - http: { - containerPort: 80 - provides: webshoppingaggHttp.id - } - } - } - connections: { - identity: { - source: identityHttp.id - disableDefaultEnvVars: true - } - ordering: { - source: orderingHttp.id - disableDefaultEnvVars: true - } - catalog: { - source: catalogHttp.id - disableDefaultEnvVars: true - } - basket: { - source: basketHttp.id - disableDefaultEnvVars: true - } - } - } -} - - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/apigwws -resource webshoppingapigw 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webshoppingapigw' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop-envoy:0.1.4' - ports: { - http: { - containerPort: 80 - provides: webshoppingapigwHttp.id - } - http2: { - containerPort: 8001 - provides: webshoppingapigwHttp2.id - } - } - } - } -} - -// NETWORKING ---------------------------------------------- - -resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing = { - name: gatewayName -} - -resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketGrpcName -} - -resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogGrpcName -} - -resource orderingGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingGrpcName -} - -resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogHttpName -} - -resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketHttpName -} - -resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingHttpName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: paymentHttpName -} - -resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingaggHttpName -} - -resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingapigwHttpName -} - -resource webshoppingapigwHttp2 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingapigwHttp2Name -} diff --git a/samples/eshop/eshop/iac/services/webstatus.bicep b/samples/eshop/eshop/iac/services/webstatus.bicep deleted file mode 100644 index e1e9cf9e..00000000 --- a/samples/eshop/eshop/iac/services/webstatus.bicep +++ /dev/null @@ -1,142 +0,0 @@ -import radius as rad - -// PARAMETERS --------------------------------------------------------- - -@description('Radius application ID') -param application string - -@description('What container orchestrator to use') -@allowed([ - 'K8S' -]) -param ORCHESTRATOR_TYPE string - -@description('Optional App Insights Key') -param APPLICATION_INSIGHTS_KEY string - -@description('Container image tag to use for eshop images') -param TAG string - -@description('Basket Http Route name') -param basketHttpName string - -@description('Ordering Http Route name') -param orderingHttpName string - -@description('Ordering SignalR Hub Http Route name') -param orderingsignalrhubHttpName string - -@description('Ordering Background Tasks Http Route name') -param orderbgtasksHttpName string - -@description('Identity Http Route name') -param identityHttpName string - -@description('Catalog Http Route name') -param catalogHttpName string - -@description('Payment Http Route name') -param paymentHttpName string - -@description('Web MVC Http Route name') -param webmvcHttpName string - -@description('Web SPA Http Route name') -param webspaHttpName string - -@description('Web Shopping Aggregator Http Route name') -param webshoppingaggHttpName string - -@description('Web Status Http Route name') -param webstatusHttpName string - -// CONTAINAERS --------------------------------------------------------- - -// Based on https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm/webstatus -resource webstatus 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'webstatus' - properties: { - application: application - container: { - image: 'radius.azurecr.io/eshop/webstatus:${TAG}' - env: { - ASPNETCORE_ENVIRONMENT: 'Development' - ASPNETCORE_URLS: 'http://0.0.0.0:80' - HealthChecksUI__HealthChecks__0__Name: 'WebMVC HTTP Check' - HealthChecksUI__HealthChecks__0__Uri: '${webmvcHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__1__Name: 'WebSPA HTTP Check' - HealthChecksUI__HealthChecks__1__Uri: '${webspaHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__2__Name: 'Web Shopping Aggregator GW HTTP Check' - HealthChecksUI__HealthChecks__2__Uri: '${webshoppingaggHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__4__Name: 'Ordering HTTP Check' - HealthChecksUI__HealthChecks__4__Uri: '${orderingHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__5__Name: 'Basket HTTP Check' - HealthChecksUI__HealthChecks__5__Uri: '${basketHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__6__Name: 'Catalog HTTP Check' - HealthChecksUI__HealthChecks__6__Uri: '${catalogHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__7__Name: 'Identity HTTP Check' - HealthChecksUI__HealthChecks__7__Uri: '${identityHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__8__Name: 'Payments HTTP Check' - HealthChecksUI__HealthChecks__8__Uri: '${paymentHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__9__Name: 'Ordering SignalRHub HTTP Check' - HealthChecksUI__HealthChecks__9__Uri: '${orderingsignalrhubHttp.properties.url}/hc' - HealthChecksUI__HealthChecks__10__Name: 'Ordering HTTP Background Check' - HealthChecksUI__HealthChecks__10__Uri: '${orderbgtasksHttp.properties.url}/hc' - ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY - OrchestratorType: ORCHESTRATOR_TYPE - } - ports: { - http: { - containerPort: 80 - provides: webstatusHttp.id - } - } - } - } -} - -// NETWORKING ---------------------------------------------- - -resource catalogHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: catalogHttpName -} - -resource basketHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: basketHttpName -} - -resource orderingHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingHttpName -} - -resource orderingsignalrhubHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderingsignalrhubHttpName -} - -resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: orderbgtasksHttpName -} - -resource identityHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: identityHttpName -} - -resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: paymentHttpName -} - -resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webmvcHttpName -} - -resource webspaHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webspaHttpName -} - -resource webshoppingaggHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webshoppingaggHttpName -} - -resource webstatusHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { - name: webstatusHttpName -} diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep index 8bd53a0e..5cfc5aac 100644 --- a/samples/eshop/infra/infra.bicep +++ b/samples/eshop/infra/infra.bicep @@ -21,7 +21,7 @@ param adminPassword string ]) param AZURESERVICEBUSENABLED string -// Links --------------------------------------------------------------- +// Portable Resources-------------------------------------------------------------- resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { name: 'identitydb' diff --git a/samples/eshop/services/basket.bicep b/samples/eshop/services/basket.bicep index fba757c8..dc2ee3e8 100644 --- a/samples/eshop/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -99,7 +99,7 @@ resource basketGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing = name: basketGrpcName } -// Links ------------------------------------------ +// Portable Resources----------------------------------------- resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisBasketName diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep index 574cc464..4d5f9dad 100644 --- a/samples/eshop/services/catalog.bicep +++ b/samples/eshop/services/catalog.bicep @@ -90,7 +90,7 @@ resource catalogGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing name: catalogGrpcName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlCatalogDbName diff --git a/samples/eshop/services/identity.bicep b/samples/eshop/services/identity.bicep index caa0b685..9533b8e8 100644 --- a/samples/eshop/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -144,7 +144,7 @@ resource webmvcHttp 'Applications.Core/httpRoutes@2023-10-01-preview' existing = name: webmvcHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlIdentityDbName diff --git a/samples/eshop/services/ordering.bicep b/samples/eshop/services/ordering.bicep index 816a51b0..9e5f046a 100644 --- a/samples/eshop/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -221,7 +221,7 @@ resource orderbgtasksHttp 'Applications.Core/httpRoutes@2023-10-01-preview' exis name: orderbgtasksHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisKeystoreName diff --git a/samples/eshop/services/web.bicep b/samples/eshop/services/web.bicep index fad524cc..8edd0613 100644 --- a/samples/eshop/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -29,7 +29,7 @@ param webshoppingaggHttpName string @description('Web shopping API GW HTTP Route name') param webshoppingapigwHttpName string -@description('Name of the Keystore Redis Link name') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string // CONTAINER -------------------------------------------------------------------- @@ -172,7 +172,7 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2023-10-01-preview' name: webshoppingapigwHttpName } -// LINKS ------------------------------------------------------ +// PORTABLE RESOURCES ------------------------------------------------------ resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisKeystoreName diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index e0d6c157..96c5e6bf 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -128,7 +128,7 @@ resource webhooksclientHttp 'Applications.Core/httpRoutes@2023-10-01-preview' ex name: webhooksclientHttpName } -// LINKS ----------------------------------------------------------- +// PORTABLE RESOURCES ----------------------------------------------------------- resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' existing = { name: sqlWebhooksDbName diff --git a/samples/eshop/src/envoy/README.md b/samples/eshop/src/envoy/README.md index d459ed4f..b542a623 100644 --- a/samples/eshop/src/envoy/README.md +++ b/samples/eshop/src/envoy/README.md @@ -1,6 +1,6 @@ # Envoy for eshop -Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. +Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/radius-project/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. From cb8f9121d160dde0a4e7861a5387efd575a412da Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 09:58:39 -0700 Subject: [PATCH 03/26] Fix --- .github/workflows/test.yaml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5c38f6cb..821ac123 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -56,17 +56,19 @@ jobs: runOnPullRequest: true app: eshop env: containers-eshop-env - path: ./samples/eshop/iac/eshop.bicep + path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - name: eshop (Azure) runOnPullRequest: false app: eshop env: azure-eshop-env - path: ./samples/eshop/iac/eshop.bicep + path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: azure enableDapr: false + prerequisities: | + rad deploy ./samples/eshop/environments/azure.bicep - name: eshop (AWS) runOnPullRequest: false app: eshop @@ -75,6 +77,8 @@ jobs: uiTestFile: tests/eshop/eshop.app.spec.ts credential: aws enableDapr: false + prerequisites: | + rad deploy ./samples/eshop/environments/aws.bicep env: BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -221,16 +225,19 @@ jobs: rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi # Deploy application and run tests - - name: Set Radius environment - if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.env != '' + - name: (eShop) create and use environment + if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.app == 'eshop' run: | - rad env switch ${{ matrix.env }} if [[ "${{ matrix.credential }}" == "azure" ]]; then + rad deploy ./samples/eshop/environments/azure.bicep rad env update ${{ matrix.env }} --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} - fi - if [[ "${{ matrix.credential }}" == "aws" ]]; then + elif [[ "${{ matrix.credential }}" == "aws" ]]; then + rad deploy ./samples/eshop/environments/aws.bicep rad env update ${{ matrix.env }} --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} + else + rad deploy ./samples/eshop/environments/containers.bicep fi + rad env switch ${{ matrix.env }} - name: Deploy app if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad deploy ${{ matrix.path }} ${{ matrix.args }} From a46c7a15c60cbad95b6f2b5605207ea28bb1bc36 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 10:08:33 -0700 Subject: [PATCH 04/26] Test --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 821ac123..c2ed4c41 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -225,7 +225,7 @@ jobs: rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi # Deploy application and run tests - - name: (eShop) create and use environment + - name: Create and use eShop environment if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.app == 'eshop' run: | if [[ "${{ matrix.credential }}" == "azure" ]]; then From 9d3ddf87e7953638fdd4b942697875c0c0fe18d7 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 10:51:44 -0700 Subject: [PATCH 05/26] PR --- samples/eshop/infra/infra.bicep | 18 +++++++++--------- samples/eshop/services/basket.bicep | 4 ++-- samples/eshop/services/catalog.bicep | 2 +- samples/eshop/services/identity.bicep | 6 ++---- samples/eshop/services/ordering.bicep | 4 ++-- samples/eshop/services/webhooks.bicep | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep index 5cfc5aac..6adec2e7 100644 --- a/samples/eshop/infra/infra.bicep +++ b/samples/eshop/infra/infra.bicep @@ -21,7 +21,7 @@ param adminPassword string ]) param AZURESERVICEBUSENABLED string -// Portable Resources-------------------------------------------------------------- +// Portable Resource -------------------------------------------------------------- resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' = { name: 'identitydb' @@ -137,28 +137,28 @@ resource servicebus 'Applications.Core/extenders@2023-10-01-preview' = if (AZURE // Outputs ------------------------------------ -@description('The name of the SQL Identity Link') +@description('The name of the SQL Identity portable resource') output sqlIdentityDb string = sqlIdentityDb.name -@description('The name of the SQL Catalog Link') +@description('The name of the SQL Catalog portable resource') output sqlCatalogDb string = sqlCatalogDb.name -@description('The name of the SQL Ordering Link') +@description('The name of the SQL Ordering portable resource') output sqlOrderingDb string = sqlOrderingDb.name -@description('The name of the SQL Webhooks Link') +@description('The name of the SQL Webhooks portable resource') output sqlWebhooksDb string = sqlWebhooksDb.name -@description('The name of the Redis Keystore Link') +@description('The name of the Redis Keystore portable resource') output redisKeystore string = redisKeystore.name -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') output redisBasket string = redisBasket.name -@description('The name of the RabbitMQ Link') +@description('The name of the RabbitMQ portable resource') output rabbitmq string = rabbitmq.name -@description('The name of the Service Bus Link') +@description('The name of the Service Bus portable resource') output servicebus string = servicebus.name @description('Event Bus connection string') diff --git a/samples/eshop/services/basket.bicep b/samples/eshop/services/basket.bicep index dc2ee3e8..416123ff 100644 --- a/samples/eshop/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -20,7 +20,7 @@ param basketHttpName string @description('The name of the Basket gRPC Route') param basketGrpcName string -@description('The name of the Redis Basket Link') +@description('The name of the Redis Basket portable resource') param redisBasketName string @description('The connection string for the event bus') @@ -99,7 +99,7 @@ resource basketGrpc 'Applications.Core/httpRoutes@2023-10-01-preview' existing = name: basketGrpcName } -// Portable Resources----------------------------------------- +// Portable Resource ----------------------------------------- resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' existing = { name: redisBasketName diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep index 4d5f9dad..bacb2d59 100644 --- a/samples/eshop/services/catalog.bicep +++ b/samples/eshop/services/catalog.bicep @@ -17,7 +17,7 @@ param catalogHttpName string @description('The name of the Catalog gRPC Route') param catalogGrpcName string -@description('The name of the Catalog SQL Link') +@description('The name of the Catalog SQL portable resource') param sqlCatalogDbName string @description('The connection string for the event bus') diff --git a/samples/eshop/services/identity.bicep b/samples/eshop/services/identity.bicep index 9533b8e8..e1597362 100644 --- a/samples/eshop/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -32,10 +32,10 @@ param webhooksclientHttpName string @description('Name of the WebMVC HTTP Route') param webmvcHttpName string -@description('Name of the Identity SQL Database Link') +@description('Name of the Identity SQL Database portable resource') param sqlIdentityDbName string -@description('Name of the Keystore Redis Link') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string // CONTAINERS ------------------------------------------------------------------- @@ -54,8 +54,6 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = { OrchestratorType: 'K8S' IsClusterEnv: 'True' DPConnectionString: redisKeystore.connectionString() - ApplicationInsights__InstrumentationKey: '' - XamarinCallback: '' EnableDevspaces: 'False' ConnectionString: sqlIdentityDb.connectionString() MvcClient: '${gateway.properties.url}/${webmvcHttp.properties.hostname}' diff --git a/samples/eshop/services/ordering.bicep b/samples/eshop/services/ordering.bicep index 9e5f046a..1527050e 100644 --- a/samples/eshop/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -32,10 +32,10 @@ param orderingsignalrhubHttpName string @description('Name of the Ordering background tasks HTTP Route') param orderbgtasksHttpName string -@description('Name of the Keystore Redis Link') +@description('Name of the Keystore Redis portable resource') param redisKeystoreName string -@description('Name of the Ordering SQL Link') +@description('Name of the Ordering SQL portable resource') param sqlOrderingDbName string @description('The connection string for the event bus') diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index 96c5e6bf..34ff5d16 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -20,7 +20,7 @@ param webhooksHttpName string @description('Name of the WebhooksClient HTTP Route') param webhooksclientHttpName string -@description('The name of the Webhooks SQL Link') +@description('The name of the Webhooks SQL portable resource') param sqlWebhooksDbName string @description('The connection string for the event bus') From 2627f2b5ecc13fd2cecbc4c81809c72063e0e073 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 13:39:01 -0700 Subject: [PATCH 06/26] oops --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c2ed4c41..c5f3072f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,14 +52,14 @@ jobs: app: myapp path: ./samples/volumes/app.bicep enableDapr: false - - name: eshop (containers) + - name: eshop-containers runOnPullRequest: true app: eshop env: containers-eshop-env path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - - name: eshop (Azure) + - name: eshop-azure runOnPullRequest: false app: eshop env: azure-eshop-env @@ -69,7 +69,7 @@ jobs: enableDapr: false prerequisities: | rad deploy ./samples/eshop/environments/azure.bicep - - name: eshop (AWS) + - name: eshop-aws runOnPullRequest: false app: eshop env: aws-eshop-env From e3905b5978f47adec1a36fb7e867ef8070f80488 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Wed, 11 Oct 2023 15:59:25 -0700 Subject: [PATCH 07/26] Updates --- .github/workflows/test.yaml | 15 +++++++++------ samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/azure.bicep | 2 +- samples/eshop/environments/containers.bicep | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9380d4a2..be515c86 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,6 +36,7 @@ jobs: - name: demo runOnPullRequest: true app: demo + env: default path: ./samples/demo/app.bicep args: --application demo uiTestFile: tests/demo/demo.app.spec.ts @@ -45,24 +46,26 @@ jobs: - name: dapr runOnPullRequest: true app: dapr + env: default path: ./samples/dapr/dapr.bicep enableDapr: true - name: volumes runOnPullRequest: true app: myapp + env: default path: ./samples/volumes/app.bicep enableDapr: false - name: eshop-containers runOnPullRequest: true app: eshop - env: containers-eshop-env + env: containers-eshop path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - name: eshop-azure runOnPullRequest: false app: eshop - env: azure-eshop-env + env: azure-eshop path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: azure @@ -72,7 +75,7 @@ jobs: - name: eshop-aws runOnPullRequest: false app: eshop - env: aws-eshop-env + env: aws-eshop path: ./samples/eshop/iac/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: aws @@ -251,7 +254,7 @@ jobs: - name: Wait for all pods to be ready if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - namespace="default-${{ matrix.app }}" + namespace="${{ matrix.env }}-${{ matrix.app }}" label="radapp.io/application=${{ matrix.app }}" kubectl wait --for=condition=Ready pod -l $label -n $namespace --timeout=5m - name: Run Playwright Test @@ -285,7 +288,7 @@ jobs: # Create pod-logs directory mkdir -p playwright/pod-logs/${{ matrix.name }} # Get pod logs and save to file - namespace="default-${{ matrix.app }}" + namespace="${{ matrix.env }}-${{ matrix.app }}" label="radius.dev/application=${{ matrix.app }}" pod_names=($(kubectl get pods -l $label -n $namespace -o jsonpath='{.items[*].metadata.name}')) for pod_name in "${pod_names[@]}"; do @@ -309,7 +312,7 @@ jobs: - name: Delete app if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - rad app delete ${{ matrix.app }} -y + rad app delete ${{ matrix.app }} -y - name: Delete Azure resource group if: always() && steps.gen-id.outputs.RUN_TEST == 'true' && steps.create-azure-resource-group.outcome == 'success' run: | diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index f89d7f8a..d947e53d 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -10,7 +10,7 @@ param awsRegion string param eksClusterName string resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'aws-eshop-env' + name: 'aws-eshop' properties: { compute: { kind: 'kubernetes' diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index a78eedc3..d2150dac 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -7,7 +7,7 @@ param azureResourceGroup string = resourceGroup().name param azureSubscription string = subscription().subscriptionId resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'azure-eshop-env' + name: 'azure-eshop' properties: { compute: { kind: 'kubernetes' diff --git a/samples/eshop/environments/containers.bicep b/samples/eshop/environments/containers.bicep index ae6bb238..8b537814 100644 --- a/samples/eshop/environments/containers.bicep +++ b/samples/eshop/environments/containers.bicep @@ -1,7 +1,7 @@ import radius as rad resource containersEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'containers-eshop-env' + name: 'containers-eshop' properties: { compute: { kind: 'kubernetes' From 2abeac28498a9c63f11aaf3246150e27e81adb18 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 12:33:18 -0700 Subject: [PATCH 08/26] PR --- .github/workflows/test.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index be515c86..ad260b06 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -70,18 +70,14 @@ jobs: uiTestFile: tests/eshop/eshop.app.spec.ts credential: azure enableDapr: false - prerequisities: | - rad deploy ./samples/eshop/environments/azure.bicep - name: eshop-aws runOnPullRequest: false app: eshop env: aws-eshop path: ./samples/eshop/iac/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts - credential: aws + credential: aws= enableDapr: false - prerequisites: | - rad deploy ./samples/eshop/environments/aws.bicep env: BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 127c20d962f1c100bc23e177e2c1d5e25d2c7c30 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 12:34:18 -0700 Subject: [PATCH 09/26] PR --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ad260b06..af8ec691 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -76,7 +76,7 @@ jobs: env: aws-eshop path: ./samples/eshop/iac/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts - credential: aws= + credential: aws enableDapr: false env: BRANCH: ${{ github.base_ref || github.ref_name }} From 87079359dd33fcf72f4205169aead6aa802b1697 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 12:44:22 -0700 Subject: [PATCH 10/26] PR --- .github/workflows/test.yaml | 1 + samples/eshop/README.md | 5 ++++- samples/eshop/environments/azure.bicep | 6 ------ samples/eshop/eshop.bicep | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index af8ec691..a6a758ca 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -60,6 +60,7 @@ jobs: app: eshop env: containers-eshop path: ./samples/eshop/eshop.bicep + args: -p adminLogin=sa uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - name: eshop-azure diff --git a/samples/eshop/README.md b/samples/eshop/README.md index 01a7b302..c3cc50c3 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -47,5 +47,8 @@ This reference app is a "radified" version of the [eShop on containers](https:// ``` 1. Deploy the application: ```bash - rad deploy eshop.bicep -p adminLogin= or SA -p adminPassword= + rad deploy eshop.bicep + + # Containers (requires SQL admin username to be "SA" + rad deploy eshop.bicep -p adminLogin=sa ``` diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index d2150dac..cbb03d37 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -32,12 +32,6 @@ resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' } } - 'Applications.Messaging/rabbitMQQueues': { - rabbitmqmessagequeue: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' - } - } 'Applications.Core/extenders': { servicebus: { templateKind: 'bicep' diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep index c363bc61..4acebb86 100644 --- a/samples/eshop/eshop.bicep +++ b/samples/eshop/eshop.bicep @@ -9,7 +9,7 @@ param applicationName string = 'eshop' param environment string @description('SQL administrator username') -param adminLogin string = 'SA' +param adminLogin string = 'sqladmin' @description('SQL administrator password') @secure() From e39b8d643fc9f4f58f91478f2a0960053519f745 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 15:13:12 -0700 Subject: [PATCH 11/26] PR comments --- samples/eshop/README.md | 3 -- samples/eshop/environments/aws.bicep | 8 ++-- samples/eshop/environments/azure.bicep | 6 +-- samples/eshop/environments/containers.bicep | 6 +-- samples/eshop/eshop.bicep | 16 ++----- samples/eshop/infra/infra.bicep | 49 --------------------- 6 files changed, 13 insertions(+), 75 deletions(-) diff --git a/samples/eshop/README.md b/samples/eshop/README.md index c3cc50c3..0422aa2d 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -48,7 +48,4 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. Deploy the application: ```bash rad deploy eshop.bicep - - # Containers (requires SQL admin username to be "SA" - rad deploy eshop.bicep -p adminLogin=sa ``` diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index d947e53d..5bc8631c 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -24,16 +24,16 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { } recipes: { 'Applications.Datastores/sqlDatabases': { - sqldatabase: { + default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/aws/sqldatabases:edge' + templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-35' parameters: { eksClusterName: eksClusterName } } } 'Applications.Datastores/redisCaches': { - rediscache: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/aws/rediscaches:edge' parameters: { @@ -44,7 +44,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { // Use containerized RabbitMQ instead of Amazon SQS // https://github.com/radius-project/bicep-types-aws/blob/main/docs/reference/limitations.md 'Applications.Messaging/rabbitMQQueues': { - rabbitmqmessagequeue: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' } diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index cbb03d37..8977b5cb 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -21,13 +21,13 @@ resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { } recipes: { 'Applications.Datastores/sqlDatabases': { - sqldatabase: { + default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:latest' + templatePath: 'radiusdev.azurecr.io/recipes/azure/sqldatabases:pr-35' } } 'Applications.Datastores/redisCaches': { - rediscache: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' } diff --git a/samples/eshop/environments/containers.bicep b/samples/eshop/environments/containers.bicep index 8b537814..7841eb63 100644 --- a/samples/eshop/environments/containers.bicep +++ b/samples/eshop/environments/containers.bicep @@ -10,19 +10,19 @@ resource containersEShopEnv 'Applications.Core/environments@2023-10-01-preview' } recipes: { 'Applications.Datastores/sqlDatabases': { - sqldatabase: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/local-dev/sqldatabases:edge' } } 'Applications.Datastores/redisCaches': { - rediscache: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/local-dev/rediscaches:edge' } } 'Applications.Messaging/rabbitMQQueues': { - rabbitmqmessagequeue: { + default: { templateKind: 'bicep' templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' } diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep index 4acebb86..1b86f0f5 100644 --- a/samples/eshop/eshop.bicep +++ b/samples/eshop/eshop.bicep @@ -2,23 +2,15 @@ import radius as rad // Parameters ------------------------------------------------------- -@description('Name of the application. Defaults to "eshop"') -param applicationName string = 'eshop' - @description('Radius environment ID. Set automatically by Radius') param environment string -@description('SQL administrator username') -param adminLogin string = 'sqladmin' - -@description('SQL administrator password') -@secure() -param adminPassword string = newGuid() +@description('Container image tag to use for eshop images. Defaults to "linux-dotnet7".') +param TAG string = 'linux-dotnet7' // Variables --------------------------------------------------------- -@description('Container image tag to use for eshop images') -var TAG = 'linux-dotnet7' +var applicationName = 'eshop' // Get the environment name from the environment ID var environmentName = last(split(environment, '/')) @@ -46,8 +38,6 @@ module infra 'infra/infra.bicep' = { params: { application: eshopApplication.id environment: environment - adminLogin: adminLogin - adminPassword: adminPassword AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED } } diff --git a/samples/eshop/infra/infra.bicep b/samples/eshop/infra/infra.bicep index 6adec2e7..f16d492e 100644 --- a/samples/eshop/infra/infra.bicep +++ b/samples/eshop/infra/infra.bicep @@ -6,14 +6,6 @@ param environment string @description('Radius application ID') param application string -@description('SQL administrator username') -@secure() -param adminLogin string - -@description('SQL administrator password') -@secure() -param adminPassword string - @description('Use Azure Service Bus for messaging. Allowed values: "True", "False".') @allowed([ 'True' @@ -28,14 +20,6 @@ resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' properties: { application: application environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'IdentityDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } } } @@ -44,14 +28,6 @@ resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' properties: { application: application environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'CatalogDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } } } @@ -60,14 +36,6 @@ resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' properties: { application: application environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'OrderingDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } } } @@ -76,14 +44,6 @@ resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2023-10-01-preview' properties: { application: application environment: environment - recipe: { - name: 'sqldatabase' - parameters: { - database: 'WebhooksDb' - adminLogin: adminLogin - adminPassword: adminPassword - } - } } } @@ -92,9 +52,6 @@ resource redisKeystore 'Applications.Datastores/redisCaches@2023-10-01-preview' properties: { application: application environment: environment - recipe: { - name: 'rediscache' - } } } @@ -103,9 +60,6 @@ resource redisBasket 'Applications.Datastores/redisCaches@2023-10-01-preview' = properties: { application: application environment: environment - recipe: { - name: 'rediscache' - } } } @@ -114,9 +68,6 @@ resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2023-10-01-preview' = i properties: { application: application environment: environment - recipe: { - name: 'rabbitmqmessagequeue' - } } } From 6443a8dabcc93360bec0b2a269927710fa9aab84 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 15:13:46 -0700 Subject: [PATCH 12/26] PR comments --- .github/workflows/test.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a6a758ca..a0394916 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -60,11 +60,10 @@ jobs: app: eshop env: containers-eshop path: ./samples/eshop/eshop.bicep - args: -p adminLogin=sa uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - name: eshop-azure - runOnPullRequest: false + runOnPullRequest: true #false app: eshop env: azure-eshop path: ./samples/eshop/eshop.bicep @@ -72,7 +71,7 @@ jobs: credential: azure enableDapr: false - name: eshop-aws - runOnPullRequest: false + runOnPullRequest: true #false app: eshop env: aws-eshop path: ./samples/eshop/iac/eshop.bicep From a97dc9ada738ccf4129922d5ef7c234bfc375e7e Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 15:53:38 -0700 Subject: [PATCH 13/26] fixing --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a0394916..4600d799 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -235,10 +235,10 @@ jobs: if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.app == 'eshop' run: | if [[ "${{ matrix.credential }}" == "azure" ]]; then - rad deploy ./samples/eshop/environments/azure.bicep + rad deploy ./samples/eshop/environments/azure.bicep -p azureResourceGroup=${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} -p azureSubscription=${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} rad env update ${{ matrix.env }} --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} elif [[ "${{ matrix.credential }}" == "aws" ]]; then - rad deploy ./samples/eshop/environments/aws.bicep + rad deploy ./samples/eshop/environments/aws.bicep -p awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} -p awsRegion=${{ env.AWS_REGION }} rad env update ${{ matrix.env }} --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} else rad deploy ./samples/eshop/environments/containers.bicep From dedd399465e743c0090368571b7f936074fbc202 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 16:19:23 -0700 Subject: [PATCH 14/26] again --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4600d799..8c3e8450 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -238,7 +238,7 @@ jobs: rad deploy ./samples/eshop/environments/azure.bicep -p azureResourceGroup=${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} -p azureSubscription=${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} rad env update ${{ matrix.env }} --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} elif [[ "${{ matrix.credential }}" == "aws" ]]; then - rad deploy ./samples/eshop/environments/aws.bicep -p awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} -p awsRegion=${{ env.AWS_REGION }} + rad deploy ./samples/eshop/environments/aws.bicep -p awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} -p awsRegion=${{ env.AWS_REGION }} -p eksClusterName=${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} rad env update ${{ matrix.env }} --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} else rad deploy ./samples/eshop/environments/containers.bicep From aff080097c58d0586d8a531bd3c0b6b4b600b11e Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Thu, 12 Oct 2023 17:34:42 -0700 Subject: [PATCH 15/26] fix --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8c3e8450..fe8573d8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -74,7 +74,7 @@ jobs: runOnPullRequest: true #false app: eshop env: aws-eshop - path: ./samples/eshop/iac/eshop.bicep + path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: aws enableDapr: false From e5ec4184f5b92f81141365dcf73dda9b77daac30 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Fri, 13 Oct 2023 10:37:54 -0700 Subject: [PATCH 16/26] rewind From b07866c3735322aaace26730fb4cb3193c912b7a Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Fri, 13 Oct 2023 14:41:24 -0700 Subject: [PATCH 17/26] PR --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fe8573d8..4c0bec41 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -63,7 +63,7 @@ jobs: uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false - name: eshop-azure - runOnPullRequest: true #false + runOnPullRequest: false app: eshop env: azure-eshop path: ./samples/eshop/eshop.bicep @@ -71,7 +71,7 @@ jobs: credential: azure enableDapr: false - name: eshop-aws - runOnPullRequest: true #false + runOnPullRequest: false app: eshop env: aws-eshop path: ./samples/eshop/eshop.bicep From 8b00637328ff52ce910531c5b514a05d3abded20 Mon Sep 17 00:00:00 2001 From: willdavsmith Date: Fri, 13 Oct 2023 14:41:55 -0700 Subject: [PATCH 18/26] PR --- samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/azure.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 5bc8631c..ab033287 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -26,7 +26,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/sqlDatabases': { default: { templateKind: 'bicep' - templatePath: 'radiusdev.azurecr.io/recipes/aws/sqldatabases:pr-35' + templatePath: 'radius.azurecr.io/recipes/aws/sqldatabases:edge' parameters: { eksClusterName: eksClusterName } diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index 8977b5cb..f682162b 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -23,7 +23,7 @@ resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/sqlDatabases': { default: { templateKind: 'bicep' - templatePath: 'radiusdev.azurecr.io/recipes/azure/sqldatabases:pr-35' + templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:edge' } } 'Applications.Datastores/redisCaches': { From 69dfcc117b18847e40620dbcb59e49dcfb0c4fbe Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 15:15:57 -0800 Subject: [PATCH 19/26] Simplify env registration Signed-off-by: Aaron Crawfis --- samples/eshop/README.md | 51 +++++++++++---------- samples/eshop/environments/aws.bicep | 10 ++-- samples/eshop/environments/azure.bicep | 20 ++++---- samples/eshop/environments/containers.bicep | 32 ------------- 4 files changed, 42 insertions(+), 71 deletions(-) delete mode 100644 samples/eshop/environments/containers.bicep diff --git a/samples/eshop/README.md b/samples/eshop/README.md index 651cf2b8..42cb4521 100644 --- a/samples/eshop/README.md +++ b/samples/eshop/README.md @@ -9,43 +9,46 @@ This reference app is a "radified" version of the [eShop on containers](https:// 1. Have a kubernetes cluster handy from the [supported clusters](https://docs.radapp.io/guides/operations/kubernetes/overview/#supported-kubernetes-clusters). - (AWS only) Make sure that each of the Subnets in your EKS cluster Subnet Group are within the list of [supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html) 1. [Install the rad CLI](https://docs.radapp.io/getting-started/) -1. [Initialize a new Radius environment](https://docs.radapp.io/getting-started/) +1. Install Radius: + ```bash + rad install kubernetes + ``` +1. Set provider credentials to authenticate to your cloud provider (choose which type of hosting infrastructure you wish to use): + ```bash + # AWS + rad credential register aws --aws-access-key-id --aws-secret-access-key + + # Azure + rad credential register azure --client-id --client-secret --tenant-id + ``` 1. Clone the repository and switch to the app directory: ```bash git clone https://github.com/radius-project/samples.git cd samples/reference-apps/eshop ``` -1. Deploy the environment (choose which type of hosting infrastructure you wish to use): +1. Deploy an environment with the proper Recipes (choose which type of hosting infrastructure you wish to use): ```bash - # Containers - rad deploy environments/containers.bicep + # Containers - simply initialize a new local-dev environment + rad init - # Azure - rad deploy environments/azure.bicep + # Azure + rad deploy environments/azure.bicep -p azureSubscriptionId= -p azureResourceGroup= - # AWS - rad deploy environments/aws.bicep -p awsAccountId= -p awsRegion= -p eksClusterName= + # AWS + rad deploy environments/aws.bicep -p awsAccountId= -p awsRegion= -p eksClusterName= ``` 1. Switch to your new environment (choose which type of hosting infrastructure you wish to use): ```bash - # Containers - rad env switch containers-eshop-env + # Containers + rad env switch default - # Azure - rad env switch azure-eshop-env + # Azure + rad env switch azure - # AWS - rad env switch aws-eshop-env + # AWS + rad env switch aws ``` -1. Set credentials: +1. Deploy the application: ```bash - # AWS - rad credential register aws --aws-access-key-id --aws-secret-access-key - - # Azure - rad credential register azure --client-id --client-secret --tenant-id + rad deploy eshop.bicep ``` -1. Deploy the application: - ```bash - rad deploy eshop.bicep - ``` diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index ab033287..64cdb9d1 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -9,8 +9,8 @@ param awsRegion string @description('Name of your EKS cluster') param eksClusterName string -resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'aws-eshop' +resource environment 'Applications.Core/environments@2023-10-01-preview' = { + name: 'aws' properties: { compute: { kind: 'kubernetes' @@ -26,7 +26,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/sqlDatabases': { default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/aws/sqldatabases:edge' + templatePath: 'ghcr.io/radius-project/recipes/aws/sqldatabases:latest' parameters: { eksClusterName: eksClusterName } @@ -35,7 +35,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Datastores/redisCaches': { default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/aws/rediscaches:edge' + templatePath: 'ghcr.io/radius-project/recipes/aws/rediscaches:latest' parameters: { eksClusterName: eksClusterName } @@ -46,7 +46,7 @@ resource awsEshopEnv 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Messaging/rabbitMQQueues': { default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' + templatePath: 'ghcr.io/radius-project/recipes/local-dev/rabbitmqmessagequeues:latest' } } } diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index f682162b..5803f90d 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -1,13 +1,13 @@ import radius as rad -@description('Azure ResourceGroup name') -param azureResourceGroup string = resourceGroup().name +@description('The name of the Azure resource group where Azure resources will be deployed.') +param azureResourceGroup string -@description('Azure SubscriptionId') -param azureSubscription string = subscription().subscriptionId +@description('The Azure subscription ID where Azure resources will be deployed.') +param azureSubscriptionId string -resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'azure-eshop' +resource environment 'Applications.Core/environments@2023-10-01-preview' = { + name: 'azure' properties: { compute: { kind: 'kubernetes' @@ -16,26 +16,26 @@ resource azureEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { } providers: { azure: { - scope: '/subscriptions/${azureSubscription}/resourceGroups/${azureResourceGroup}' + scope: '/subscriptions/${azureSubscriptionId}/resourceGroups/${azureResourceGroup}' } } recipes: { 'Applications.Datastores/sqlDatabases': { default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/sqldatabases:edge' + templatePath: 'ghcr.io/radius-project/recipes/azure/sqldatabases:latest' } } 'Applications.Datastores/redisCaches': { default: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/rediscaches:latest' + templatePath: 'ghcr.io/radius-project/recipes/azure/rediscaches:latest' } } 'Applications.Core/extenders': { servicebus: { templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/azure/extender-servicebus:latest' + templatePath: 'ghcr.io/radius-project/recipes/azure/extender-servicebus:latest' } } } diff --git a/samples/eshop/environments/containers.bicep b/samples/eshop/environments/containers.bicep deleted file mode 100644 index 7841eb63..00000000 --- a/samples/eshop/environments/containers.bicep +++ /dev/null @@ -1,32 +0,0 @@ -import radius as rad - -resource containersEShopEnv 'Applications.Core/environments@2023-10-01-preview' = { - name: 'containers-eshop' - properties: { - compute: { - kind: 'kubernetes' - resourceId: 'self' - namespace: 'containers-eshop' - } - recipes: { - 'Applications.Datastores/sqlDatabases': { - default: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/sqldatabases:edge' - } - } - 'Applications.Datastores/redisCaches': { - default: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rediscaches:edge' - } - } - 'Applications.Messaging/rabbitMQQueues': { - default: { - templateKind: 'bicep' - templatePath: 'radius.azurecr.io/recipes/local-dev/rabbitmqmessagequeues:edge' - } - } - } - } -} From dba4ebbad85e203c298aaa3408c929ff912b15b8 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 15:16:42 -0800 Subject: [PATCH 20/26] Make registry a parameter Signed-off-by: Aaron Crawfis --- samples/eshop/eshop.bicep | 38 +++++++++++++++--------- samples/eshop/services/basket.bicep | 7 +++-- samples/eshop/services/catalog.bicep | 7 +++-- samples/eshop/services/identity.bicep | 7 +++-- samples/eshop/services/ordering.bicep | 11 ++++--- samples/eshop/services/payment.bicep | 7 +++-- samples/eshop/services/web.bicep | 9 ++++-- samples/eshop/services/webhooks.bicep | 9 ++++-- samples/eshop/services/webshopping.bicep | 9 ++++-- samples/eshop/services/webstatus.bicep | 7 +++-- 10 files changed, 74 insertions(+), 37 deletions(-) diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep index 1b86f0f5..f59a8dd7 100644 --- a/samples/eshop/eshop.bicep +++ b/samples/eshop/eshop.bicep @@ -5,27 +5,28 @@ import radius as rad @description('Radius environment ID. Set automatically by Radius') param environment string +@description('Container registry to pull from, with optional path. Defaults to "ghcr.io/radius-project/samples/eshop"') +param imageRegistry string = 'ghcr.io/radius-project/samples/eshop' + @description('Container image tag to use for eshop images. Defaults to "linux-dotnet7".') -param TAG string = 'linux-dotnet7' +param imageTag string = 'linux-dotnet7' // Variables --------------------------------------------------------- -var applicationName = 'eshop' - // Get the environment name from the environment ID var environmentName = last(split(environment, '/')) resource eshopEnvironment 'Applications.Core/environments@2023-10-01-preview' existing = { name: environmentName } -// Check if the environment has the rabbitmqqueues recipe enabled +// Check if the environment has the rabbitmqqueues recipe registered // If it does not, use Azure ServiceBus var AZURESERVICEBUSENABLED = contains(eshopEnvironment.properties.recipes, 'Applications.Messaging/rabbitmqqueues') ? 'False' : 'True' // Application -------------------------------------------------------- resource eshopApplication 'Applications.Core/applications@2023-10-01-preview' = { - name: applicationName + name: 'eshop' properties: { environment: environment } @@ -57,7 +58,8 @@ module basket 'services/basket.bicep' = { name: 'basket' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp basketHttpName: networking.outputs.basketHttp @@ -72,7 +74,8 @@ module catalog 'services/catalog.bicep' = { name: 'catalog' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag catalogGrpcName: networking.outputs.catalogGrpc catalogHttpName: networking.outputs.catalogHttp gatewayName: networking.outputs.gateway @@ -86,7 +89,8 @@ module identity 'services/identity.bicep' = { name: 'identity' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag basketHttpName: networking.outputs.basketHttp gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp @@ -104,7 +108,8 @@ module ordering 'services/ordering.bicep' = { name: 'ordering' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag basketHttpName: networking.outputs.basketHttp catalogHttpName: networking.outputs.catalogHttp gatewayName: networking.outputs.gateway @@ -124,7 +129,8 @@ module payment 'services/payment.bicep' = { name: 'payment' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag paymentHttpName: networking.outputs.paymentHttp eventBusConnectionString: infra.outputs.eventBusConnectionString AZURESERVICEBUSENABLED: AZURESERVICEBUSENABLED @@ -143,7 +149,8 @@ module web 'services/web.bicep' = { name: 'web' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp orderingsignalrhubHttpName: networking.outputs.orderingsignalrhubHttp @@ -159,7 +166,8 @@ module webhooks 'services/webhooks.bicep' = { name: 'webhooks' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag gatewayName: networking.outputs.gateway identityHttpName: networking.outputs.identityHttp sqlWebhooksDbName: infra.outputs.sqlWebhooksDb @@ -174,7 +182,8 @@ module webshopping 'services/webshopping.bicep' = { name: 'webshopping' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag basketGrpcName: networking.outputs.basketGrpc basketHttpName: networking.outputs.basketHttp catalogGrpcName: networking.outputs.catalogGrpc @@ -194,7 +203,8 @@ module webstatus 'services/webstatus.bicep' = { name: 'webstatus' params: { application: eshopApplication.id - TAG: TAG + imageRegistry: imageRegistry + imageTag: imageTag basketHttpName: networking.outputs.basketHttp catalogHttpName: networking.outputs.catalogHttp identityHttpName: networking.outputs.identityHttp diff --git a/samples/eshop/services/basket.bicep b/samples/eshop/services/basket.bicep index ee2f8129..5e84e381 100644 --- a/samples/eshop/services/basket.bicep +++ b/samples/eshop/services/basket.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('The name of the Radius Gateway') param gatewayName string @@ -42,7 +45,7 @@ resource basket 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/basket.api:${TAG}' + image: '${imageRegistry}/basket.api:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' diff --git a/samples/eshop/services/catalog.bicep b/samples/eshop/services/catalog.bicep index aea0bd04..6a5cefb7 100644 --- a/samples/eshop/services/catalog.bicep +++ b/samples/eshop/services/catalog.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -43,7 +46,7 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/catalog.api:${TAG}' + image: '${imageRegistry}/catalog.api:${imageTag}' env: { UseCustomizationData: 'False' PATH_BASE: '/catalog-api' diff --git a/samples/eshop/services/identity.bicep b/samples/eshop/services/identity.bicep index faf38896..ecf0bae4 100644 --- a/samples/eshop/services/identity.bicep +++ b/samples/eshop/services/identity.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -46,7 +49,7 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/identity.api:${TAG}' + image: '${imageRegistry}/identity.api:${imageTag}' env: { PATH_BASE: '/identity-api' ASPNETCORE_ENVIRONMENT: 'Development' diff --git a/samples/eshop/services/ordering.bicep b/samples/eshop/services/ordering.bicep index 9e539f29..e4483f7a 100644 --- a/samples/eshop/services/ordering.bicep +++ b/samples/eshop/services/ordering.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -57,7 +60,7 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/ordering.api:${TAG}' + image: '${imageRegistry}/ordering.api:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' @@ -106,7 +109,7 @@ resource orderbgtasks 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/ordering.backgroundtasks:${TAG}' + image: '${imageRegistry}/ordering.backgroundtasks:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' @@ -142,7 +145,7 @@ resource orderingsignalrhub 'Applications.Core/containers@2023-10-01-preview' = properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/ordering.signalrhub:${TAG}' + image: '${imageRegistry}/ordering.signalrhub:${imageTag}' env: { PATH_BASE: '/payment-api' ASPNETCORE_ENVIRONMENT: 'Development' diff --git a/samples/eshop/services/payment.bicep b/samples/eshop/services/payment.bicep index ec5672d6..7523a461 100644 --- a/samples/eshop/services/payment.bicep +++ b/samples/eshop/services/payment.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Payment HTTP route') param paymentHttpName string @@ -30,7 +33,7 @@ resource payment 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/payment.api:${TAG}' + image: '${imageRegistry}/payment.api:${imageTag}' env: { 'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': 'Verbose' 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' diff --git a/samples/eshop/services/web.bicep b/samples/eshop/services/web.bicep index 76357dd3..9717bb3a 100644 --- a/samples/eshop/services/web.bicep +++ b/samples/eshop/services/web.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -40,7 +43,7 @@ resource webspa 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webspa:${TAG}' + image: '${imageRegistry}/webspa:${imageTag}' env: { PATH_BASE: '/' ASPNETCORE_ENVIRONMENT: 'Production' @@ -93,7 +96,7 @@ resource webmvc 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webmvc:${TAG}' + image: '${imageRegistry}/webmvc:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' diff --git a/samples/eshop/services/webhooks.bicep b/samples/eshop/services/webhooks.bicep index adc0eef8..6d3a894f 100644 --- a/samples/eshop/services/webhooks.bicep +++ b/samples/eshop/services/webhooks.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -42,7 +45,7 @@ resource webhooks 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webhooks.api:${TAG}' + image: '${imageRegistry}/webhooks.api:${imageTag}' env: { PATH_BASE: '/webhooks-api' ASPNETCORE_ENVIRONMENT: 'Development' @@ -81,7 +84,7 @@ resource webhooksclient 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webhooks.client:${TAG}' + image: '${imageRegistry}/webhooks.client:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Production' ASPNETCORE_URLS: 'http://0.0.0.0:80' diff --git a/samples/eshop/services/webshopping.bicep b/samples/eshop/services/webshopping.bicep index c0929a15..143edd08 100644 --- a/samples/eshop/services/webshopping.bicep +++ b/samples/eshop/services/webshopping.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Name of the Gateway') param gatewayName string @@ -50,7 +53,7 @@ resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webshoppingagg:${TAG}' + image: '${imageRegistry}/webshoppingagg:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' PATH_BASE: '/webshoppingagg' @@ -106,7 +109,7 @@ resource webshoppingapigw 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/envoy:latest' + image: '${imageRegistry}/envoy:latest' ports: { http: { containerPort: 80 diff --git a/samples/eshop/services/webstatus.bicep b/samples/eshop/services/webstatus.bicep index 831f8547..2b230f04 100644 --- a/samples/eshop/services/webstatus.bicep +++ b/samples/eshop/services/webstatus.bicep @@ -5,8 +5,11 @@ import radius as rad @description('Radius application ID') param application string +@description('Container registry to pull from, with optional path.') +param imageRegistry string + @description('Container image tag to use for eshop images') -param TAG string +param imageTag string @description('Basket Http Route name') param basketHttpName string @@ -49,7 +52,7 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = { properties: { application: application container: { - image: 'ghcr.io/radius-project/samples/eshop/webstatus:${TAG}' + image: '${imageRegistry}/webstatus:${imageTag}' env: { ASPNETCORE_ENVIRONMENT: 'Development' ASPNETCORE_URLS: 'http://0.0.0.0:80' From 8f7d4a0a9e5e290e7b591b31d58049afe84bf252 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 15:30:32 -0800 Subject: [PATCH 21/26] Update test Signed-off-by: Aaron Crawfis --- .github/workflows/test.yaml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9d866c3c..9ba9e50d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -57,7 +57,7 @@ jobs: - name: eshop-containers runOnPullRequest: true app: eshop - env: containers-eshop + env: default path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts enableDapr: false @@ -187,7 +187,7 @@ jobs: RADIUS_VERSION=edge fi ./.github/scripts/install-radius.sh $RADIUS_VERSION - - name: Initialize local environment + - name: Initialize default environment if: steps.gen-id.outputs.RUN_TEST == 'true' run: | if [[ "${{ matrix.credential }}" == "aws" ]]; then @@ -202,6 +202,11 @@ jobs: rad env switch default rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest --resource-type Applications.Datastores/sqlDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest --resource-type Applications.Messaging/rabbitMQQueues + - name: Configure cloud credentials + if: steps.gen-id.outputs.RUN_TEST == 'true' && ( matrix.credential == 'azure' || matrix.credential == 'aws') + run: | if [[ "${{ matrix.credential }}" == "azure" ]]; then rad env update default --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} rad credential register azure --client-id ${{ secrets.AZURE_SP_TESTS_APPID }} --client-secret ${{ secrets.AZURE_SP_TESTS_PASSWORD }} --tenant-id ${{ secrets.AZURE_SP_TESTS_TENANTID }} @@ -210,20 +215,17 @@ jobs: rad env update default --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} fi - # Deploy application and run tests - - name: Create and use eShop environment + ## This step is temporary until we have Recipe Packs for Azure & AWS and update the eShop sample + - name: Initialize eShop environments if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.app == 'eshop' run: | if [[ "${{ matrix.credential }}" == "azure" ]]; then - rad deploy ./samples/eshop/environments/azure.bicep -p azureResourceGroup=${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} -p azureSubscription=${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} - rad env update ${{ matrix.env }} --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} + rad deploy ./samples/eshop/environments/azure.bicep -p azureResourceGroup=${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} -p azureSubscriptionId=${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} elif [[ "${{ matrix.credential }}" == "aws" ]]; then rad deploy ./samples/eshop/environments/aws.bicep -p awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} -p awsRegion=${{ env.AWS_REGION }} -p eksClusterName=${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }} - rad env update ${{ matrix.env }} --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }} - else - rad deploy ./samples/eshop/environments/containers.bicep fi rad env switch ${{ matrix.env }} + # Deploy application and run tests - name: Deploy app if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad deploy ${{ matrix.path }} ${{ matrix.args }} From 08e1ce197bc9d92aafc7b0ab7841e4f4ea8b2e02 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 15:41:23 -0800 Subject: [PATCH 22/26] Update namespaces Signed-off-by: Aaron Crawfis --- samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/azure.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 64cdb9d1..5aebed6a 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -15,7 +15,7 @@ resource environment 'Applications.Core/environments@2023-10-01-preview' = { compute: { kind: 'kubernetes' resourceId: 'self' - namespace: 'aws-eshop' + namespace: 'default' } providers: { aws: { diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index 5803f90d..36819c83 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -12,7 +12,7 @@ resource environment 'Applications.Core/environments@2023-10-01-preview' = { compute: { kind: 'kubernetes' resourceId: 'self' - namespace: 'azure-eshop' + namespace: 'default' } providers: { azure: { From c8480ae416ddcf743e5f4edd421475a73a86d97d Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 16:04:38 -0800 Subject: [PATCH 23/26] Fix tag Signed-off-by: Aaron Crawfis --- samples/eshop/eshop.bicep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/eshop/eshop.bicep b/samples/eshop/eshop.bicep index f59a8dd7..3492f7a4 100644 --- a/samples/eshop/eshop.bicep +++ b/samples/eshop/eshop.bicep @@ -8,8 +8,8 @@ param environment string @description('Container registry to pull from, with optional path. Defaults to "ghcr.io/radius-project/samples/eshop"') param imageRegistry string = 'ghcr.io/radius-project/samples/eshop' -@description('Container image tag to use for eshop images. Defaults to "linux-dotnet7".') -param imageTag string = 'linux-dotnet7' +@description('Container image tag to use for eshop images. Defaults to "latest".') +param imageTag string = 'latest' // Variables --------------------------------------------------------- From 10dccb65d4c1abc0cd8991703843691bbf783efb Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 16:15:00 -0800 Subject: [PATCH 24/26] Update env names Signed-off-by: Aaron Crawfis --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b958c603..65a90fa9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -64,7 +64,7 @@ jobs: - name: eshop-azure runOnPullRequest: false app: eshop - env: azure-eshop + env: azure path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: azure @@ -72,7 +72,7 @@ jobs: - name: eshop-aws runOnPullRequest: false app: eshop - env: aws-eshop + env: aws path: ./samples/eshop/eshop.bicep uiTestFile: tests/eshop/eshop.app.spec.ts credential: aws From dbdadf50213fca39d9a8b56a1dfb26d13bfa3ff0 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Wed, 8 Nov 2023 16:37:09 -0800 Subject: [PATCH 25/26] Fix namespaces Signed-off-by: Aaron Crawfis --- samples/eshop/environments/aws.bicep | 2 +- samples/eshop/environments/azure.bicep | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 5aebed6a..47a4bbdb 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -15,7 +15,7 @@ resource environment 'Applications.Core/environments@2023-10-01-preview' = { compute: { kind: 'kubernetes' resourceId: 'self' - namespace: 'default' + namespace: 'aws' } providers: { aws: { diff --git a/samples/eshop/environments/azure.bicep b/samples/eshop/environments/azure.bicep index 36819c83..a796cd24 100644 --- a/samples/eshop/environments/azure.bicep +++ b/samples/eshop/environments/azure.bicep @@ -12,7 +12,7 @@ resource environment 'Applications.Core/environments@2023-10-01-preview' = { compute: { kind: 'kubernetes' resourceId: 'self' - namespace: 'default' + namespace: 'azure' } providers: { azure: { From e1af6b2cf318ef7b4a2a00fc3f383d962e470f63 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Thu, 9 Nov 2023 12:00:17 -0800 Subject: [PATCH 26/26] Fix recipe Signed-off-by: Aaron Crawfis --- samples/eshop/environments/aws.bicep | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/eshop/environments/aws.bicep b/samples/eshop/environments/aws.bicep index 47a4bbdb..3b492689 100644 --- a/samples/eshop/environments/aws.bicep +++ b/samples/eshop/environments/aws.bicep @@ -46,7 +46,7 @@ resource environment 'Applications.Core/environments@2023-10-01-preview' = { 'Applications.Messaging/rabbitMQQueues': { default: { templateKind: 'bicep' - templatePath: 'ghcr.io/radius-project/recipes/local-dev/rabbitmqmessagequeues:latest' + templatePath: 'ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest' } } }