-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
06-composition-via-yarp-and-esi (#22)
* Scaffolding an ESI processor * Adding choose, comment, remove, and vars ESI elements * Adding try ESI element * Adding include ESI element * Adding actions workflow
- Loading branch information
Showing
48 changed files
with
1,236 additions
and
133 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: 06-composition-via-yarp-and-esi | ||
on: workflow_dispatch | ||
permissions: | ||
id-token: write | ||
contents: read | ||
env: | ||
SAMPLE: 06-composition-via-yarp-and-esi | ||
LOCATION: westeurope | ||
RESOURCE_GROUP: rg-micro-frontends-in-action-06 | ||
MANAGED_IDENTITY: id-micro-frontends-in-action-06 | ||
CONTAINER_REGISTRY: crmicrofrontendsinaction06 | ||
CONTAINERAPPS_ENVIRONMENT: ca-env-micro-frontends-in-action-06 | ||
DECIDE_CONTAINERAPP: ca-app-decide | ||
INSPIRE_CONTAINERAPP: ca-app-inspire | ||
PROXY_CONTAINERAPP: ca-app-proxy | ||
jobs: | ||
deploy-infrastructure: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Log in to Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
- name: Deploy Infrastructure | ||
uses: azure/arm-deploy@v2 | ||
with: | ||
scope: subscription | ||
region: ${{ env.LOCATION }} | ||
template: ./bicep-modules/micro-frontends-in-action-infrastructure.bicep | ||
deploymentName: 'micro-frontends-in-action-05-iac' | ||
parameters: 'resourceGroupName=${{ env.RESOURCE_GROUP }} resourceGroupLocation=${{ env.LOCATION }} managedIdentityName=${{ env.MANAGED_IDENTITY }} containerRegistryName=${{ env.CONTAINER_REGISTRY }} containerAppsEnvironmentName=${{ env.CONTAINERAPPS_ENVIRONMENT }}' | ||
- name: Log Out From Azure | ||
run: | | ||
az logout | ||
az cache purge | ||
az account clear | ||
deliver-images: | ||
needs: [deploy-infrastructure] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Log in to Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
- name: Log in to Container Registry | ||
run: az acr login -n ${CONTAINER_REGISTRY} | ||
- name: Build Docker Images | ||
run: | | ||
docker build ${SAMPLE}/Demo.AspNetCore.MicroFrontendsInAction.Decide/ -t ${CONTAINER_REGISTRY}.azurecr.io/decide:${{ github.sha }} | ||
docker build ${SAMPLE}/Demo.AspNetCore.MicroFrontendsInAction.Inspire/ -t ${CONTAINER_REGISTRY}.azurecr.io/inspire:${{ github.sha }} | ||
docker build ${SAMPLE}/Demo.AspNetCore.MicroFrontendsInAction.Proxy/ -t ${CONTAINER_REGISTRY}.azurecr.io/proxy:${{ github.sha }} | ||
- name: Push Docker Images to Container Registry | ||
run: | | ||
docker push ${CONTAINER_REGISTRY}.azurecr.io/decide:${{ github.sha }} | ||
docker push ${CONTAINER_REGISTRY}.azurecr.io/inspire:${{ github.sha }} | ||
docker push ${CONTAINER_REGISTRY}.azurecr.io/proxy:${{ github.sha }} | ||
- name: Log Out From Azure | ||
run: | | ||
docker logout | ||
az logout | ||
az cache purge | ||
az account clear | ||
deploy-container-apps: | ||
needs: [deploy-infrastructure, deliver-images] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Log in to Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
- name: Deploy Container Apps | ||
uses: azure/arm-deploy@v2 | ||
with: | ||
scope: resourcegroup | ||
resourceGroupName: ${{ env.RESOURCE_GROUP }} | ||
template: ./bicep-modules/micro-frontends-in-action-deployment.bicep | ||
deploymentName: 'micro-frontends-in-action-05-cd' | ||
parameters: 'location=${{ env.LOCATION }} managedIdentityName=${{ env.MANAGED_IDENTITY }} containerRegistryName=${{ env.CONTAINER_REGISTRY }} containerAppsEnvironmentName=${{ env.CONTAINERAPPS_ENVIRONMENT }} microFrontendsContainerAppsDetails="[{\"name\":\"${{ env.DECIDE_CONTAINERAPP }}\",\"imageName\":\"decide\",\"imageTag\":\"${{ github.sha }}\",\"port\":3001,\"urlVariableName\":\"DECIDE_SERVICE_URL\"},{\"name\":\"${{ env.INSPIRE_CONTAINERAPP }}\",\"imageName\":\"inspire\",\"imageTag\":\"${{ github.sha }}\",\"port\":3002,\"urlVariableName\":\"INSPIRE_SERVICE_URL\"}]" microFrontendsProxyContainerAppDetails="{\"name\":\"${{ env.PROXY_CONTAINERAPP }}\",\"imageName\":\"proxy\",\"imageTag\":\"${{ github.sha }}\",\"port\":3000}"' | ||
- name: Log Out From Azure | ||
run: | | ||
az logout | ||
az cache purge | ||
az account clear |
22 changes: 0 additions & 22 deletions
22
...ndsInAction.ServiceDefaults/Demo.AspNetCore.MicroFrontendsInAction.ServiceDefaults.csproj
This file was deleted.
Oops, something went wrong.
111 changes: 0 additions & 111 deletions
111
...ion-via-yarp-and-ssi/Demo.AspNetCore.MicroFrontendsInAction.ServiceDefaults/Extensions.cs
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
18 changes: 18 additions & 0 deletions
18
...Core.MicroFrontendsInAction.AppHost/Demo.AspNetCore.MicroFrontendsInAction.AppHost.csproj
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,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsAspireHost>true</IsAspireHost> | ||
<UserSecretsId>44dc8d10-b76f-423e-86c0-303c292b565e</UserSecretsId> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.0.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Demo.AspNetCore.MicroFrontendsInAction.Decide\Demo.AspNetCore.MicroFrontendsInAction.Decide.csproj" /> | ||
<ProjectReference Include="..\Demo.AspNetCore.MicroFrontendsInAction.Inspire\Demo.AspNetCore.MicroFrontendsInAction.Inspire.csproj" /> | ||
<ProjectReference Include="..\Demo.AspNetCore.MicroFrontendsInAction.Proxy\Demo.AspNetCore.MicroFrontendsInAction.Proxy.csproj" /> | ||
</ItemGroup> | ||
</Project> |
10 changes: 10 additions & 0 deletions
10
06-composition-via-yarp-and-esi/Demo.AspNetCore.MicroFrontendsInAction.AppHost/Program.cs
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,10 @@ | ||
var builder = DistributedApplication.CreateBuilder(args); | ||
|
||
var decideApplication = builder.AddProject<Projects.Demo_AspNetCore_MicroFrontendsInAction_Decide>("ca-app-decide"); | ||
var inspireApplication = builder.AddProject<Projects.Demo_AspNetCore_MicroFrontendsInAction_Inspire>("ca-app-inspire"); | ||
|
||
builder.AddProject<Projects.Demo_AspNetCore_MicroFrontendsInAction_Proxy>("ca-app-proxy") | ||
.WithEnvironment("DECIDE_SERVICE_URL", decideApplication.GetEndpoint("http")) | ||
.WithEnvironment("INSPIRE_SERVICE_URL", inspireApplication.GetEndpoint("http")); | ||
|
||
builder.Build().Run(); |
29 changes: 29 additions & 0 deletions
29
...arp-and-esi/Demo.AspNetCore.MicroFrontendsInAction.AppHost/Properties/launchSettings.json
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,29 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:17060;http://localhost:15048", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21287", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22291" | ||
} | ||
}, | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "http://localhost:15048", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development", | ||
"DOTNET_ENVIRONMENT": "Development", | ||
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19226", | ||
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20292" | ||
} | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...-yarp-and-esi/Demo.AspNetCore.MicroFrontendsInAction.AppHost/appsettings.Development.json
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,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...position-via-yarp-and-esi/Demo.AspNetCore.MicroFrontendsInAction.AppHost/appsettings.json
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,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning", | ||
"Aspire.Hosting.Dcp": "Warning" | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...p-and-esi/Demo.AspNetCore.MicroFrontendsInAction.Decide/Controllers/ProductsController.cs
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,20 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Demo.AspNetCore.MicroFrontendsInAction.Decide.Models; | ||
|
||
namespace Demo.AspNetCore.MicroFrontendsInAction.Decide.Controllers | ||
{ | ||
public class ProductsController : Controller | ||
{ | ||
private static readonly IReadOnlyDictionary<string, ProductViewModel> _products = new Dictionary<string, ProductViewModel> | ||
{ | ||
{ "eicher", new ProductViewModel("eicher", "Eicher Diesel 215/16") }, | ||
{ "fendt", new ProductViewModel("fendt", "Fendt F20 Dieselroß") }, | ||
{ "porsche", new ProductViewModel("porsche", "Porsche-Diesel Master 419") } | ||
}; | ||
|
||
public IActionResult Product(string id) | ||
{ | ||
return View(_products[id.ToLowerInvariant()]); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...etCore.MicroFrontendsInAction.Decide/Demo.AspNetCore.MicroFrontendsInAction.Decide.csproj
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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<RootNamespace>Demo.AspNetCore.MicroFrontendsInAction.Decide</RootNamespace> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Update="wwwroot\decide\static\outlines.css"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
<Content Update="wwwroot\decide\static\page.css"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
<Content Update="wwwroot\decide\static\page.js"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.