- Published on
Yarp and Tye
📖2 min read
Series: .NET Microservice with ABP
This post is part of the .NET Microservice with ABP series.
Table of Contents
This is seventh post of the series: .NET Microservice with ABP
Posts in the Series
Part 3. Administration Service
Part 7. Yarp and Tye (this post)
Part 8. Identity server and Angular App
Tye
Lets init the tye.
Install tye
bash
dotnet tool install -g Microsoft.Tye --version "0.11.0-alpha.22111.1"
Init Tye
bash
tye init --force
This will generate a tye.yaml file.
yaml
name: tasky
services:
- name: tasky-identityserver
project: apps/Tasky.IdentityServer/Tasky.IdentityServer.csproj
bindings:
- protocol: https
port: 7000
- name: tasky-gateway
project: gateway/Tasky.Gateway/Tasky.Gateway.csproj
bindings:
- protocol: https
port: 7500
- name: tasky-administrationservice-httpapi-host
project: services/administration/host/Tasky.AdministrationService.HttpApi.Host/Tasky.AdministrationService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 7001
- name: tasky-identityservice-httpapi-host
project: services/identity/host/Tasky.IdentityService.HttpApi.Host/Tasky.IdentityService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 7002
- name: tasky-saasservice-httpapi-host
project: services/saas/host/Tasky.SaaSService.HttpApi.Host/Tasky.SaaSService.HttpApi.Host.csproj
bindings:
- protocol: https
port: 7003
Run Tye
bash
tye run --watch
Yarp
Yarp is our proxy server which will redirect the request to other services. So lets update the Tasky.Gateway.
Install nuget
xml
<PackageReference Include="Yarp.ReverseProxy" Version="1.0.0" />
Update the Program.cs
cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.MapReverseProxy();
app.Run();
Update appsettings.json
json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ReverseProxy": {
"Routes": {
"main": {
"ClusterId": "main",
"Match": {
"Path": "{**catch-all}"
}
},
"identity": {
"ClusterId": "identity",
"Match": {
"Path": "/api/identity/{*any}"
}
},
"account": {
"ClusterId": "account",
"Match": {
"Path": "/api/account/{*any}"
}
},
"saas": {
"ClusterId": "saas",
"Match": {
"Path": "/api/multi-tenancy/{*any}"
}
}
},
"Clusters": {
"main": {
"Destinations": {
"main": {
"Address": "https://localhost:7001"
}
}
},
"identity": {
"Destinations": {
"identity": {
"Address": "https://localhost:7002"
}
}
},
"account": {
"Destinations": {
"account": {
"Address": "https://localhost:7002"
}
}
},
"saas": {
"Destinations": {
"saas": {
"Address": "https://localhost:7003"
}
}
}
}
}
}
Related Posts
Continue reading with these related articles
5 min read
.NET Microservice with ABPPart 14
Migrating Tye to Aspire
In this post we will see how to migrate the Tye to Aspire
abpaspire
Read article
4 min read
.NET Microservice with ABPPart 14
.Net Microservice template with ABP
In this post I will show you how to create ABP microservice using a dotnet new template.
microserviceabpdotnet
Read article
9 min read
.NET Microservice with ABPPart 13
Migrating Identity Service to OpenIddict Module
In this post we will see how to replace Identity server with OpenIddict in our microservice
abpidentity-serveropeniddict+1 more
Read article