Skip to content
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

Upgrade to .NET 6 #66

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -355,5 +355,12 @@ src/web/shrinkwrap.yaml
# git submodules
**/*/healthchecksdb

docker-compose.*.local.yml
tye.*.local.yaml
components/az/

.tye/
.logs/

# rust
**/*/target
128 changes: 128 additions & 0 deletions NET6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# TODO
1. error when do checkout, double-check for saleapp (we might add Azure Service Bus for pubsub)
2. scale rule with http concurrency (10)
3. Traffic spliting (modify web to add rating and split traffic 50/50)

# APIs

## Inventory (Rust)
### Internal HTTP (Dapr)

- POST: get-inventories-by-ids (calls from `product-catalog`)
- Request: InventoryByIdsRequest, GetAvailabilityInventoriesQuery
- Response: IEnumerable<InventoryDto>

- POST: get-inventory-by-id (calls from `product-catalog`)
- Request: InventoryRequest, GetInventoryQuery
- Response: InventoryDto

## Product Catalog (Rust)
### Public HTTP

- GET: api/product-search/{query}/{price}/{page}/{pageSize}
- Request: SearchProductsQuery
- Response: SearchProductsResponse

- GET: api/products/{page}/{price}
- Request: GetProductsByPriceAndNameQuery
- Response: IEnumerable<FlatProductDto>

- GET: api/products/{id}
- Request: GetDetailOfSpecificProductQuery
- Response: FlatProductDto

### Internal HTTP (Dapr)

- POST: get-products-by-ids (not found)
- Request: ProductByIdsRequest, GetProductsByIdsQuery
- Response: IEnumerable<ProductDto>

- POST: get-product-by-id (calls from `shopping-cart`)
- Request: ProductByIdRequest, GetProductsByIdsQuery
- Response: ProductDto

## Shopping Cart (.NET 6)
### Public HTTP

- GET: api/carts
- Request: GetCartByUserIdQuery
- Response: CartDto
- POST: api/carts
- Request: CreateShoppingCartWithProductCommand
- Response: CartDto
- PUT: api/carts
- Request: UpdateAmountOfProductInShoppingCartCommand
- Response: CartDto
- PUT: api/carts/checkout
- Request: CheckOutCommand
- Response: CartDto

## Sale (Golang)
### Public HTTP

- GET: api/orders
- Request: GetOrderListByUserQuery
- Response: IEnumerable<OrderDto>

- POST: api/update-order-status
- Request: OrderWithStatusRequest, UpdateOrderStatusQuery (TODO: Command)
- bool

### Internal Subscriber

- POST: processing-order (subscribe event from `shopping-cart`)
- Request: ShoppingCartCheckedOut (event), CreateOrderQuery (TODO: Command)

### Internal Cron Job (TODO: Refactor to ServerlessWorkflow)

- POST: cron-process-order
- Request: ProcessOrderQuery (TODO: Command)
- POST: cron-complete-order
- Request: CompleteOrderQuery (TODO: Command)

# Get starting

## docker-compose

- Because dev cert isn't working in docker-compose env, so we need to generate the cert just like https://github.com/thangchung/Sample-Docker-Https, and maps it into docker-compose volume

You need to copy the cert at `src/dotnet/certs/localhost.pfx` into `~/.aspnet/https` so that you can map the cert in local path into docker path when run `docker compose -f docker-compose.yml -f docker-compose.override.yml up -d`

See more about this issue at https://github.com/MicrosoftDocs/visualstudio-docs/issues/5733

## tye

```bash
> dotnet dev-certs https -ep aspnetapp.pfx -p P@ssw0rd # then save it to %USERPROFILE%\.aspnet\https
> dotnet dev-certs https --trust
> tye run
```

## Azure Container Apps with Bicep

```powershell
> $rgName="coolstore-rg"
> $location="eastus"
```

```powershell
> az group create -n $rgName -l $location
```

```powershell
> az deployment group create `
--resource-group $rgName `
--template-file main.bicep `
--parameters postgresDbPassword='<postgres password>'
```

```powershell
> az containerapp update `
--name webapigatewayapp `
--resource-group $rgName `
--set-env-vars 'OpenIdConnect__Authority=https://<identityapp url>' 'ReverseProxy__Clusters__appCluster__Destinations__destination1__Address=https://<webapp url>'
```

```powershell
> az group delete -n $rgName
```
10 changes: 4 additions & 6 deletions components/appconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: appconfig
name: daprConfig
spec:
tracing:
enabled: true
exporterType: zipkin
exporterAddress: "http://zipkin:9411/api/v2/spans"
expandParams: true
includeBody: true
samplingRate: "1"
zipkin:
endpointAddress: "http://host.docker.internal:9411/api/v2/spans"
9 changes: 0 additions & 9 deletions components/binding-cron-complete-order.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions components/binding-cron-process-order.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions components/local/appconfig.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions components/local/binding-cron-complete-order.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions components/local/binding-cron-process-order.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions components/local/pubsub.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions components/local/statestore.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions components/local/zipkin.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion components/pubsub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: pubsub
spec:
type: pubsub.redis
version: v1
metadata:
- name: redisHost
value: redis:6379
value: host.docker.internal:6379
- name: redisPassword
value: ""
3 changes: 2 additions & 1 deletion components/statestore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ metadata:
name: statestore
spec:
type: state.redis
version: v1
metadata:
- name: redisHost
value: redis:6379
value: host.docker.internal:6379
- name: redisPassword
value: ""
- name: actorStateStore
Expand Down
11 changes: 0 additions & 11 deletions components/zipkin.yaml

This file was deleted.

Loading