Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 34 additions & 18 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- name: demo
runOnPullRequest: true
app: demo
env: default
path: ./samples/demo/app.bicep
args: --application demo
uiTestFile: tests/demo/demo.app.spec.ts
Expand All @@ -44,33 +45,36 @@ jobs:
- name: dapr
runOnPullRequest: true
app: dapr
env: default
path: ./samples/dapr/dapr.bicep
enableDapr: true
- name: volumes
runOnPullRequest: true
app: myapp
env: default
path: ./samples/volumes/app.bicep
enableDapr: false
- name: eshop
- name: eshop-containers
runOnPullRequest: true
app: eshop
path: ./samples/eshop/iac/eshop.bicep
uiTestFile: tests/eshop/container.app.spec.ts
env: default
path: ./samples/eshop/eshop.bicep
uiTestFile: tests/eshop/eshop.app.spec.ts
enableDapr: false
- name: eshop-azure
runOnPullRequest: false
app: eshop-azure
path: ./samples/eshop/iac/eshop.bicep
args: -p platform=azure -p appName=eshop-azure
uiTestFile: tests/eshop/container.app.spec.ts
app: eshop
env: azure
path: ./samples/eshop/eshop.bicep
uiTestFile: tests/eshop/eshop.app.spec.ts
credential: azure
enableDapr: false
- name: eshop-aws
runOnPullRequest: false
app: eshop-aws-${{ github.run_id }}-${{ github.run_attempt }}
path: ./samples/eshop/iac/eshop.bicep
args: -p platform=aws -p eksClusterName=eks-samplestest-${{ github.run_id }}-${{ github.run_attempt }}-eshop-aws -p appName=eshop-aws-${{ github.run_id }}-${{ github.run_attempt }}
uiTestFile: tests/eshop/container.app.spec.ts
app: eshop
env: aws
path: ./samples/eshop/eshop.bicep
uiTestFile: tests/eshop/eshop.app.spec.ts
credential: aws
enableDapr: false
env:
Expand Down Expand Up @@ -161,12 +165,9 @@ jobs:
echo "Waiting for EKS cluster to be created..."
sleep 60
done
aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }}
timeout-minutes: 60
continue-on-error: false
- name: Install k3d
if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential == 'aws'
run: |
aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }}
- name: Download k3d
if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.credential != 'aws'
run: wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
Expand All @@ -186,7 +187,7 @@ jobs:
RADIUS_VERSION=edge
fi
./.github/scripts/install-radius.sh $RADIUS_VERSION
- name: Initialize local environment
- name: Initialize default environment
if: steps.gen-id.outputs.RUN_TEST == 'true'
run: |
if [[ "${{ matrix.credential }}" == "aws" ]]; then
Expand All @@ -201,6 +202,11 @@ jobs:
rad env switch default
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/sqldatabases:latest --resource-type Applications.Datastores/sqlDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest --resource-type Applications.Messaging/rabbitMQQueues
- name: Configure cloud credentials
if: steps.gen-id.outputs.RUN_TEST == 'true' && ( matrix.credential == 'azure' || matrix.credential == 'aws')
run: |
if [[ "${{ matrix.credential }}" == "azure" ]]; then
rad env update default --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }}
rad credential register azure --client-id ${{ secrets.AZURE_SP_TESTS_APPID }} --client-secret ${{ secrets.AZURE_SP_TESTS_PASSWORD }} --tenant-id ${{ secrets.AZURE_SP_TESTS_TENANTID }}
Expand All @@ -209,6 +215,16 @@ jobs:
rad env update default --aws-region ${{ env.AWS_REGION }} --aws-account-id ${{ secrets.AWS_ACCOUNT_ID }}
rad credential register aws --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
fi
## This step is temporary until we have Recipe Packs for Azure & AWS and update the eShop sample
- name: Initialize eShop environments
if: steps.gen-id.outputs.RUN_TEST == 'true' && matrix.app == 'eshop'
run: |
if [[ "${{ matrix.credential }}" == "azure" ]]; then
rad deploy ./samples/eshop/environments/azure.bicep -p azureResourceGroup=${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }} -p azureSubscriptionId=${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }}
elif [[ "${{ matrix.credential }}" == "aws" ]]; then
rad deploy ./samples/eshop/environments/aws.bicep -p awsAccountId=${{ secrets.AWS_ACCOUNT_ID }} -p awsRegion=${{ env.AWS_REGION }} -p eksClusterName=${{ steps.gen-id.outputs.TEST_EKS_CLUSTER_NAME }}
fi
rad env switch ${{ matrix.env }}
# Deploy application and run tests
- name: Deploy app
if: steps.gen-id.outputs.RUN_TEST == 'true'
Expand All @@ -217,7 +233,7 @@ jobs:
if: steps.gen-id.outputs.RUN_TEST == 'true'
id: wait-for-pods
run: |
namespace="default-${{ matrix.app }}"
namespace="${{ matrix.env }}-${{ matrix.app }}"
label="radapp.io/application=${{ matrix.app }}"
kubectl wait --for=condition=Ready pod -l $label -n $namespace --timeout=5m
- name: Run Playwright Test
Expand Down Expand Up @@ -275,7 +291,7 @@ jobs:
- name: Delete app
if: steps.gen-id.outputs.RUN_TEST == 'true'
run: |
rad app delete ${{ matrix.app }} -y
rad app delete ${{ matrix.app }} -y
- name: Delete Azure resource group
if: always() && steps.gen-id.outputs.RUN_TEST == 'true' && steps.create-azure-resource-group.outcome == 'success'
run: |
Expand Down
61 changes: 38 additions & 23 deletions samples/eshop/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# eShop on Radius reference application

