Major update

This commit is contained in:
2023-06-01 08:52:05 -05:00
parent d7c0f373f4
commit df84287eb2
264 changed files with 8614 additions and 964 deletions

25
gateway/.dockerignore Normal file
View File

@@ -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

3
gateway/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.vs/
[Bb]in/
[Oo]bj/

21
gateway/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Gateway.csproj", "."]
RUN dotnet restore "./Gateway.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Gateway.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Gateway.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Gateway.dll"]

18
gateway/Gateway.csproj Normal file
View File

@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerComposeProjectPath>docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
<PackageReference Include="Ocelot" Version="18.0.0" />
</ItemGroup>
<ItemGroup>
<None Remove="Ocelot" />
</ItemGroup>
</Project>

31
gateway/Gateway.sln Normal file
View File

@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1704.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gateway", "Gateway.csproj", "{C01CA65F-E1DC-4845-AA2D-E286C58042A6}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{75357A18-7A74-4F6F-A83D-EEB646294BC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C01CA65F-E1DC-4845-AA2D-E286C58042A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C01CA65F-E1DC-4845-AA2D-E286C58042A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C01CA65F-E1DC-4845-AA2D-E286C58042A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C01CA65F-E1DC-4845-AA2D-E286C58042A6}.Release|Any CPU.Build.0 = Release|Any CPU
{75357A18-7A74-4F6F-A83D-EEB646294BC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75357A18-7A74-4F6F-A83D-EEB646294BC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75357A18-7A74-4F6F-A83D-EEB646294BC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{75357A18-7A74-4F6F-A83D-EEB646294BC6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F513160C-97AB-4793-80A3-EABBA7D062E0}
EndGlobalSection
EndGlobal

25
gateway/Program.cs Normal file
View File

@@ -0,0 +1,25 @@
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Configuration.AddJsonFile("ocelot.json", optional: false, reloadOnChange: true);
builder.Services.AddOcelot(builder.Configuration);
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
await app.UseOcelot();
app.Run();

View File

@@ -0,0 +1,30 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:23410",
"sslPort": 0
}
},
"profiles": {
"Gateway": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5500",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

10
gateway/appsettings.json Normal file
View File

@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk" DefaultTargets="Build">
<PropertyGroup Label="Globals">
<ProjectVersion>2.1</ProjectVersion>
<DockerTargetOS>Linux</DockerTargetOS>
<ProjectGuid>{75357A18-7A74-4F6F-A83D-EEB646294BC6}</ProjectGuid>
<DockerLaunchBrowser>True</DockerLaunchBrowser>
<DockerServiceUrl>{Scheme}://localhost:{ServicePort}/swagger</DockerServiceUrl>
<DockerServiceName>gateway</DockerServiceName>
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.override.yml">
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
version: '3.4'
services:
gateway:
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
- "5500:80"

View File

@@ -0,0 +1,8 @@
version: '3.4'
services:
gateway:
image: ${DOCKER_REGISTRY-}gateway
build:
context: .
dockerfile: ./Dockerfile

187
gateway/ocelot.json Normal file
View File

@@ -0,0 +1,187 @@
{
"GlobalConfigruation": {
"BaseUrl": "http://localhost:5500"
},
"Routes": [
{
"DownstreamPathTemplate": "/api/divisions",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "divisions-service",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/divisions",
"UpstreamHttpMethod": [ "GET" ]
},
{
"UpstreamPathTemplate": "/api/divisions/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/divisions/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "divisions-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/games",
"UpstreamHttpMethod": [ "GET", "POST" ],
"DownstreamPathTemplate": "/api/games",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "games-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/games/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/games/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "games-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/leagues",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/leagues",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "leagues-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/leagues/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/leagues/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "leagues-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/seasons",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/seasons",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "seasons-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/seasons/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/seasons/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "seasons-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/sports",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/sports",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "sports-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/sports/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/sports/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "sports-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/teams",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/teams",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "teams-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/teams/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/teams/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "teams-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/venues",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/venues",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "venues-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/api/venues/{id}",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/api/venues/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "venues-service",
"Port": 80
}
]
},
{
"UpstreamPathTemplate": "/hubs/game",
"UpstreamHttpMethod": [ "GET" ],
"DownstreamPathTemplate": "/hubs/game",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "communication-hub",
"Port": 80
}
]
}
]
}