-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add eshop on recipes reference application #553
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# eShop on Recipes reference application | ||
|
||
## Source | ||
|
||
This reference app is a "radified" version of the [eShop on containers](https://github.com/dotnet-architecture/eShopOnContainers) .NET reference application. | ||
|
||
## Deploy | ||
|
||
1. Have a kubernetes cluster handy from the [supported clusters](https://docs.radapp.dev/operations/platforms/kubernetes/supported-clusters/). | ||
- (AWS only) Make sure that each of the Subnets in your EKS cluster Subnet Group are within the list of [supported MemoryDB availability zones](https://docs.aws.amazon.com/memorydb/latest/devguide/subnetgroups.html) | ||
1. [Install the rad CLI](https://radapp.dev/getting-started/) | ||
1. [Initialize a new Radius environment](https://radapp.dev/getting-started/) | ||
1. Clone the repository and switch to the app directory: | ||
```bash | ||
git clone https://github.com/project-radius/samples.git | ||
cd samples/reference-apps/eshop | ||
``` | ||
1. Deploy the environment (choose which type of hosting infrastructure you wish to use): | ||
```bash | ||
# AWS | ||
rad deploy iac/environments/aws.bicep | ||
|
||
# Azure | ||
rad deploy iac/environments/azure.bicep | ||
|
||
# Containers | ||
rad deploy iac/environments/containers.bicep | ||
``` | ||
1. Deploy the application: | ||
```bash | ||
rad deploy iac/eshop.bicep | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM envoyproxy/envoy:v1.11.1 | ||
COPY envoy.yaml /etc/envoy/envoy.yaml | ||
CMD ["/usr/local/bin/envoy", "-c", "/etc/envoy/envoy.yaml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Envoy for eshop | ||
|
||
Eshop uses an internal gateway to route requests between different services. Today in Radius, we don't support private/internal gateways (see https://github.com/project-radius/radius/issues/4789), so we created a custom image of envoy with the routing rules necessary to make eshop work. | ||
|
||
What this means is that if we need to update the names of routes in eshop, *we likely need to update the envoy image*. | ||
|
||
The routing configuration is in [envoy.yaml](envoy.yaml). See the `route_config` section specifically. | ||
|
||
To build the docker image, run `docker build . -t radius.azurecr.io/eshop-envoy:0.1.<NUMBER>`. | ||
|
||
Where NUMBER is one greater than the latest version made. To view versions, see https://ms.portal.azure.com/#view/Microsoft_Azure_ContainerRegistries/RepositoryBlade/id/%2Fsubscriptions%2F66d1209e-1382-45d3-99bb-650e6bf63fc0%2FresourceGroups%2Fassets%2Fproviders%2FMicrosoft.ContainerRegistry%2Fregistries%2Fradius/repository/eshop-envoy. | ||
|
||
To push the image, run `az acr login -n radius` and then `docker push radius.azurecr.io/eshop-envoy:0.1.<NUMBER>`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
admin: | ||
access_log_path: "/dev/stdout" | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 8001 | ||
static_resources: | ||
listeners: | ||
- address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 80 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.http_connection_manager | ||
config: | ||
codec_type: auto | ||
stat_prefix: ingress_http | ||
route_config: | ||
name: eshop_backend_route | ||
virtual_hosts: | ||
- name: eshop_backend | ||
domains: | ||
- "*" | ||
routes: | ||
- name: "c-short" | ||
match: | ||
prefix: "/webshoppingapigw/c/" | ||
route: | ||
auto_host_rewrite: true | ||
prefix_rewrite: "/catalog-api/" | ||
cluster: catalog | ||
- name: "c-long" | ||
match: | ||
prefix: "/webshoppingapigw/catalog-api/" | ||
route: | ||
auto_host_rewrite: true | ||
cluster: catalog | ||
- name: "o-short" | ||
match: | ||
prefix: "/webshoppingapigw/o/" | ||
route: | ||
auto_host_rewrite: true | ||
prefix_rewrite: "/ordering-api/" | ||
cluster: ordering | ||
- name: "o-long" | ||
match: | ||
prefix: "/webshoppingapigw/ordering-api/" | ||
route: | ||
auto_host_rewrite: true | ||
cluster: ordering | ||
- name: "h-long" | ||
match: | ||
prefix: "/webshoppingapigw/hub/notificationhub" | ||
route: | ||
auto_host_rewrite: true | ||
cluster: signalr-hub | ||
timeout: 300s | ||
upgrade_configs: | ||
upgrade_type: "websocket" | ||
enabled: true | ||
- name: "b-short" | ||
match: | ||
prefix: "/webshoppingapigw/b/" | ||
route: | ||
auto_host_rewrite: true | ||
prefix_rewrite: "/basket-api/" | ||
cluster: basket | ||
- name: "b-long" | ||
match: | ||
prefix: "/webshoppingapigw/basket-api/" | ||
route: | ||
auto_host_rewrite: true | ||
cluster: basket | ||
- name: "agg" | ||
match: | ||
prefix: "/webshoppingapigw/" | ||
route: | ||
auto_host_rewrite: true | ||
prefix_rewrite: "/" | ||
cluster: shoppingagg | ||
http_filters: | ||
- name: envoy.router | ||
access_log: | ||
- name: envoy.file_access_log | ||
filter: | ||
not_health_check_filter: {} | ||
config: | ||
json_format: | ||
time: "%START_TIME%" | ||
protocol: "%PROTOCOL%" | ||
duration: "%DURATION%" | ||
request_method: "%REQ(:METHOD)%" | ||
request_host: "%REQ(HOST)%" | ||
path: "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%" | ||
response_flags: "%RESPONSE_FLAGS%" | ||
route_name: "%ROUTE_NAME%" | ||
upstream_host: "%UPSTREAM_HOST%" | ||
upstream_cluster: "%UPSTREAM_CLUSTER%" | ||
upstream_local_address: "%UPSTREAM_LOCAL_ADDRESS%" | ||
path: "/tmp/access.log" | ||
clusters: | ||
- name: shoppingagg | ||
connect_timeout: 0.25s | ||
type: strict_dns | ||
lb_policy: round_robin | ||
hosts: | ||
- socket_address: | ||
address: webshoppingagg-http | ||
port_value: 5121 | ||
- name: catalog | ||
connect_timeout: 0.25s | ||
type: strict_dns | ||
lb_policy: round_robin | ||
hosts: | ||
- socket_address: | ||
address: catalog-http | ||
port_value: 5101 | ||
- name: basket | ||
connect_timeout: 0.25s | ||
type: strict_dns | ||
lb_policy: round_robin | ||
hosts: | ||
- socket_address: | ||
address: basket-http | ||
port_value: 5103 | ||
- name: ordering | ||
connect_timeout: 0.25s | ||
type: strict_dns | ||
lb_policy: round_robin | ||
hosts: | ||
- socket_address: | ||
address: ordering-http | ||
port_value: 5102 | ||
- name: signalr-hub | ||
connect_timeout: 0.25s | ||
type: strict_dns | ||
lb_policy: round_robin | ||
hosts: | ||
- socket_address: | ||
address: orderingsignalrhub-http | ||
port_value: 5112 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
reference-apps/eshop-recipes/iac/environments/containers.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making this a separate app let's just go ahead and have one version of eshop that's Recipes. No need to retain the old one.