chore 重构测试环境发布
This commit is contained in:
39
docker-compose.yml
Normal file
39
docker-compose.yml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
services:
|
||||||
|
internalgateways:
|
||||||
|
container_name: clean-internalgateways
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./gateways/KonSoft.InternalGateway/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.InternalGateway
|
||||||
|
- AgileConfig__Name=KonSoft.InternalGateway
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
|
|
||||||
|
authserver:
|
||||||
|
container_name: clean-authserver
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./applications/KonSoft.AuthServer/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.AuthServer
|
||||||
|
- AgileConfig__Name=KonSoft.AuthServer
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
|
|
||||||
|
adminservice:
|
||||||
|
container_name: clean-adminservice
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./microservices/KonSoft.Admin.HttpApi.Host/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Test
|
||||||
|
- AgileConfig__AppId=KonSoft.Admin.HttpApi.Host
|
||||||
|
- AgileConfig__Name=KonSoft.Admin.HttpApi.Host
|
||||||
|
- AgileConfig__Nodes=https://config.konsoft.top/
|
||||||
|
- AgileConfig__Secret=DBE31703-14F9-4B01-893D-900B8380CE04
|
||||||
@ -1,32 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
|
|
||||||
namespace KonSoft.InternalGateway.Controllers;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
[Route("[controller]")]
|
|
||||||
public class WeatherForecastController : ControllerBase
|
|
||||||
{
|
|
||||||
private static readonly string[] Summaries =
|
|
||||||
[
|
|
||||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
|
||||||
];
|
|
||||||
|
|
||||||
private readonly ILogger<WeatherForecastController> _logger;
|
|
||||||
|
|
||||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet(Name = "GetWeatherForecast")]
|
|
||||||
public IEnumerable<WeatherForecast> Get()
|
|
||||||
{
|
|
||||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
|
||||||
{
|
|
||||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
|
||||||
TemperatureC = Random.Shared.Next(-20, 55),
|
|
||||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
|
||||||
})
|
|
||||||
.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
29
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
29
gateways/KonSoft.InternalGateway/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
USER $APP_UID
|
||||||
|
WORKDIR /app
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["NuGet.Config", "."]
|
||||||
|
COPY ["gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj", "gateways/KonSoft.InternalGateway/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting.Gateways/KonSoft.Shared.Hosting.Gateways.csproj", "shared/KonSoft.Shared.Hosting.Gateways/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting.AspNetCore/KonSoft.Shared.Hosting.AspNetCore.csproj", "shared/KonSoft.Shared.Hosting.AspNetCore/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Hosting/KonSoft.Shared.Hosting.csproj", "shared/KonSoft.Shared.Hosting/"]
|
||||||
|
COPY ["shared/KonSoft.Shared.Localization/KonSoft.Shared.Localization.csproj", "shared/KonSoft.Shared.Localization/"]
|
||||||
|
RUN dotnet restore "./gateways/KonSoft.InternalGateway/KonSoft.InternalGateway.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/gateways/KonSoft.InternalGateway"
|
||||||
|
RUN dotnet build "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "./KonSoft.InternalGateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "KonSoft.InternalGateway.dll"]
|
||||||
17
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
17
gateways/KonSoft.InternalGateway/InternalGatewayModule.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using KonSoft.Shared.Hosting.Gateways;
|
||||||
|
using Volo.Abp;
|
||||||
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
|
namespace KonSoft.InternalGateway
|
||||||
|
{
|
||||||
|
[DependsOn(
|
||||||
|
typeof(KonSoftSharedHostingGatewaysModule)
|
||||||
|
)]
|
||||||
|
public class InternalGatewayModule : AbpModule
|
||||||
|
{
|
||||||
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,10 +4,18 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UserSecretsId>98521e87-fe4a-4555-8c3b-e83559a64e03</UserSecretsId>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<DockerfileContext>..\..</DockerfileContext>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||||
|
<PackageReference Include="Yarp.ReverseProxy" Version="2.3.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\shared\KonSoft.Shared.Hosting.Gateways\KonSoft.Shared.Hosting.Gateways.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,25 +1,37 @@
|
|||||||
var builder = WebApplication.CreateBuilder(args);
|
using KonSoft.InternalGateway;
|
||||||
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
// Add services to the container.
|
var assemblyName = typeof(Program).Assembly.GetName().Name!;
|
||||||
|
SerilogConfigurationHelper.Configure(assemblyName);
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
try
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
|
||||||
builder.Services.AddSwaggerGen();
|
|
||||||
|
|
||||||
var app = builder.Build();
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
{
|
||||||
app.UseSwagger();
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
app.UseSwaggerUI();
|
builder.Configuration
|
||||||
|
.AddAgileConfig(option =>
|
||||||
|
{
|
||||||
|
option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development";
|
||||||
|
});
|
||||||
|
builder.Host
|
||||||
|
.AddAppSettingsSecretsJson()
|
||||||
|
.UseAutofac()
|
||||||
|
.UseSerilog();
|
||||||
|
builder.Services.AddReverseProxy()
|
||||||
|
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
|
||||||
|
await builder.AddApplicationAsync<InternalGatewayModule>();
|
||||||
|
var app = builder.Build();
|
||||||
|
await app.InitializeApplicationAsync();
|
||||||
|
await app.RunAsync();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
app.UseHttpsRedirection();
|
{
|
||||||
|
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
|
||||||
app.UseAuthorization();
|
return 1;
|
||||||
|
}
|
||||||
app.MapControllers();
|
finally
|
||||||
|
{
|
||||||
app.Run();
|
await Log.CloseAndFlushAsync();
|
||||||
|
}
|
||||||
@ -1,33 +1,24 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:15968",
|
|
||||||
"sslPort": 44395
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"http": {
|
"http": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "http://localhost:5090",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "http://localhost:5090"
|
||||||
},
|
},
|
||||||
"https": {
|
"https": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"applicationUrl": "https://localhost:7264;http://localhost:5090",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "https://localhost:7264;http://localhost:5090"
|
||||||
},
|
},
|
||||||
"IIS Express": {
|
"IIS Express": {
|
||||||
"commandName": "IISExpress",
|
"commandName": "IISExpress",
|
||||||
@ -36,6 +27,26 @@
|
|||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"Container (Dockerfile)": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||||
|
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||||
|
},
|
||||||
|
"publishAllPorts": true,
|
||||||
|
"useSSL": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:15968",
|
||||||
|
"sslPort": 44395
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +0,0 @@
|
|||||||
namespace KonSoft.InternalGateway;
|
|
||||||
|
|
||||||
public class WeatherForecast
|
|
||||||
{
|
|
||||||
public DateOnly Date { get; set; }
|
|
||||||
|
|
||||||
public int TemperatureC { get; set; }
|
|
||||||
|
|
||||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
|
||||||
|
|
||||||
public string? Summary { get; set; }
|
|
||||||
}
|
|
||||||
@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"Logging": {
|
"AgileConfig": {
|
||||||
"LogLevel": {
|
"appId": "KonSoft.InternalGateway",
|
||||||
"Default": "Information",
|
"name": "KonSoft.InternalGateway",
|
||||||
"Microsoft.AspNetCore": "Warning"
|
"nodes": "https://config.konsoft.top/",
|
||||||
}
|
"secret": "DBE31703-14F9-4B01-893D-900B8380CE04"
|
||||||
},
|
}
|
||||||
"AllowedHosts": "*"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ WORKDIR /app
|
|||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
|
||||||
# 此阶段用于生成服务项目
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
@ -17,6 +17,10 @@
|
|||||||
<None Remove="Logs\**" />
|
<None Remove="Logs\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.Application\KonSoft.Admin.Application.csproj" />
|
||||||
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
<ProjectReference Include="..\..\modules\admin\src\KonSoft.Admin.EntityFrameworkCore\KonSoft.Admin.EntityFrameworkCore.csproj" />
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"http": {
|
"http": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
@ -8,6 +7,18 @@
|
|||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"applicationUrl": "https://localhost:44354"
|
"applicationUrl": "https://localhost:44354"
|
||||||
|
},
|
||||||
|
"Container (Dockerfile)": {
|
||||||
|
"commandName": "Docker",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_HTTPS_PORTS": "8081",
|
||||||
|
"ASPNETCORE_HTTP_PORTS": "8080"
|
||||||
|
},
|
||||||
|
"publishAllPorts": true,
|
||||||
|
"useSSL": true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"$schema": "http://json.schemastore.org/launchsettings.json"
|
||||||
}
|
}
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace KonSoft.Shared.Hosting.Gateways;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -6,4 +6,8 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\KonSoft.Shared.Hosting.AspNetCore\KonSoft.Shared.Hosting.AspNetCore.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
using KonSoft.Shared.Hosting.AspNetCore;
|
||||||
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
|
namespace KonSoft.Shared.Hosting.Gateways;
|
||||||
|
|
||||||
|
[DependsOn(
|
||||||
|
typeof(KonSoftSharedHostingAspNetCoreModule)
|
||||||
|
)]
|
||||||
|
public class KonSoftSharedHostingGatewaysModule : AbpModule
|
||||||
|
{
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user