diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d0917036..67d114b6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners # Default rule: anything that doesn't match a more specific rule goes here -* @radius-project/radius-pm +* @project-radius/radius-pm diff --git a/.github/scripts/release-samples.sh b/.github/scripts/release-samples.sh deleted file mode 100755 index 9c6d7764..00000000 --- a/.github/scripts/release-samples.sh +++ /dev/null @@ -1,42 +0,0 @@ -# ------------------------------------------------------------ -# Copyright 2023 The Radius Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------ - -set -xe - -VERSION_NUMBER=$1 # (e.g. 0.1.0) -REPOSITORY="samples" - -if [[ -z "$VERSION_NUMBER" ]]; then - echo "Error: VERSION_NUMBER is not set." - exit 1 -fi - -# CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) -CHANNEL="$(echo $VERSION_NUMBER | cut -d '.' -f 1,2)" - -# CHANNEL_VERSION is the version with the 'v' prefix (e.g. v0.1) -CHANNEL_VERSION="v${CHANNEL}" - -echo "Version number: ${VERSION_NUMBER}" -echo "Channel: ${CHANNEL}" -echo "Channel version: ${CHANNEL_VERSION}" - -echo "Creating release branch for ${REPOSITORY}..." - -pushd $REPOSITORY -git checkout -B "${CHANNEL_VERSION}" -git push origin "${CHANNEL_VERSION}" -popd diff --git a/.github/scripts/validate_semver.py b/.github/scripts/validate_semver.py index 6d06b9d3..7f182606 100755 --- a/.github/scripts/validate_semver.py +++ b/.github/scripts/validate_semver.py @@ -29,13 +29,12 @@ def main(): SEMVER_REGEX = r"^(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)\.(?P0|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" pattern = re.compile(SEMVER_REGEX) + version = sys.argv[1] match = pattern.search(version) - - if version == "edge": - print("Provided version is edge") - sys.exit(0) - elif match is None: + + # If no match, then return an error (provided version is not valid semver) + if match is None: print("Provided version is not valid semver") sys.exit(1) else: diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ca161af9..eaac8233 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,15 +19,15 @@ concurrency: env: VERSION: ${{ github.event.pull_request.number || 'edge' }} # Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. - # TODO_LAUNCH: Remove this env var once we opensource the repo - https://github.com/radius-project/samples/issues/439 + # TODO_LAUNCH: Remove this env var once we opensource the repo - https://github.com/project-radius/samples/issues/439 DOCKER_REGISTRY: ${{ github.event.pull_request.number && 'radiusdev.azurecr.io' || 'radius.azurecr.io' }} # Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io. - CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project/samples' }} + CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/project-radius/dev' || 'ghcr.io/project-radius/samples' }} # Set to true to push images to registry. PUSH_IMAGE: true jobs: - # TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/radius-project/samples/issues/439 + # TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/project-radius/samples/issues/439 build: name: Build and push sample images to ACR if: github.event.action != 'closed' @@ -154,7 +154,7 @@ jobs: push: ${{ env.PUSH_IMAGE }} tags: ${{ env.CONTAINER_REGISTRY }}/reference-apps/aws-sqs-sample:${{ env.VERSION }} - # TODO_LAUNCH: Remove this job once we opensource the repo because all pkgs will be cleaned up regularly - https://github.com/radius-project/samples/issues/439 + # TODO_LAUNCH: Remove this job once we opensource the repo because all pkgs will be cleaned up regularly - https://github.com/project-radius/samples/issues/439 cleanup: name: Cleanup ${{ matrix.image }} if: github.event.action == 'closed' diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml index e0dccd94..5f071ff0 100644 --- a/.github/workflows/issues.yaml +++ b/.github/workflows/issues.yaml @@ -17,8 +17,8 @@ jobs: ISSUE: ${{ github.event.issue.html_url }} AUTHOR: ${{ github.actor }} run: | - MEMBERS=$(gh api orgs/radius-project/teams/Radius-Preview/members | jq -r '.[] | .login') - ADMINS=$(gh api orgs/radius-project/teams/Radius-Admin/members | jq -r '.[] | .login') + MEMBERS=$(gh api orgs/project-radius/teams/Radius-Preview/members | jq -r '.[] | .login') + ADMINS=$(gh api orgs/project-radius/teams/Radius-Admin/members | jq -r '.[] | .login') for USER in $MEMBERS; do if [[ "$USER" == "$AUTHOR" ]]; then ISADMIN=false diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index ff2489ac..00000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Release samples - -on: - workflow_dispatch: - inputs: - version: - description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' - required: true - default: '' - type: string - -env: - GITHUB_TOKEN: ${{ secrets.GH_RAD_CI_BOT_PAT }} - GITHUB_EMAIL: 'radiuscoreteam@service.microsoft.com' - GITHUB_USER: 'Radius CI Bot' - -jobs: - release-samples: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_RAD_CI_BOT_PAT }} - ref: edge - path: samples - - name: Configure git - run: | - git config --global user.email "${{ env.GITHUB_EMAIL }}" - git config --global user.name "${{ env.GITHUB_USER }}" - - name: Ensure inputs.version is valid semver - run: | - python ./samples/.github/scripts/validate_semver.py ${{ inputs.version }} - - name: Parse release channel - id: parse_release_channel - run: | - # CHANNEL is the major and minor version of the VERSION_NUMBER (e.g. 0.1) - CHANNEL="$(echo ${{ inputs.version }} | cut -d '.' -f 1,2)" - echo "channel=$CHANNEL" >> $GITHUB_OUTPUT - - name: Release samples - run: | - ./samples/.github/scripts/release-samples.sh ${{ inputs.version }} - - name: Change the default branch - run: | - gh api \ - --method PATCH \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/radius-project/samples \ - -f default_branch='v${{ steps.parse_release_channel.outputs.channel }}' diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 11a07d9f..b6638cb0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,12 +1,12 @@ -name: Test Samples +name: Test Quickstarts on: workflow_dispatch: inputs: version: - description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1, edge). Defaults to edge.' + description: 'Radius version number to use (e.g. 0.22.0, 0.23.0-rc1)' required: false - default: 'edge' + default: '' type: string push: branches: @@ -15,7 +15,6 @@ on: paths: - "quickstarts/**" - "reference-apps/**" - - "demo/**" - ".github/workflows/**" pull_request: types: [opened, synchronize, reopened] @@ -29,102 +28,72 @@ env: jobs: test: name: Sample tests + if: github.event.action != 'closed' runs-on: [self-hosted, 1ES.Pool=1ES-Radius-Samples] strategy: fail-fast: false matrix: include: - name: demo - runOnPullRequest: true app: demo path: ./demo/app.bicep args: --application demo uiTestFile: tests/demo.app.spec.ts port: 3000 container: demo - enableDapr: false - name: dapr - runOnPullRequest: true app: dapr-quickstart path: ./quickstarts/dapr/dapr.bicep enableDapr: true - name: environment-variables - runOnPullRequest: true app: myapp path: ./quickstarts/environment-variables/app.bicep - enableDapr: false - name: volumes - runOnPullRequest: true app: myapp path: ./quickstarts/volumes/app.bicep - enableDapr: false - name: eshop - runOnPullRequest: true app: eshop path: ./reference-apps/eshop/iac/eshop.bicep args: --application eshop uiTestFile: tests/eshop/container.app.spec.ts - enableDapr: false - name: eshop-azure - runOnPullRequest: false app: eshop path: ./reference-apps/eshop/iac/eshop.bicep args: --application eshop -p platform=azure uiTestFile: tests/eshop/container.app.spec.ts credential: azure - enableDapr: false env: BRANCH: ${{ github.base_ref || github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} AZURE_LOCATION: westus3 steps: - # Setup the test assets and configuration - name: Generate output variables id: gen-id run: | BASE_STR="SAMPLES|${GITHUB_SHA}|${GITHUB_SERVER_URL}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${GITHUB_RUN_ATTEMPT}" UNIQUE_ID=$(echo $BASE_STR | sha1sum | head -c 10) - - if [[ "${{ github.event_name }}" == "pull_request" && "${{ matrix.runOnPullRequest }}" == "false" ]]; then - RUN_TEST=false - else - RUN_TEST=true - fi - - if [[ "${{ matrix.enableDapr }}" == "true" ]]; then - ENABLE_DAPR=true - else - ENABLE_DAPR=false - fi # Set output variables to be used in the other jobs echo "UNIQUE_ID=${UNIQUE_ID}" >> $GITHUB_OUTPUT echo "TEST_RESOURCE_GROUP_PREFIX=samplestest-${UNIQUE_ID}" >> $GITHUB_OUTPUT - echo "RUN_TEST=${RUN_TEST}" >> $GITHUB_OUTPUT - echo "ENABLE_DAPR=${ENABLE_DAPR}" >> $GITHUB_OUTPUT - name: Checkout code - if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/checkout@v3 - name: Ensure inputs.version is valid semver - if: inputs.version != '' && steps.gen-id.outputs.RUN_TEST == 'true' + if: inputs.version != '' run: | - python ./.github/scripts/validate_semver.py ${{ inputs.version }} + ./scripts/validate-version.sh ${{ inputs.version }} - name: Setup Node - if: steps.gen-id.outputs.RUN_TEST == 'true' uses: actions/setup-node@v3 with: node-version: 16 - name: az CLI login - if: matrix.credential == 'azure' && steps.gen-id.outputs.RUN_TEST == 'true' run: | az login --service-principal \ --username ${{ secrets.AZURE_SP_TESTS_APPID }} \ --password ${{ secrets.AZURE_SP_TESTS_PASSWORD }} \ --tenant ${{ secrets.AZURE_SP_TESTS_TENANTID }} - # Create and install test environment - name: Create Azure resource group - id: create-azure-resource-group - if: matrix.credential == 'azure' && steps.gen-id.outputs.RUN_TEST == 'true' + if: matrix.credential == 'azure' env: RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} @@ -140,15 +109,16 @@ jobs: sleep 5 done - name: Download k3d - if: steps.gen-id.outputs.RUN_TEST == 'true' run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash - name: Download rad CLI - if: steps.gen-id.outputs.RUN_TEST == 'true' run: | - for attempt in 1 2 3 4 5; do + for attempt in 1 2 3; do if [[ -n "${{ inputs.version }}" ]]; then echo "Downloading rad CLI version ${{ inputs.version }}" wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s ${{ inputs.version }} + elif [ "$BRANCH" = "edge" ]; then + echo "Downloading edge rad CLI" + wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash -s edge else echo "Downloading latest rad CLI" wget -q "${{ env.RAD_CLI_URL }}" -O - | /bin/bash @@ -159,15 +129,13 @@ jobs: fi done - name: Create k3d cluster - if: steps.gen-id.outputs.RUN_TEST == 'true' - run: k3d cluster create --agents 2 -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" + run: k3d cluster create -p "80:80@loadbalancer" --k3s-arg "--disable=traefik@server:0" - name: Install Dapr - if: steps.gen-id.outputs.RUN_TEST == 'true' && steps.gen-id.outputs.ENABLE_DAPR == 'true' + if: ${{ matrix.enableDapr }} run: | helm repo add dapr https://dapr.github.io/helm-charts/ helm install dapr dapr/dapr --version=1.6 --namespace dapr-system --create-namespace --wait - name: Init local environment - if: steps.gen-id.outputs.RUN_TEST == 'true' env: RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} @@ -178,25 +146,22 @@ jobs: rad group switch default rad env create default rad env switch default - rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/rediscaches:latest --link-type Applications.Datastores/redisCaches - rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/mongodatabases:latest --link-type Applications.Datastores/mongoDatabases + rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/rediscaches:latest --link-type Applications.Link/redisCaches + rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/mongodatabases:latest --link-type Applications.Link/mongoDatabases if [[ "${{ matrix.credential }}" == "azure" ]]; then rad env update default --azure-subscription-id $SUBSCRIPTION_ID --azure-resource-group $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 }} fi - # Deploy application and run tests - name: Deploy app - if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad deploy ${{ matrix.path }} ${{ matrix.args }} - name: Wait for all pods to be ready - if: steps.gen-id.outputs.RUN_TEST == 'true' run: | namespace="default-${{ matrix.app }}" label="radius.dev/application=${{ matrix.app }}" kubectl wait --for=condition=Ready pod -l $label -n $namespace --timeout=5m - name: Run Playwright Test id: run-playwright-test - if: matrix.uiTestFile != '' && steps.gen-id.outputs.RUN_TEST == 'true' + if: matrix.uiTestFile != '' run: | if [[ "${{ matrix.container }}" != "" ]]; then rad resource expose containers ${{ matrix.container }} ${{ matrix.args }} --port ${{ matrix.port }} & @@ -204,19 +169,9 @@ jobs: cd ui-tests/ npm ci npx playwright install --with-deps - npx playwright test ${{ matrix.uiTestFile }} --retries=3 - - name: Upload Playwright Results - uses: actions/upload-artifact@v3 - if: always() && ( steps.run-playwright-test.outcome == 'success' || steps.run-playwright-test.outcome == 'failure' ) - with: - name: playwright-report-${{ matrix.name }} - path: ui-tests/playwright-report/ - retention-days: 30 - if-no-files-found: error - # Handle failures - - name: Get Pod logs for failed tests - id: get-pod-logs - if: failure() && steps.run-playwright-test.outcome == 'failure' + npx playwright test ${{ matrix.uiTestFile }} + - name: Get Pod Logs For Failed Tests + if: failure() && matrix.uiTestFile != '' run: | # Create pod-logs directory mkdir -p ui-tests/pod-logs/${{ matrix.name }} @@ -228,25 +183,26 @@ jobs: kubectl logs $pod_name -n $namespace > ui-tests/pod-logs/${{ matrix.name }}/${pod_name}.txt done echo "Pod logs saved to ui-tests/pod-logs/${{ matrix.name }}/" - # Get kubernetes events and save to file - kubectl get events -n $namespace > ui-tests/pod-logs/${{ matrix.name }}/events.txt - - name: Upload Pod logs for failed tests + - name: Upload Playwright Results uses: actions/upload-artifact@v3 - if: failure() && steps.get-pod-logs.outcome == 'success' + if: always() && matrix.uiTestFile != '' + with: + name: playwright-report-${{ matrix.name }} + path: ui-tests/playwright-report/ + retention-days: 30 + if-no-files-found: error + - name: Upload Pod Logs + uses: actions/upload-artifact@v3 + if: failure() && matrix.uiTestFile != '' with: name: ${{ matrix.name }}-pod-logs path: ui-tests/pod-logs/${{ matrix.name }} retention-days: 30 if-no-files-found: error - - name: Create GitHub issue on failure - if: failure() && github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' - run: gh issue create --title "Samples deployment failed for ${{ matrix.app }}" --body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." --repo ${{ github.repository }} - # Cleanup - name: Delete app - if: steps.gen-id.outputs.RUN_TEST == 'true' run: rad app delete ${{ matrix.app }} -y - name: Delete Azure resource group - if: always() && steps.create-azure-resource-group.outcome == 'success' + if: always() && matrix.credential == 'azure' env: RESOURCE_GROUP: ${{ steps.gen-id.outputs.TEST_RESOURCE_GROUP_PREFIX }}-${{ matrix.name }} SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} @@ -256,3 +212,6 @@ jobs: --subscription $SUBSCRIPTION_ID \ --name $RESOURCE_GROUP \ --yes + - name: Create GitHub issue on failure + if: failure() && github.event_name != 'pull_request' + run: gh issue create --title "Samples deployment failed for ${{ matrix.app }}" --body "Test failed on ${{ github.repository }}. See [workflow logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details." --repo ${{ github.repository }} diff --git a/demo/app.bicep b/demo/app.bicep index 5b7389ed..6ec8fbb3 100644 --- a/demo/app.bicep +++ b/demo/app.bicep @@ -29,7 +29,7 @@ resource demo 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -resource db 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { +resource db 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { name: 'db' properties: { application: application diff --git a/demo/client/src/routes/Index.tsx b/demo/client/src/routes/Index.tsx index 7ed8020e..f6e67051 100644 --- a/demo/client/src/routes/Index.tsx +++ b/demo/client/src/routes/Index.tsx @@ -2,131 +2,42 @@ import { useLoaderData } from "react-router-dom"; export function Index() { const { process, env, network } = useLoaderData() as ContainerInfo; - - // Find all environment variables that start with npm_ - const connections = Object.entries(env).filter(([key, value]) => key.startsWith("CONNECTION_")); - // Now split the key into parts between _, and find all unique second parts - const uniqueConnections = Array.from(new Set(connections.map(([key, value]) => key.split("_")[1]))); - return <> - -
- -
-
-

