mirror of https://github.com/dotnet/tye.git
committed by
GitHub
135 changed files with 1854 additions and 960 deletions
@ -1,161 +0,0 @@ |
|||
kind: Deployment |
|||
apiVersion: apps/v1 |
|||
metadata: |
|||
name: backend |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app.kubernetes.io/name: backend |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
containers: |
|||
- name: backend |
|||
image: rynowak/backend:0.1.18-alpha.gbab4910d38 |
|||
env: |
|||
- name: ASPNETCORE_URLS |
|||
value: http://*:7000 |
|||
- name: SERVICE__FRONTEND__PORT |
|||
value: '8000' |
|||
- name: SERVICE__FRONTEND__HOST |
|||
value: 'frontend' |
|||
volumeMounts: |
|||
- name: rabbit-rabbit |
|||
mountPath: /var/tye/bindings/rabbit-rabbit |
|||
readOnly: true |
|||
ports: |
|||
- containerPort: 7000 |
|||
volumes: |
|||
- name: rabbit-rabbit |
|||
secret: |
|||
secretName: binding-production-rabbit-rabbit-secret |
|||
items: |
|||
- key: connectionstring |
|||
path: CONNECTIONSTRINGS__RABBIT |
|||
... |
|||
--- |
|||
kind: Service |
|||
apiVersion: v1 |
|||
metadata: |
|||
name: backend |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
selector: |
|||
app.kubernetes.io/name: backend |
|||
type: ClusterIP |
|||
ports: |
|||
- name: backend |
|||
protocol: TCP |
|||
port: 7000 |
|||
targetPort: 7000 |
|||
... |
|||
--- |
|||
kind: Deployment |
|||
apiVersion: apps/v1 |
|||
metadata: |
|||
name: frontend |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app.kubernetes.io/name: frontend |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
containers: |
|||
- name: frontend |
|||
image: rynowak/frontend:0.1.18-alpha.gbab4910d38 |
|||
env: |
|||
- name: ASPNETCORE_URLS |
|||
value: http://*:8000 |
|||
- name: SERVICE__BACKEND__PORT |
|||
value: '7000' |
|||
- name: SERVICE__BACKEND__HOST |
|||
value: 'backend' |
|||
volumeMounts: |
|||
- name: rabbit-rabbit |
|||
mountPath: /var/tye/bindings/rabbit-rabbit |
|||
readOnly: true |
|||
ports: |
|||
- containerPort: 8000 |
|||
volumes: |
|||
- name: rabbit-rabbit |
|||
secret: |
|||
secretName: binding-production-rabbit-rabbit-secret |
|||
items: |
|||
- key: connectionstring |
|||
path: CONNECTIONSTRINGS__RABBIT |
|||
... |
|||
--- |
|||
kind: Service |
|||
apiVersion: v1 |
|||
metadata: |
|||
name: frontend |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
selector: |
|||
app.kubernetes.io/name: frontend |
|||
type: ClusterIP |
|||
ports: |
|||
- name: frontend |
|||
protocol: TCP |
|||
port: 8000 |
|||
targetPort: 8000 |
|||
... |
|||
--- |
|||
kind: Deployment |
|||
apiVersion: apps/v1 |
|||
metadata: |
|||
name: worker |
|||
labels: |
|||
app.kubernetes.io/name: worker |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app.kubernetes.io/name: worker |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app.kubernetes.io/name: worker |
|||
app.kubernetes.io/part-of: multi-project |
|||
spec: |
|||
containers: |
|||
- name: worker |
|||
image: rynowak/worker:0.1.18-alpha.gbab4910d38 |
|||
env: |
|||
- name: SERVICE__BACKEND__PORT |
|||
value: '7000' |
|||
- name: SERVICE__BACKEND__HOST |
|||
value: 'backend' |
|||
- name: SERVICE__FRONTEND__PORT |
|||
value: '8000' |
|||
- name: SERVICE__FRONTEND__HOST |
|||
value: 'frontend' |
|||
volumeMounts: |
|||
- name: rabbit-rabbit |
|||
mountPath: /var/tye/bindings/rabbit-rabbit |
|||
readOnly: true |
|||
volumes: |
|||
- name: rabbit-rabbit |
|||
secret: |
|||
secretName: binding-production-rabbit-rabbit-secret |
|||
items: |
|||
- key: connectionstring |
|||
path: CONNECTIONSTRINGS__RABBIT |
|||
... |
|||
@ -0,0 +1,114 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System.Linq; |
|||
using Microsoft.Tye.ConfigModel; |
|||
using Xunit; |
|||
|
|||
namespace E2ETest |
|||
{ |
|||
public static class TyeAssert |
|||
{ |
|||
public static void Equal(ConfigApplication expected, ConfigApplication actual) |
|||
{ |
|||
Assert.Equal(expected.Name, actual.Name); |
|||
Assert.Equal(expected.Registry, actual.Registry); |
|||
Assert.Equal(expected.Network, actual.Network); |
|||
|
|||
foreach (var ingress in actual.Ingress) |
|||
{ |
|||
var otherIngress = expected |
|||
.Ingress |
|||
.Where(o => o.Name == ingress.Name) |
|||
.Single(); |
|||
Assert.NotNull(otherIngress); |
|||
Assert.Equal(otherIngress.Replicas, ingress.Replicas); |
|||
|
|||
foreach (var rule in ingress.Rules) |
|||
{ |
|||
var otherRule = otherIngress |
|||
.Rules |
|||
.Where(o => o.Path == rule.Path && o.Host == rule.Host && o.Service == rule.Service) |
|||
.Single(); |
|||
Assert.NotNull(otherRule); |
|||
} |
|||
|
|||
foreach (var binding in ingress.Bindings) |
|||
{ |
|||
var otherBinding = otherIngress |
|||
.Bindings |
|||
.Where(o => o.Name == binding.Name && o.Port == binding.Port && o.Protocol == binding.Protocol) |
|||
.Single(); |
|||
|
|||
Assert.NotNull(otherBinding); |
|||
} |
|||
} |
|||
|
|||
foreach (var service in actual.Services) |
|||
{ |
|||
var otherService = expected |
|||
.Services |
|||
.Where(o => o.Name == service.Name) |
|||
.Single(); |
|||
Assert.NotNull(otherService); |
|||
Assert.Equal(otherService.Args, service.Args); |
|||
Assert.Equal(otherService.Build, service.Build); |
|||
Assert.Equal(otherService.Executable, service.Executable); |
|||
Assert.Equal(otherService.External, service.External); |
|||
Assert.Equal(otherService.Image, service.Image); |
|||
Assert.Equal(otherService.Project, service.Project); |
|||
Assert.Equal(otherService.Replicas, service.Replicas); |
|||
Assert.Equal(otherService.WorkingDirectory, service.WorkingDirectory); |
|||
|
|||
foreach (var binding in service.Bindings) |
|||
{ |
|||
var otherBinding = otherService.Bindings |
|||
.Where(o => o.Name == binding.Name |
|||
&& o.Port == binding.Port |
|||
&& o.Protocol == binding.Protocol |
|||
&& o.ConnectionString == binding.ConnectionString |
|||
&& o.ContainerPort == binding.ContainerPort |
|||
&& o.Host == binding.Host) |
|||
.Single(); |
|||
|
|||
Assert.NotNull(otherBinding); |
|||
} |
|||
|
|||
foreach (var binding in service.Bindings) |
|||
{ |
|||
var otherBinding = otherService.Bindings |
|||
.Where(o => o.Name == binding.Name |
|||
&& o.Port == binding.Port |
|||
&& o.Protocol == binding.Protocol |
|||
&& o.ConnectionString == binding.ConnectionString |
|||
&& o.ContainerPort == binding.ContainerPort |
|||
&& o.Host == binding.Host) |
|||
.Single(); |
|||
|
|||
Assert.NotNull(otherBinding); |
|||
} |
|||
|
|||
foreach (var config in service.Configuration) |
|||
{ |
|||
var otherConfig = otherService.Configuration |
|||
.Where(o => o.Name == config.Name |
|||
&& o.Value == config.Value) |
|||
.Single(); |
|||
|
|||
Assert.NotNull(otherConfig); |
|||
} |
|||
|
|||
foreach (var volume in service.Volumes) |
|||
{ |
|||
var otherVolume = otherService.Volumes |
|||
.Where(o => o.Name == volume.Name |
|||
&& o.Target == volume.Target |
|||
&& o.Source == volume.Source) |
|||
.Single(); |
|||
Assert.NotNull(otherVolume); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
# tye application configuration file |
|||
# read all about it at https://github.com/dotnet/tye |
|||
# |
|||
# when you've given us a try, we'd love to know what you think: |
|||
# https://aka.ms/AA7q20u |
|||
# |
|||
name: test-project |
|||
services: |
|||
- name: test-project |
|||
project: test-project.csproj |
|||
@ -0,0 +1,7 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace ApplicationA |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:2755", |
|||
"sslPort": 44369 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"ApplicationA": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace ApplicationA |
|||
{ |
|||
public class Startup |
|||
{ |
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
|||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
} |
|||
|
|||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapGet("/", async context => |
|||
{ |
|||
await context.Response.WriteAsync("Hello from Application A " + Environment.GetEnvironmentVariable("APP_INSTANCE") ?? Environment.GetEnvironmentVariable("HOSTNAME")); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,26 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace ApplicationB |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:19251", |
|||
"sslPort": 44343 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"ApplicationB": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace ApplicationB |
|||
{ |
|||
public class Startup |
|||
{ |
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
|||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
} |
|||
|
|||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapGet("/", async context => |
|||
{ |
|||
await context.Response.WriteAsync("Hello from Application B " + Environment.GetEnvironmentVariable("APP_INSTANCE") ?? Environment.GetEnvironmentVariable("HOSTNAME")); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio 15 |
|||
VisualStudioVersion = 15.0.26124.0 |
|||
MinimumVisualStudioVersion = 15.0.26124.0 |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationA", "ApplicationA\ApplicationA.csproj", "{5A9DC239-55BB-4951-B081-35931BF8C867}" |
|||
EndProject |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationB", "ApplicationB\ApplicationB.csproj", "{AE1F10D3-BFAE-4D23-ADCF-06770237285D}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Debug|x64 = Debug|x64 |
|||
Debug|x86 = Debug|x86 |
|||
Release|Any CPU = Release|Any CPU |
|||
Release|x64 = Release|x64 |
|||
Release|x86 = Release|x86 |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x64.ActiveCfg = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x64.Build.0 = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x86.ActiveCfg = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Debug|x86.Build.0 = Debug|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x64.ActiveCfg = Release|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x64.Build.0 = Release|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x86.ActiveCfg = Release|Any CPU |
|||
{5A9DC239-55BB-4951-B081-35931BF8C867}.Release|x86.Build.0 = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x64.ActiveCfg = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x64.Build.0 = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x86.ActiveCfg = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Debug|x86.Build.0 = Debug|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x64.ActiveCfg = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x64.Build.0 = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x86.ActiveCfg = Release|Any CPU |
|||
{AE1F10D3-BFAE-4D23-ADCF-06770237285D}.Release|x86.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,28 @@ |
|||
# tye application configuration file |
|||
# read all about it at https://github.com/dotnet/tye |
|||
# |
|||
# when you've given us a try, we'd love to know what you think: |
|||
# https://aka.ms/AA7q20u |
|||
# |
|||
name: apps-with-ingress |
|||
ingress: |
|||
- name: ingress |
|||
bindings: |
|||
- port: 8080 |
|||
rules: |
|||
- path: /A |
|||
service: appA |
|||
- path: /B |
|||
service: appB |
|||
- host: a.example.com |
|||
service: appA |
|||
- host: b.example.com |
|||
service: appB |
|||
|
|||
services: |
|||
- name: appA |
|||
project: ApplicationA/ApplicationA.csproj |
|||
replicas: 2 |
|||
- name: appB |
|||
project: ApplicationB/ApplicationB.csproj |
|||
replicas: 2 |
|||
@ -0,0 +1,24 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:21017", |
|||
"sslPort": 44378 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"backend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5002;http://localhost:5003", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System.Net; |
|||
using System.Text.Json; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Http.Features; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
private readonly JsonSerializerOptions options = new JsonSerializerOptions() |
|||
{ |
|||
PropertyNameCaseInsensitive = true, |
|||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, |
|||
}; |
|||
|
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapGet("/", async context => |
|||
{ |
|||
var backendInfo = new BackendInfo() |
|||
{ |
|||
IP = context.Connection.LocalIpAddress.ToString(), |
|||
Hostname = Dns.GetHostName(), |
|||
}; |
|||
|
|||
context.Response.ContentType = "application/json; charset=utf-8"; |
|||
await JsonSerializer.SerializeAsync(context.Response.Body, backendInfo); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
class BackendInfo |
|||
{ |
|||
public string IP { get; set; } = default!; |
|||
|
|||
public string Hostname { get; set; } = default!; |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace>Backend</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,99 @@ |
|||
kind: Deployment |
|||
apiVersion: apps/v1 |
|||
metadata: |
|||
name: backend |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app.kubernetes.io/name: backend |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
containers: |
|||
- name: backend |
|||
image: rynowak/backend:0.1.17-alpha.gd8612934f5 |
|||
env: |
|||
- name: ASPNETCORE_URLS |
|||
value: http://*:5050 |
|||
- name: SERVICE__FRONTEND__PORT |
|||
value: '5051' |
|||
- name: SERVICE__FRONTEND__HOST |
|||
value: 'frontend' |
|||
ports: |
|||
- containerPort: 5050 |
|||
... |
|||
--- |
|||
kind: Service |
|||
apiVersion: v1 |
|||
metadata: |
|||
name: backend |
|||
labels: |
|||
app.kubernetes.io/name: backend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
selector: |
|||
app.kubernetes.io/name: backend |
|||
type: ClusterIP |
|||
ports: |
|||
- name: web |
|||
protocol: TCP |
|||
port: 5050 |
|||
targetPort: 5050 |
|||
... |
|||
--- |
|||
kind: Deployment |
|||
apiVersion: apps/v1 |
|||
metadata: |
|||
name: frontend |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
selector: |
|||
matchLabels: |
|||
app.kubernetes.io/name: frontend |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
containers: |
|||
- name: frontend |
|||
image: rynowak/frontend:0.1.17-alpha.gd8612934f5 |
|||
env: |
|||
- name: ASPNETCORE_URLS |
|||
value: http://*:5051 |
|||
- name: SERVICE__BACKEND__PORT |
|||
value: '5050' |
|||
- name: SERVICE__BACKEND__HOST |
|||
value: 'backend' |
|||
ports: |
|||
- containerPort: 5051 |
|||
... |
|||
--- |
|||
kind: Service |
|||
apiVersion: v1 |
|||
metadata: |
|||
name: frontend |
|||
labels: |
|||
app.kubernetes.io/name: frontend |
|||
app.kubernetes.io/part-of: frontend-backend |
|||
spec: |
|||
selector: |
|||
app.kubernetes.io/name: frontend |
|||
type: ClusterIP |
|||
ports: |
|||
- name: web |
|||
protocol: TCP |
|||
port: 5051 |
|||
targetPort: 5051 |
|||
... |
|||
tPort: 5051 |
|||
... |
|||
@ -0,0 +1,48 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio 15 |
|||
VisualStudioVersion = 15.0.26124.0 |
|||
MinimumVisualStudioVersion = 15.0.26124.0 |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "backend", "backend\backend.csproj", "{E900C6D9-7A87-49E3-93E5-97E6402E3939}" |
|||
EndProject |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "frontend", "frontend\frontend.csproj", "{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Debug|x64 = Debug|x64 |
|||
Debug|x86 = Debug|x86 |
|||
Release|Any CPU = Release|Any CPU |
|||
Release|x64 = Release|x64 |
|||
Release|x86 = Release|x86 |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x64.ActiveCfg = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x64.Build.0 = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x86.ActiveCfg = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Debug|x86.Build.0 = Debug|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x64.ActiveCfg = Release|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x64.Build.0 = Release|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x86.ActiveCfg = Release|Any CPU |
|||
{E900C6D9-7A87-49E3-93E5-97E6402E3939}.Release|x86.Build.0 = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x64.ActiveCfg = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x64.Build.0 = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x86.ActiveCfg = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Debug|x86.Build.0 = Debug|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x64.ActiveCfg = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x64.Build.0 = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x86.ActiveCfg = Release|Any CPU |
|||
{3BCACB4B-8506-4A5C-B4EE-FC76627EBE11}.Release|x86.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,24 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:16377", |
|||
"sslPort": 44392 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"frontend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using System.Linq; |
|||
using System.Net; |
|||
using System.Net.Http; |
|||
using System.Text.Json; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Http.Features; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
private readonly JsonSerializerOptions options = new JsonSerializerOptions() |
|||
{ |
|||
PropertyNameCaseInsensitive = true, |
|||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase, |
|||
}; |
|||
|
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddHealthChecks(); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger<Startup> logger) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
var uri = Configuration.GetServiceUri("backend")!; |
|||
|
|||
logger.LogInformation("Backend URL: {BackendUrl}", uri); |
|||
|
|||
var httpClient = new HttpClient() |
|||
{ |
|||
BaseAddress = uri |
|||
}; |
|||
|
|||
endpoints.MapGet("/", async context => |
|||
{ |
|||
var bytes = await httpClient.GetByteArrayAsync("/"); |
|||
var backendInfo = JsonSerializer.Deserialize<BackendInfo>(bytes, options); |
|||
|
|||
await context.Response.WriteAsync($"Frontend Listening IP: {context.Connection.LocalIpAddress}{Environment.NewLine}"); |
|||
await context.Response.WriteAsync($"Frontend Hostname: {Dns.GetHostName()}{Environment.NewLine}"); |
|||
await context.Response.WriteAsync($"EnvVar Configuration value: {Configuration["App:Value"]}{Environment.NewLine}"); |
|||
|
|||
await context.Response.WriteAsync($"Backend Listening IP: {backendInfo.IP}{Environment.NewLine}"); |
|||
await context.Response.WriteAsync($"Backend Hostname: {backendInfo.Hostname}{Environment.NewLine}"); |
|||
var addresses = await Dns.GetHostAddressesAsync(uri.Host); |
|||
await context.Response.WriteAsync($"Backend Host Addresses: {string.Join(", ", addresses.Select(a => a.ToString()))}"); |
|||
}); |
|||
|
|||
endpoints.MapHealthChecks("/healthz"); |
|||
}); |
|||
} |
|||
|
|||
class BackendInfo |
|||
{ |
|||
public string IP { get; set; } = default!; |
|||
|
|||
public string Hostname { get; set; } = default!; |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -1,9 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace>Frontend</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,8 @@ |
|||
# tye application configuration file |
|||
# read all about it at https://github.com/dotnet/tye |
|||
name: frontend-backend |
|||
services: |
|||
- name: backend |
|||
project: backend/backend.csproj |
|||
- name: frontend |
|||
project: frontend/frontend.csproj |
|||
@ -1,35 +1,35 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Server.Kestrel.Core; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; |
|||
|
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(web => |
|||
{ |
|||
web.UseStartup<Startup>() |
|||
.ConfigureKestrel(options => |
|||
{ |
|||
options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http2); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.AspNetCore.Server.Kestrel.Core; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; |
|||
|
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(web => |
|||
{ |
|||
web.UseStartup<Startup>() |
|||
.ConfigureKestrel(options => |
|||
{ |
|||
options.ConfigureEndpointDefaults(o => o.Protocols = HttpProtocols.Http2); |
|||
}); |
|||
}); |
|||
} |
|||
} |
|||
@ -1,27 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:40079", |
|||
"sslPort": 44368 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"backend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:40079", |
|||
"sslPort": 44368 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"backend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,69 +1,69 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Server; |
|||
using RabbitMQ.Client; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddAuthorization(); |
|||
|
|||
services.AddCodeFirstGrpc(); |
|||
|
|||
services.AddSingleton(sp => |
|||
{ |
|||
var uri = Configuration.GetServiceUri("rabbit"); |
|||
var endpoint = new AmqpTcpEndpoint(uri); |
|||
|
|||
var factory = new ConnectionFactory() |
|||
{ |
|||
Endpoint = endpoint, |
|||
}; |
|||
var connection = factory.CreateConnection(); |
|||
var channel = connection.CreateModel(); |
|||
|
|||
channel.QueueDeclare(queue: "orders", |
|||
durable: false, |
|||
exclusive: false, |
|||
autoDelete: false, |
|||
arguments: null); |
|||
return channel; |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapGrpcService<OrdersService>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Server; |
|||
using RabbitMQ.Client; |
|||
|
|||
namespace Backend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddAuthorization(); |
|||
|
|||
services.AddCodeFirstGrpc(); |
|||
|
|||
services.AddSingleton(sp => |
|||
{ |
|||
var uri = Configuration.GetServiceUri("rabbit"); |
|||
var endpoint = new AmqpTcpEndpoint(uri); |
|||
|
|||
var factory = new ConnectionFactory() |
|||
{ |
|||
Endpoint = endpoint, |
|||
}; |
|||
var connection = factory.CreateConnection(); |
|||
var channel = connection.CreateModel(); |
|||
|
|||
channel.QueueDeclare(queue: "orders", |
|||
durable: false, |
|||
exclusive: false, |
|||
autoDelete: false, |
|||
arguments: null); |
|||
return channel; |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapGrpcService<OrdersService>(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -1,16 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace>Backend</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" /> |
|||
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.21" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace>Backend</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="RabbitMQ.Client" Version="5.1.2" /> |
|||
<PackageReference Include="protobuf-net.Grpc.AspNetCore" Version="1.0.21" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -1,30 +1,30 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Client; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Client; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
Activity.DefaultIdFormat = ActivityIdFormat.W3C; |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -1,27 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:46024", |
|||
"sslPort": 44343 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"frontend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:46024", |
|||
"sslPort": 44343 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"frontend": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,56 +1,56 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using Grpc.Net.Client; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Client; |
|||
using Shared; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddRazorPages(); |
|||
|
|||
var address = Configuration.GetServiceUri("backend"); |
|||
services.AddSingleton(_ => |
|||
{ |
|||
GrpcClientFactory.AllowUnencryptedHttp2 = true; |
|||
return GrpcChannel.ForAddress(address!).CreateGrpcService<IOrderService>(); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseStaticFiles(); |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapRazorPages(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using Grpc.Net.Client; |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
using ProtoBuf.Grpc.Client; |
|||
using Shared; |
|||
|
|||
namespace Frontend |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddRazorPages(); |
|||
|
|||
var address = Configuration.GetServiceUri("backend"); |
|||
services.AddSingleton(_ => |
|||
{ |
|||
GrpcClientFactory.AllowUnencryptedHttp2 = true; |
|||
return GrpcChannel.ForAddress(address!).CreateGrpcService<IOrderService>(); |
|||
}); |
|||
} |
|||
|
|||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
|||
{ |
|||
if (env.IsDevelopment()) |
|||
{ |
|||
app.UseDeveloperExceptionPage(); |
|||
} |
|||
|
|||
app.UseStaticFiles(); |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapRazorPages(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -1,16 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Grpc.Net.Client" Version="2.26.0" /> |
|||
<PackageReference Include="protobuf-net.Grpc" Version="1.0.21" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="$(TyeLibrariesPath)\Microsoft.Tye.Extensions.Configuration\Microsoft.Tye.Extensions.Configuration.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="Grpc.Net.Client" Version="2.26.0" /> |
|||
<PackageReference Include="protobuf-net.Grpc" Version="1.0.21" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue