feat(nextRun): рассчет поля NextRun по расписанию
This commit is contained in:
28
PARR.NextRunWorker/Dockerfile
Normal file
28
PARR.NextRunWorker/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM 10.99.253.167:8090/dotnet/runtime:7.0 AS base
|
||||
WORKDIR /app
|
||||
|
||||
FROM 10.99.253.167:8090/dotnet/sdk:7.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["NuGet.config", "."]
|
||||
COPY ["PARR.NextRunWorker/PARR.NextRunWorker.csproj", "PARR.NextRunWorker/"]
|
||||
COPY ["PARR.NextRun/PARR.NextRun.csproj", "PARR.NextRun/"]
|
||||
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||
COPY ["PARR.Constants/PARR.Constants.csproj", "PARR.Constants/"]
|
||||
RUN dotnet restore "./PARR.NextRunWorker/./PARR.NextRunWorker.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/PARR.NextRunWorker"
|
||||
RUN dotnet build "./PARR.NextRunWorker.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
ARG app_version=0.0.0-default
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./PARR.NextRunWorker.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:Version=$app_version
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "PARR.NextRunWorker.dll"]
|
||||
24
PARR.NextRunWorker/PARR.NextRunWorker.csproj
Normal file
24
PARR.NextRunWorker/PARR.NextRunWorker.csproj
Normal file
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>dotnet-PARR.NextRunWorker-a622ce44-5924-404c-b214-4dcbdba3aca3</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PARR.NextRun\PARR.NextRun.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
29
PARR.NextRunWorker/Program.cs
Normal file
29
PARR.NextRunWorker/Program.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Elastic.CommonSchema.Serilog;
|
||||
using PARR.NextRun;
|
||||
using PARR.NextRunWorker;
|
||||
using Serilog;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder();
|
||||
|
||||
builder.Services.AddLogging(config =>
|
||||
{
|
||||
config.ClearProviders();
|
||||
|
||||
var logger = new LoggerConfiguration();
|
||||
|
||||
if (builder.Environment.IsProduction())
|
||||
logger.WriteTo.Console(new EcsTextFormatter());
|
||||
else
|
||||
logger.WriteTo.Console();
|
||||
|
||||
logger.ReadFrom.Configuration(builder.Configuration);
|
||||
|
||||
config.AddSerilog(logger.CreateLogger());
|
||||
});
|
||||
|
||||
builder.Services.InstallNextRunServices(builder.Configuration);
|
||||
builder.Services.AddHostedService<Worker>();
|
||||
|
||||
var host = builder.Build();
|
||||
host.Run();
|
||||
|
||||
14
PARR.NextRunWorker/Properties/launchSettings.json
Normal file
14
PARR.NextRunWorker/Properties/launchSettings.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"profiles": {
|
||||
"PARR.NextRunWorker": {
|
||||
"commandName": "Project",
|
||||
"environmentVariables": {
|
||||
"DOTNET_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker"
|
||||
}
|
||||
}
|
||||
}
|
||||
19
PARR.NextRunWorker/Worker.cs
Normal file
19
PARR.NextRunWorker/Worker.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using PARR.NextRun;
|
||||
|
||||
namespace PARR.NextRunWorker
|
||||
{
|
||||
public class Worker : BackgroundService
|
||||
{
|
||||
private readonly INextRunManager nextRunManager;
|
||||
|
||||
public Worker(INextRunManager nextRunManager)
|
||||
{
|
||||
this.nextRunManager = nextRunManager;
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
await nextRunManager.StartAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
8
PARR.NextRunWorker/appsettings.Development.json
Normal file
8
PARR.NextRunWorker/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
}
|
||||
32
PARR.NextRunWorker/appsettings.json
Normal file
32
PARR.NextRunWorker/appsettings.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Override": {
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Debug"
|
||||
}
|
||||
},
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "File",
|
||||
"Args": {
|
||||
"path": "log/log-.txt",
|
||||
"rollingInterval": "Day"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"WorkerSettings": {
|
||||
"RepeatEvery": "0:50:00"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user