diff --git a/eng/Build.props b/eng/Build.props index e88b2229b..24dca905e 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -5,6 +5,7 @@ + diff --git a/eng/Publishing.props b/eng/Publishing.props index 797de4ea1..988becfc1 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -3,4 +3,48 @@ 3 + + + <_UploadPathRoot>reverse-proxy + + + + $(PublishDependsOnTargets);_PublishBlobItems + + + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', + 'YarpAppArtifacts', '$(Configuration)')) + + + + <_YarpAppFilesToPublish Include="$(YarpAppArtifactsOutputDir)\**\*.zip" /> + + + + + + + + + + + true + true + $(_UploadPathRoot)/$(_PackageVersion)/%(Filename)%(Extension) + + + + \ No newline at end of file diff --git a/eng/Versions.props b/eng/Versions.props index 490314eba..b120ce7d6 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -15,6 +15,7 @@ 8.0.0 8.0.0 8.0.0 + 10.0.0-beta.24613.2 6.0.36 0.2.0-alpha.24576.2 10.0.0-beta.25056.1 @@ -33,5 +34,9 @@ 2.59.4 16.2.1 15.0.1 + + 2.2.0 + 8.2.2 + 8.2.2 diff --git a/eng/yarpapppack/Common.projitems b/eng/yarpapppack/Common.projitems new file mode 100644 index 000000000..98b030a56 --- /dev/null +++ b/eng/yarpapppack/Common.projitems @@ -0,0 +1,43 @@ + + + + + net9.0 + true + true + true + false + $(ArtifactsShippingPackagesDir) + $([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'YarpAppArtifacts', '$(Configuration)')) + + + + + Yarp.Application.$(YarpAppRuntime) + Reverse proxy + + + + + + + + + + + + <_PublishItems Include="$(ArtifactsBinDir)/Yarp.Application/$(Configuration)/$(TargetFramework)/$(YarpAppRuntime)/publish/**/*" /> + + + + + + + + + + + \ No newline at end of file diff --git a/eng/yarpapppack/yarpapppack-linux-arm64.csproj b/eng/yarpapppack/yarpapppack-linux-arm64.csproj new file mode 100644 index 000000000..9ba9dd23f --- /dev/null +++ b/eng/yarpapppack/yarpapppack-linux-arm64.csproj @@ -0,0 +1,10 @@ + + + + linux-arm64 + Unix + + + + + \ No newline at end of file diff --git a/eng/yarpapppack/yarpapppack-linux-x64.csproj b/eng/yarpapppack/yarpapppack-linux-x64.csproj new file mode 100644 index 000000000..8faa02a16 --- /dev/null +++ b/eng/yarpapppack/yarpapppack-linux-x64.csproj @@ -0,0 +1,10 @@ + + + + linux-x64 + Unix + + + + + \ No newline at end of file diff --git a/reverse-proxy.sln b/reverse-proxy.sln index 270f895b1..0aa7451aa 100644 --- a/reverse-proxy.sln +++ b/reverse-proxy.sln @@ -100,6 +100,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Prometheus", "Prometheus", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpLoadApp", "samples\Prometheus\HttpLoadApp\HttpLoadApp.csproj", "{BD73A038-8F3D-4BB2-A5C4-C8D077969DED}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yarp.Application", "src\Application\Yarp.Application.csproj", "{B63DDC4F-DA04-4B03-BF82-302FB3A954D7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -364,6 +366,14 @@ Global {BD73A038-8F3D-4BB2-A5C4-C8D077969DED}.Release|Any CPU.Build.0 = Release|Any CPU {BD73A038-8F3D-4BB2-A5C4-C8D077969DED}.Release|x64.ActiveCfg = Release|Any CPU {BD73A038-8F3D-4BB2-A5C4-C8D077969DED}.Release|x64.Build.0 = Release|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Debug|x64.ActiveCfg = Debug|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Debug|x64.Build.0 = Debug|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Release|Any CPU.Build.0 = Release|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Release|x64.ActiveCfg = Release|Any CPU + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -407,6 +417,7 @@ Global {AC0EF892-7D32-4EAF-BE99-3696181E889F} = {149C61A2-D9F8-49B9-9F9B-3C953FEF53AA} {78A83196-53F3-444B-84BF-F0FDC2CD0466} = {149C61A2-D9F8-49B9-9F9B-3C953FEF53AA} {BD73A038-8F3D-4BB2-A5C4-C8D077969DED} = {78A83196-53F3-444B-84BF-F0FDC2CD0466} + {B63DDC4F-DA04-4B03-BF82-302FB3A954D7} = {6CBE18D4-64E9-492B-BB02-58CD57126C10} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {31F6924A-E427-4830-96E9-B47CEB7BFE78} diff --git a/src/Application/Program.cs b/src/Application/Program.cs new file mode 100644 index 000000000..1f08448ff --- /dev/null +++ b/src/Application/Program.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +// Load configuration +if (args.Length != 1) +{ + Console.Error.WriteLine("Usage: yarp.exe "); + return 1; +} +var configFile = args[0]; +var fileInfo = new FileInfo(configFile); +if (!fileInfo.Exists) +{ + Console.Error.WriteLine($"Could not find '{configFile}'."); + return 2; +} + +var builder = WebApplication.CreateBuilder(); +builder.Configuration.AddJsonFile(fileInfo.FullName, optional: false, reloadOnChange: true); + +// Configure YARP +builder.Services.AddServiceDiscovery(); +builder.Services.AddReverseProxy() + .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")) + .AddServiceDiscoveryDestinationResolver(); + +Console.WriteLine(builder.Configuration.GetSection("ReverseProxy").Value); + +var app = builder.Build(); +app.MapReverseProxy(); + +await app.RunAsync(); + +return 0; diff --git a/src/Application/Yarp.Application.csproj b/src/Application/Yarp.Application.csproj new file mode 100644 index 000000000..64c247854 --- /dev/null +++ b/src/Application/Yarp.Application.csproj @@ -0,0 +1,21 @@ + + + + Exe + win-x64;win-arm64;linux-x64;linux-arm64; + net8.0;net9.0 + enable + enable + yarp + + + + + + + + + + + +