Visit the [Project Radius docs](https://docs.radapp.io/tutorials/eshop/) to learn more and try it out.

## Source

This reference app is a "radified" version of the [eShop on containers](https://github.com/dotnet-architecture/eShopOnContainers) .NET reference application.
Expand All @@ -11,29 +9,46 @@ This reference app is a "radified" version of the [eShop on containers](https://
1. Have a kubernetes cluster handy from the [supported clusters](https://docs.radapp.io/guides/operations/kubernetes/overview/#supported-kubernetes-clusters).
- (AWS only) Make sure that each of the Subnets in your EKS cluster Subnet Group are within the list of [supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html)
1. [Install the rad CLI](https://docs.radapp.io/getting-started/)
1. [Initialize a new Radius environment](https://docs.radapp.io/getting-started/)
1. Install Radius:
```bash
rad install kubernetes
```
1. Set provider credentials to authenticate to your cloud provider (choose which type of hosting infrastructure you wish to use):
```bash
# AWS
rad credential register aws --aws-access-key-id <your-aws-access-key-id> --aws-secret-access-key <your-aws-secret-access-key>

# Azure
rad credential register azure --client-id <your-azure-service-principal-client-id> --client-secret <your-azure-service-principal-client-secret> --tenant-id <your-azure-service-principal-tenant-id>
```
1. Clone the repository and switch to the app directory:
```bash
git clone https://github.com/radius-project/samples.git
cd samples/reference-apps/eshop
```
1. Deploy the app (choose which type of hosting infrastructure you wish to use):

### Containerized infrastructure

```bash
rad deploy iac/eshop.bicep
```

### Azure infrastructure

```bash
rad deploy iac/eshop.bicep -p platform=azure
```

### AWS infrastructure

```bash
rad deploy iac/eshop.bicep -p platform=aws -p eksClusterName=<YOUR_EKS_CLUSTER_NAME>
```

1. Deploy an environment with the proper Recipes (choose which type of hosting infrastructure you wish to use):
```bash
# Containers - simply initialize a new local-dev environment
rad init

# Azure
rad deploy environments/azure.bicep -p azureSubscriptionId=<your-sub-id> -p azureResourceGroup=<your-resource-group-name>

# AWS
rad deploy environments/aws.bicep -p awsAccountId=<your-aws-account-id> -p awsRegion=<your-aws-region> -p eksClusterName=<your-eks-cluster-name>
```
1. Switch to your new environment (choose which type of hosting infrastructure you wish to use):
```bash
# Containers
rad env switch default

# Azure
rad env switch azure

# AWS
rad env switch aws
```
1. Deploy the application:
```bash
rad deploy eshop.bicep
```
54 changes: 54 additions & 0 deletions samples/eshop/environments/aws.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import radius as rad

@description('Account ID of the AWS account resources should be deployed in')
param awsAccountId string

@description('AWS region that resources should be deployed in')
param awsRegion string

@description('Name of your EKS cluster')
param eksClusterName string

resource environment 'Applications.Core/environments@2023-10-01-preview' = {
name: 'aws'
properties: {
compute: {
kind: 'kubernetes'
resourceId: 'self'
namespace: 'aws'
}
providers: {
aws: {
scope: '/planes/aws/aws/accounts/${awsAccountId}/regions/${awsRegion}'
}
}
recipes: {
'Applications.Datastores/sqlDatabases': {
default: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/aws/sqldatabases:latest'
parameters: {
eksClusterName: eksClusterName
}
}
}
'Applications.Datastores/redisCaches': {
default: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/aws/rediscaches:latest'
parameters: {
eksClusterName: eksClusterName
}
}
}
// Use containerized RabbitMQ instead of Amazon SQS
// https://github.com/radius-project/bicep-types-aws/blob/main/docs/reference/limitations.md
Comment on lines +44 to +45
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a TODO?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly. This is more of a comment of why we're using the local-dev Recipe instead of the Azure service, which is non-idempotent and not supported by Radius. Once we add non-idempotent service support we could come back and update this later.

'Applications.Messaging/rabbitMQQueues': {
default: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/local-dev/rabbitmqqueues:latest'
}
}
}
}
}
43 changes: 43 additions & 0 deletions samples/eshop/environments/azure.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import radius as rad

@description('The name of the Azure resource group where Azure resources will be deployed.')
param azureResourceGroup string

@description('The Azure subscription ID where Azure resources will be deployed.')
param azureSubscriptionId string

resource environment 'Applications.Core/environments@2023-10-01-preview' = {
name: 'azure'
properties: {
compute: {
kind: 'kubernetes'
resourceId: 'self'
namespace: 'azure'
}
providers: {
azure: {
scope: '/subscriptions/${azureSubscriptionId}/resourceGroups/${azureResourceGroup}'
}
}
recipes: {
'Applications.Datastores/sqlDatabases': {
default: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/azure/sqldatabases:latest'
}
}
'Applications.Datastores/redisCaches': {
default: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/azure/rediscaches:latest'
}
}
'Applications.Core/extenders': {
servicebus: {
templateKind: 'bicep'
templatePath: 'ghcr.io/radius-project/recipes/azure/extender-servicebus:latest'
}
}
}
}
}
Loading