Welcome to the Radius demo

-

This demo container will showcase Radius features and configuration.

-
-
- -
-
-

Radius Connections

-

See all the connections this container has to other resources within the application

- - {uniqueConnections.length === 0 &&
No connections defined
} - -
- { - uniqueConnections.map(connection => { - return
-

- -

-
-
-
Environment variables
-

These environment variables are available to the container and are set automatically by Radius

-
    - {connections.filter(([key, value]) => key.startsWith(`CONNECTION_${connection}_`)).map(([key, value]) => { - return
  • {key}: {value}
  • - })} -
-
-
-
- }) - } +
+
+

Welcome to the Radius Demo

+
This page shows the configuration of the demo application.
+ +
+

Network

+
+
Hostname:{network.hostname}
+
IPs:{network.ips.join(" ")}
+
Port:{network.port}
-
-
- -
-
-

Container Metadata

-

Learn about the running container and its configuration

- -
-
-

- -

-
-
-
-
Hostname:{network.hostname}
-
IPs:{network.ips.join(" ")}
-
Port:{network.port}
-
-
-
-
-
-

- -

-
-
-
-
Command:{process.args.join(" ")}
-
Working Directory:{process.pwd}
-
-
-
-
-
-

- -

-
-
-
- - - - - - - - - {Object.entries(env).sort(([x], [y]) => x.localeCompare(y)).map(([key, value]) => { - return - })} - -
KeyValue
{key}{value}
-
-
-
-
+
+

Process

+
+
Command:{process.args.join(" ")}
+
Working Directory:{process.pwd}
-
-
- -
-
-

Todo List

-

Visit the Todo List page to try interacting with external dependencies

- +
+

Environment

+
+ + + + + + + + {Object.entries(env).sort(([x], [y]) => x.localeCompare(y)).map(([key, value]) => { + return + })} +
KeyValue
{key}{value}
+
diff --git a/demo/package-lock.json b/demo/package-lock.json index ec2b2583..3aad854f 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -12,7 +12,6 @@ "@types/mongodb": "^4.0.7", "@types/morgan": "^1.9.3", "@types/uuid": "^8.3.4", - "bootstrap": "^5.3.1", "dotenv": "^16.0.3", "express": "^4.18.2", "mongodb": "^4.11.0", @@ -1088,16 +1087,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "peer": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, "node_modules/@redis/bloom": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz", @@ -1459,24 +1448,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/bootstrap": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.1.tgz", - "integrity": "sha512-jzwza3Yagduci2x0rr9MeFSORjcHpt0lRZukZPZQJT1Dth5qzV7XcgGqYzi39KGAVYR8QEDVoO0ubFKOxzMG+g==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/twbs" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/bootstrap" - } - ], - "peerDependencies": { - "@popperjs/core": "^2.11.8" - } - }, "node_modules/bowser": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", @@ -4035,12 +4006,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "peer": true - }, "@redis/bloom": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz", @@ -4344,12 +4309,6 @@ } } }, - "bootstrap": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.1.tgz", - "integrity": "sha512-jzwza3Yagduci2x0rr9MeFSORjcHpt0lRZukZPZQJT1Dth5qzV7XcgGqYzi39KGAVYR8QEDVoO0ubFKOxzMG+g==", - "requires": {} - }, "bowser": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz", diff --git a/demo/package.json b/demo/package.json index 596f632c..1a84f3f8 100644 --- a/demo/package.json +++ b/demo/package.json @@ -26,7 +26,6 @@ "@types/mongodb": "^4.0.7", "@types/morgan": "^1.9.3", "@types/uuid": "^8.3.4", - "bootstrap": "^5.3.1", "dotenv": "^16.0.3", "express": "^4.18.2", "mongodb": "^4.11.0", diff --git a/quickstarts/dapr/dapr-azure.bicep b/quickstarts/dapr/dapr-azure.bicep index e521d764..a993ee5a 100644 --- a/quickstarts/dapr/dapr-azure.bicep +++ b/quickstarts/dapr/dapr-azure.bicep @@ -102,7 +102,7 @@ resource account 'Microsoft.Storage/storageAccounts@2019-06-01' = { } } -resource stateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { +resource stateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { environment: environment diff --git a/quickstarts/dapr/dapr.bicep b/quickstarts/dapr/dapr.bicep index 19a6646b..019861b7 100644 --- a/quickstarts/dapr/dapr.bicep +++ b/quickstarts/dapr/dapr.bicep @@ -85,7 +85,7 @@ resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' = { } } -resource stateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { +resource stateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { name: 'statestore' properties: { environment: environment diff --git a/quickstarts/environment-variables/app.bicep b/quickstarts/environment-variables/app.bicep index eb473155..befc496f 100644 --- a/quickstarts/environment-variables/app.bicep +++ b/quickstarts/environment-variables/app.bicep @@ -28,7 +28,7 @@ resource container 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -resource mongoLink 'Applications.Datastores/mongoDatabases@2022-03-15-privatepreview' = { +resource mongoLink 'Applications.Link/mongoDatabases@2022-03-15-privatepreview' = { name: 'mongo-link' properties: { environment: environment diff --git a/quickstarts/recipes/app.bicep b/quickstarts/recipes/app.bicep index 8ec55aa6..aca893a6 100644 --- a/quickstarts/recipes/app.bicep +++ b/quickstarts/recipes/app.bicep @@ -26,8 +26,8 @@ resource frontend 'Applications.Core/containers@2022-03-15-privatepreview' = { } } -// Redis Cache portable resource -resource db 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' = { +// Redis Cache Link resource +resource db 'Applications.Link/redisCaches@2022-03-15-privatepreview' = { name: 'db' properties: { environment: environment diff --git a/reference-apps/container-app-store/README.md b/reference-apps/container-app-store/README.md index e1a2bb95..82f3aee4 100644 --- a/reference-apps/container-app-store/README.md +++ b/reference-apps/container-app-store/README.md @@ -12,7 +12,7 @@ This reference app is a "radified" version of the [Container Apps Store](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/container-app-store ``` 1. Deploy the app: diff --git a/reference-apps/container-app-store/iac/infra-azure.bicep b/reference-apps/container-app-store/iac/infra-azure.bicep index 0bb9e530..ac469ca3 100644 --- a/reference-apps/container-app-store/iac/infra-azure.bicep +++ b/reference-apps/container-app-store/iac/infra-azure.bicep @@ -23,7 +23,7 @@ resource account 'Microsoft.Storage/storageAccounts@2021-09-01' = { } } -resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { +resource statestore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { application: applicationId diff --git a/reference-apps/container-app-store/iac/infra-selfhosted.bicep b/reference-apps/container-app-store/iac/infra-selfhosted.bicep index b72ae6e8..e580bdd2 100644 --- a/reference-apps/container-app-store/iac/infra-selfhosted.bicep +++ b/reference-apps/container-app-store/iac/infra-selfhosted.bicep @@ -28,7 +28,7 @@ resource redisRoute 'Applications.Core/httpRoutes@2022-03-15-privatepreview' = { } } -resource statestore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { +resource statestore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { name: 'orders' properties: { resourceProvisioning: 'manual' diff --git a/reference-apps/eshop-dapr/README.md b/reference-apps/eshop-dapr/README.md index 4402865a..80252bce 100644 --- a/reference-apps/eshop-dapr/README.md +++ b/reference-apps/eshop-dapr/README.md @@ -34,7 +34,7 @@ The current version of eShopOnDapr utilizes Azure Kubernetes Services to deploy 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-dapr ``` diff --git a/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep b/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep index facebab1..c9b314ea 100644 --- a/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-pub-sub.bicep @@ -40,7 +40,7 @@ resource serviceBus 'Microsoft.ServiceBus/namespaces@2021-06-01-preview' = { // Create the Dapr pub sub component //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' = { +resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' = { name: 'eshopondapr-pubsub' location: 'global' properties: { diff --git a/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep b/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep index 2c87fc82..d7d24c9a 100644 --- a/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-secret-store.bicep @@ -46,7 +46,7 @@ resource keyVault 'Microsoft.KeyVault/vaults@2021-11-01-preview' = { // Create the Dapr secret store component //----------------------------------------------------------------------------- -resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' = { +resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' = { name: 'eshopondapr-secretstore' location: 'global' properties: { diff --git a/reference-apps/eshop-dapr/infra/dapr-state-store.bicep b/reference-apps/eshop-dapr/infra/dapr-state-store.bicep index f6c400b4..ca96b912 100644 --- a/reference-apps/eshop-dapr/infra/dapr-state-store.bicep +++ b/reference-apps/eshop-dapr/infra/dapr-state-store.bicep @@ -77,7 +77,7 @@ resource cosmosCollection 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/co // Create the Dapr state store component //----------------------------------------------------------------------------- -resource daprStateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' = { +resource daprStateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' = { name: 'eshopondapr-statestore' location: 'global' dependsOn: [ diff --git a/reference-apps/eshop-dapr/infra/sql-server.bicep b/reference-apps/eshop-dapr/infra/sql-server.bicep index 6bbf7080..f02b1b9a 100644 --- a/reference-apps/eshop-dapr/infra/sql-server.bicep +++ b/reference-apps/eshop-dapr/infra/sql-server.bicep @@ -109,10 +109,10 @@ resource keyVault 'Microsoft.KeyVault/vaults@2021-11-01-preview' existing = { } //----------------------------------------------------------------------------- -// Create Radius portable resources to the databases +// Create Radius links to the databases //----------------------------------------------------------------------------- -resource catalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { +resource catalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { name: 'catalog-db-link' properties: { application: appId @@ -129,7 +129,7 @@ resource catalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privateprevi } } -resource identityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { +resource identityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { name: 'identity-db-link' properties: { application: appId @@ -146,7 +146,7 @@ resource identityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privateprev } } -resource orderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' = { +resource orderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' = { name: 'ordering-db-link' properties: { application: appId diff --git a/reference-apps/eshop-dapr/services/basket-api.bicep b/reference-apps/eshop-dapr/services/basket-api.bicep index 1977a7bd..c73089b5 100644 --- a/reference-apps/eshop-dapr/services/basket-api.bicep +++ b/reference-apps/eshop-dapr/services/basket-api.bicep @@ -36,11 +36,11 @@ resource gateway 'Applications.Core/gateways@2022-03-15-privatepreview' existing name: gatewayName } -resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprStateStore 'Applications.Dapr/stateStores@2022-03-15-privatepreview' existing = { +resource daprStateStore 'Applications.Link/daprStateStores@2022-03-15-privatepreview' existing = { name: daprStateStoreName } diff --git a/reference-apps/eshop-dapr/services/catalog-api.bicep b/reference-apps/eshop-dapr/services/catalog-api.bicep index 6f40b12e..f271946c 100644 --- a/reference-apps/eshop-dapr/services/catalog-api.bicep +++ b/reference-apps/eshop-dapr/services/catalog-api.bicep @@ -6,7 +6,7 @@ param appId string @description('The name of the Catalog API HTTP route.') param catalogApiRouteName string -@description('The name of the Catalog database portable resource.') +@description('The name of the Catalog database link.') param catalogDbName string @description('The name of the Dapr pub/sub component.') @@ -33,15 +33,15 @@ resource catalogApiRoute 'Applications.Core/httproutes@2022-03-15-privatepreview name: catalogApiRouteName } -resource catalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { +resource catalogDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { name: catalogDbName } -resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } diff --git a/reference-apps/eshop-dapr/services/identity-api.bicep b/reference-apps/eshop-dapr/services/identity-api.bicep index 805f5db5..ad687cdb 100644 --- a/reference-apps/eshop-dapr/services/identity-api.bicep +++ b/reference-apps/eshop-dapr/services/identity-api.bicep @@ -13,7 +13,7 @@ param gatewayName string @description('The name of the Identity API HTTP route.') param identityApiRouteName string -@description('The name of the Identity database portable resource.') +@description('The name of the Identity database link.') param identityDbName string @description('The name of the Key Vault to get secrets from.') @@ -28,7 +28,7 @@ var daprAppId = 'identity-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } @@ -40,7 +40,7 @@ resource identityApiRoute 'Applications.Core/httproutes@2022-03-15-privateprevie name: identityApiRouteName } -resource identityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { +resource identityDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { name: identityDbName } diff --git a/reference-apps/eshop-dapr/services/ordering-api.bicep b/reference-apps/eshop-dapr/services/ordering-api.bicep index 95708d81..9d5e9ef4 100644 --- a/reference-apps/eshop-dapr/services/ordering-api.bicep +++ b/reference-apps/eshop-dapr/services/ordering-api.bicep @@ -22,7 +22,7 @@ param keyVaultName string @description('The name of the Ordering API HTTP route.') param orderingApiRouteName string -@description('The name of the Ordering database portable resource.') +@description('The name of the Ordering database link.') param orderingDbName string @description('The name of the Seq HTTP route.') @@ -35,11 +35,11 @@ var daprAppId = 'ordering-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } -resource daprSecretStore 'Applications.Dapr/secretStores@2022-03-15-privatepreview' existing = { +resource daprSecretStore 'Applications.Link/daprSecretStores@2022-03-15-privatepreview' existing = { name: daprSecretStoreName } @@ -55,7 +55,7 @@ resource orderingApiRoute 'Applications.Core/httproutes@2022-03-15-privateprevie name: orderingApiRouteName } -resource orderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { +resource orderingDb 'Applications.Link/sqlDatabases@2022-03-15-privatepreview' existing = { name: orderingDbName } diff --git a/reference-apps/eshop-dapr/services/payment-api.bicep b/reference-apps/eshop-dapr/services/payment-api.bicep index 03a14a46..00e90f79 100644 --- a/reference-apps/eshop-dapr/services/payment-api.bicep +++ b/reference-apps/eshop-dapr/services/payment-api.bicep @@ -19,7 +19,7 @@ var daprAppId = 'payment-api' // Get references to existing resources //----------------------------------------------------------------------------- -resource daprPubSubBroker 'Applications.Dapr/pubSubBrokers@2022-03-15-privatepreview' existing = { +resource daprPubSubBroker 'Applications.Link/daprPubSubBrokers@2022-03-15-privatepreview' existing = { name: daprPubSubBrokerName } diff --git a/reference-apps/eshop/README.md b/reference-apps/eshop/README.md index f858478c..5b06a7ff 100644 --- a/reference-apps/eshop/README.md +++ b/reference-apps/eshop/README.md @@ -14,7 +14,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/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): diff --git a/reference-apps/eshop/envoy/README.md b/reference-apps/eshop/envoy/README.md index b542a623..d459ed4f 100644 --- a/reference-apps/eshop/envoy/README.md +++ b/reference-apps/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/reference-apps/eshop/iac/environments/aws.bicep b/reference-apps/eshop/iac/environments/aws.bicep new file mode 100644 index 00000000..4022cc9f --- /dev/null +++ b/reference-apps/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/reference-apps/eshop/iac/environments/azure.bicep b/reference-apps/eshop/iac/environments/azure.bicep new file mode 100644 index 00000000..5708f5a5 --- /dev/null +++ b/reference-apps/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/reference-apps/eshop/iac/environments/containers.bicep b/reference-apps/eshop/iac/environments/containers.bicep new file mode 100644 index 00000000..6fd47e85 --- /dev/null +++ b/reference-apps/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/reference-apps/eshop/iac/eshop.bicep b/reference-apps/eshop/iac/eshop.bicep index 9aaa2ec9..ca171bfd 100644 --- a/reference-apps/eshop/iac/eshop.bicep +++ b/reference-apps/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,28 +24,30 @@ 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@2022-03-15-privatepreview' = { @@ -65,53 +59,20 @@ resource eshop 'Applications.Core/applications@2022-03-15-privatepreview' = { // 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 - } -} - -// 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 @@ -131,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 } } @@ -149,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 } } @@ -166,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 @@ -191,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 } } @@ -207,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 } } @@ -230,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 @@ -247,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 } } @@ -270,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/reference-apps/eshop/iac/infra/aws.bicep b/reference-apps/eshop/iac/infra/aws.bicep deleted file mode 100644 index 2464593c..00000000 --- a/reference-apps/eshop/iac/infra/aws.bicep +++ /dev/null @@ -1,328 +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('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 - } -} - -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' - } -} - -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' - } -} - -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' - } -} - -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' - } -} - -var redisSubnetGroupName = 'eshopredissg${uniqueString(application)}' -resource redisSubnetGroup 'AWS.MemoryDB/SubnetGroup@default' = { - alias: redisSubnetGroupName - properties: { - SubnetGroupName: redisSubnetGroupName - SubnetIds: eksCluster.properties.ResourcesVpcConfig.SubnetIds - } -} - -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 - } -} - -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 - } -} - -// TEMP: Using containerized rabbitMQ instead of AWS SNS until AWS nonidempotency is resolved -resource rabbitmqContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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/reference-apps/eshop/iac/infra/azure.bicep b/reference-apps/eshop/iac/infra/azure.bicep deleted file mode 100644 index 889a999f..00000000 --- a/reference-apps/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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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/reference-apps/eshop/iac/infra/containers.bicep b/reference-apps/eshop/iac/infra/containers.bicep deleted file mode 100644 index d94ac598..00000000 --- a/reference-apps/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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'rabbitmq-route-eshop-event-bus' - properties: { - application: application - port: 5672 - } -} - -resource sqlIdentityContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'sql-route-identitydb' - properties: { - application: application - port: 1433 - } -} - -resource sqlCatalogContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'sql-route-catalogdb' - properties: { - application: application - port: 1433 - } -} - -resource sqlOrderingContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'sql-route-orderingdb' - properties: { - application: application - port: 1433 - } -} - -resource sqlWebhooksContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'sql-route-webhooksdb' - properties: { - application: application - port: 1433 - } -} - -resource redisBasketContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'redis-route-basket-data' - properties: { - application: application - port: 6379 - } -} - -resource redisKeystoreContainer 'Applications.Core/containers@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - name: 'redis-route-keystore-data' - properties: { - application: application - port: 6379 - } -} - -// Portable Resources --------------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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@2022-03-15-privatepreview' = { - 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/reference-apps/eshop/iac/infra/infra.bicep b/reference-apps/eshop/iac/infra/infra.bicep new file mode 100644 index 00000000..9cd58018 --- /dev/null +++ b/reference-apps/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/reference-apps/eshop/iac/infra/links.bicep b/reference-apps/eshop/iac/infra/links.bicep deleted file mode 100644 index 03646c43..00000000 --- a/reference-apps/eshop/iac/infra/links.bicep +++ /dev/null @@ -1,52 +0,0 @@ -import radius as rad - -resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: 'identitydb' -} - -resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: 'catalogdb' -} - -resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: 'orderingdb' -} - -resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { - name: 'webhooksdb' -} - -resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: 'keystore-data' -} - -resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { - name: 'basket-data' -} - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' 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/reference-apps/eshop/iac/services/networking.bicep b/reference-apps/eshop/iac/infra/networking.bicep similarity index 100% rename from reference-apps/eshop/iac/services/networking.bicep rename to reference-apps/eshop/iac/infra/networking.bicep diff --git a/reference-apps/eshop/iac/services/basket.bicep b/reference-apps/eshop/iac/services/basket.bicep index 58aaeff8..ad1b4cc0 100644 --- a/reference-apps/eshop/iac/services/basket.bicep +++ b/reference-apps/eshop/iac/services/basket.bicep @@ -5,25 +5,25 @@ 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('Use Azure Service Bus for messaging') +@allowed([ + 'True' + 'False' +]) +param AZURESERVICEBUSENABLED string + @description('The name of the Radius Gateway') param gatewayName string @@ -36,15 +36,12 @@ 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 // Container ------------------------------------- @@ -66,7 +63,7 @@ resource basket 'Applications.Core/containers@2022-03-15-privatepreview' = { 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 +109,8 @@ resource basketGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' exi name: basketGrpcName } -// Portable Resource ------------------------------------------ +// Links ------------------------------------------ resource redisBasket 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisBasketName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/catalog.bicep b/reference-apps/eshop/iac/services/catalog.bicep index 0ae9712b..a4d7a3ce 100644 --- a/reference-apps/eshop/iac/services/catalog.bicep +++ b/reference-apps/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,17 +40,15 @@ 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 ------------------------------------------------------------------- @@ -74,7 +72,7 @@ resource catalog 'Applications.Core/containers@2022-03-15-privatepreview' = { ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlCatalogDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -109,12 +107,8 @@ resource catalogGrpc 'Applications.Core/httpRoutes@2022-03-15-privatepreview' ex name: catalogGrpcName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource sqlCatalogDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlCatalogDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/identity.bicep b/reference-apps/eshop/iac/services/identity.bicep index 58e515bb..81130344 100644 --- a/reference-apps/eshop/iac/services/identity.bicep +++ b/reference-apps/eshop/iac/services/identity.bicep @@ -15,7 +15,7 @@ param APPLICATION_INSIGHTS_KEY string ]) 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. Defaults to linux-dotnet7') param TAG string @description('Name of the Gateway') @@ -42,10 +42,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 ------------------------------------------------------------------- @@ -154,7 +154,7 @@ resource webmvcHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' exi name: webmvcHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource sqlIdentityDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlIdentityDbName diff --git a/reference-apps/eshop/iac/services/ordering.bicep b/reference-apps/eshop/iac/services/ordering.bicep index 94a83720..b78f9343 100644 --- a/reference-apps/eshop/iac/services/ordering.bicep +++ b/reference-apps/eshop/iac/services/ordering.bicep @@ -21,7 +21,7 @@ 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 Gateway') @@ -48,18 +48,15 @@ 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 // CONTAINERS ------------------------------------------------------- @@ -85,7 +82,7 @@ resource ordering 'Applications.Core/containers@2022-03-15-privatepreview' = { 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}' } @@ -132,7 +129,7 @@ resource orderbgtasks 'Applications.Core/containers@2022-03-15-privatepreview' = OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED ConnectionString: sqlOrderingDb.connectionString() - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -165,8 +162,8 @@ resource orderingsignalrhub 'Applications.Core/containers@2022-03-15-privateprev OrchestratorType: ORCHESTRATOR_TYPE 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 +233,7 @@ resource orderbgtasksHttp 'Applications.Core/httpRoutes@2022-03-15-privateprevie name: orderbgtasksHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisKeystoreName @@ -245,7 +242,3 @@ resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepr resource sqlOrderingDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlOrderingDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/payment.bicep b/reference-apps/eshop/iac/services/payment.bicep index 03448ea4..2bbaa9d2 100644 --- a/reference-apps/eshop/iac/services/payment.bicep +++ b/reference-apps/eshop/iac/services/payment.bicep @@ -21,18 +21,15 @@ 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 --------------------------------------------------------- @@ -49,7 +46,7 @@ resource payment 'Applications.Core/containers@2022-03-15-privatepreview' = { 'Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ': 'Verbose' OrchestratorType: ORCHESTRATOR_TYPE AzureServiceBusEnabled: AZURESERVICEBUSENABLED - EventBusConnection: (AZURESERVICEBUSENABLED == 'True') ? serviceBusConnectionString : rabbitmq.properties.host + EventBusConnection: eventBusConnectionString } ports: { http: { @@ -66,9 +63,3 @@ resource payment 'Applications.Core/containers@2022-03-15-privatepreview' = { resource paymentHttp 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { name: paymentHttpName } - -// PORTABLE RESOURCES ----------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/web.bicep b/reference-apps/eshop/iac/services/web.bicep index de1cb7e6..6d466b62 100644 --- a/reference-apps/eshop/iac/services/web.bicep +++ b/reference-apps/eshop/iac/services/web.bicep @@ -14,7 +14,7 @@ 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 +38,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 -------------------------------------------------------------------- @@ -183,7 +183,7 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepr name: webshoppingapigwHttpName } -// PORTABLE RESOURCES ------------------------------------------------------ +// LINKS ------------------------------------------------------ resource redisKeystore 'Applications.Datastores/redisCaches@2022-03-15-privatepreview' existing = { name: redisKeystoreName diff --git a/reference-apps/eshop/iac/services/webhooks.bicep b/reference-apps/eshop/iac/services/webhooks.bicep index dd1fbdc3..bfe4d0b2 100644 --- a/reference-apps/eshop/iac/services/webhooks.bicep +++ b/reference-apps/eshop/iac/services/webhooks.bicep @@ -18,7 +18,7 @@ param ORCHESTRATOR_TYPE string ]) 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. Defaults to linux-dotnet7') param TAG string @description('Name of the Gateway') @@ -33,15 +33,12 @@ 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 // CONTAINERS ----------------------------------------------------------- @@ -59,7 +56,7 @@ resource webhooks 'Applications.Core/containers@2022-03-15-privatepreview' = { OrchestratorType: ORCHESTRATOR_TYPE 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 +134,8 @@ resource webhooksclientHttp 'Applications.Core/httpRoutes@2022-03-15-privateprev name: webhooksclientHttpName } -// PORTABLE RESOURCES ----------------------------------------------------------- +// LINKS ----------------------------------------------------------- resource sqlWebhooksDb 'Applications.Datastores/sqlDatabases@2022-03-15-privatepreview' existing = { name: sqlWebhooksDbName } - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/webshopping.bicep b/reference-apps/eshop/iac/services/webshopping.bicep index 4571a273..93afb086 100644 --- a/reference-apps/eshop/iac/services/webshopping.bicep +++ b/reference-apps/eshop/iac/services/webshopping.bicep @@ -11,7 +11,7 @@ param application string ]) 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 +50,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@2022-03-15-privatepreview' = { name: 'webshoppingagg' @@ -88,10 +85,6 @@ resource webshoppingagg 'Applications.Core/containers@2022-03-15-privatepreview' } } connections: { - rabbitmq: { - source: rabbitmq.id - disableDefaultEnvVars: true - } identity: { source: identityHttp.id disableDefaultEnvVars: true @@ -183,9 +176,3 @@ resource webshoppingapigwHttp 'Applications.Core/httpRoutes@2022-03-15-privatepr resource webshoppingapigwHttp2 'Applications.Core/httpRoutes@2022-03-15-privatepreview' existing = { name: webshoppingapigwHttp2Name } - -// PORTABLE RESOURCES -------------------------------------------------------- - -resource rabbitmq 'Applications.Messaging/rabbitMQQueues@2022-03-15-privatepreview' existing = { - name: rabbitmqName -} diff --git a/reference-apps/eshop/iac/services/webstatus.bicep b/reference-apps/eshop/iac/services/webstatus.bicep index 36877715..e1e9cf9e 100644 --- a/reference-apps/eshop/iac/services/webstatus.bicep +++ b/reference-apps/eshop/iac/services/webstatus.bicep @@ -14,7 +14,7 @@ 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') diff --git a/ui-tests/tests/demo.app.spec.ts b/ui-tests/tests/demo.app.spec.ts index 1d69fa67..9e786ff7 100644 --- a/ui-tests/tests/demo.app.spec.ts +++ b/ui-tests/tests/demo.app.spec.ts @@ -38,12 +38,13 @@ test("To-Do App Basic UI Checks", async ({ page }) => { await page.getByRole("link", { name: "Radius Demo" }) .click(); - await page.getByRole('button', { name: '📄 Environment variables' }).click(); - // Make sure important environment variables are visible - await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_CONNECTIONSTRING' }).getByText('CONNECTION_REDIS_CONNECTIONSTRING')).toBeVisible(); - await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_HOST' }).getByText('CONNECTION_REDIS_HOST')).toBeVisible(); - await expect(page.getByRole('cell', { name: 'CONNECTION_REDIS_PORT' }).getByText('CONNECTION_REDIS_PORT')).toBeVisible(); + await expect(page.getByText("CONNECTION_REDIS_CONNECTIONSTRING")) + .toBeVisible(); + await expect(page.getByText("CONNECTION_REDIS_HOST")) + .toBeVisible(); + await expect(page.getByText("CONNECTION_REDIS_PORT")) + .toBeVisible(); }); test("Add an item and check basic functionality", async ({ page }) => {