feat(aihit): init + docker + cicd
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
variables:
|
variables:
|
||||||
REPO: "harbor.dvgd.rzd"
|
REPO: "harbor.dvgd.rzd"
|
||||||
PROD_NAME_API: "parr/parr-api"
|
PROD_NAME_API: "parr/parr-api"
|
||||||
PROD_NAME_AIHIT: "parr/parr-aihit-syncher"
|
PROD_NAME_AIHIT_LOADER: "parr/parr-aihit-loader"
|
||||||
|
PROD_NAME_AIHIT_SYNCER: "parr/parr-aihit-syncer"
|
||||||
PROD_NAME_ESPP_TEMPLATE: "parr/parr-espp-template-sync"
|
PROD_NAME_ESPP_TEMPLATE: "parr/parr-espp-template-sync"
|
||||||
PROD_NAME_ESPP_SCHEDULE: "parr/parr-espp-schedule-sync"
|
PROD_NAME_ESPP_SCHEDULE: "parr/parr-espp-schedule-sync"
|
||||||
PROD_NAME_GENERATOR_TEMPLATES: "parr/parr-generator-templates"
|
PROD_NAME_GENERATOR_TEMPLATES: "parr/parr-generator-templates"
|
||||||
@@ -65,10 +66,59 @@ prod_deploy:
|
|||||||
- ${RUNNER}
|
- ${RUNNER}
|
||||||
|
|
||||||
|
|
||||||
|
### AIHIT LOADER PROD ###
|
||||||
|
prod_aihit_loader_build:
|
||||||
|
stage: build
|
||||||
|
only:
|
||||||
|
- /^al[0-9]+\.[0-9]+\.[0-9]+$/
|
||||||
|
except:
|
||||||
|
- branches
|
||||||
|
services:
|
||||||
|
- name: docker:20.10.21-dind
|
||||||
|
command: [
|
||||||
|
"--insecure-registry=10.99.253.167:8090",
|
||||||
|
"--registry-mirror=http://10.99.253.167:8090",
|
||||||
|
"--insecure-registry=10.99.253.167:8088",
|
||||||
|
"--registry-mirror=http://10.99.253.167:8088",
|
||||||
|
"--insecure-registry=harbor.dvgd.rzd",
|
||||||
|
"--tls=false"
|
||||||
|
]
|
||||||
|
variables:
|
||||||
|
DOCKER_HOST: tcp://docker:2375
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
DOCKER_TLS_CERTDIR: ""
|
||||||
|
script:
|
||||||
|
- APP_VERSION=$(echo $CI_COMMIT_TAG | tr -d al)
|
||||||
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/al/v/g')
|
||||||
|
- docker build -t $REPO/$PROD_NAME_AIHIT_LOADER:$IMAGE_VERSION -t $REPO/$PROD_NAME_AIHIT_LOADER:latest -t $PROD_NAME_AIHIT_LOADER:$IMAGE_VERSION -t $PROD_NAME_AIHIT_LOADER:latest --build-arg app_version=$APP_VERSION -f PARR.AIHITLoaderWorker/Dockerfile .
|
||||||
|
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
|
||||||
|
- docker push --all-tags $REPO/$PROD_NAME_AIHIT_LOADER
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
|
||||||
### AIHIT PROD ###
|
prod_aihit_loader_deploy:
|
||||||
prod_aihit_build:
|
stage: deploy
|
||||||
|
environment:
|
||||||
|
name: parr-aihit-loader
|
||||||
|
only:
|
||||||
|
- /^al[0-9]+\.[0-9]+\.[0-9]+$/
|
||||||
|
except:
|
||||||
|
- branches
|
||||||
|
script:
|
||||||
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/al/v/g')
|
||||||
|
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
|
||||||
|
- tag=$IMAGE_VERSION docker compose -f docker-compose.aihit-loader.yml up -d
|
||||||
|
parallel:
|
||||||
|
matrix:
|
||||||
|
- RUNNER: shell-as-1
|
||||||
|
tags:
|
||||||
|
- ${RUNNER}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### AIHIT SYNCER PROD ###
|
||||||
|
prod_aihit_syncer_build:
|
||||||
stage: build
|
stage: build
|
||||||
only:
|
only:
|
||||||
- /^as[0-9]+\.[0-9]+\.[0-9]+$/
|
- /^as[0-9]+\.[0-9]+\.[0-9]+$/
|
||||||
@@ -91,17 +141,17 @@ prod_aihit_build:
|
|||||||
script:
|
script:
|
||||||
- APP_VERSION=$(echo $CI_COMMIT_TAG | tr -d as)
|
- APP_VERSION=$(echo $CI_COMMIT_TAG | tr -d as)
|
||||||
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/as/v/g')
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/as/v/g')
|
||||||
- docker build -t $REPO/$PROD_NAME_AIHIT:$IMAGE_VERSION -t $REPO/$PROD_NAME_AIHIT:latest -t $PROD_NAME_AIHIT:$IMAGE_VERSION -t $PROD_NAME_AIHIT:latest --build-arg app_version=$APP_VERSION -f PARR.Worker/PARR.Worker/Dockerfile .
|
- docker build -t $REPO/$PROD_NAME_AIHIT_SYNCER:$IMAGE_VERSION -t $REPO/$PROD_NAME_AIHIT_SYNCER:latest -t $PROD_NAME_AIHIT_SYNCER:$IMAGE_VERSION -t $PROD_NAME_AIHIT_SYNCER:latest --build-arg app_version=$APP_VERSION -f PARR.AIHITSyncerWorker/Dockerfile .
|
||||||
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
|
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
|
||||||
- docker push --all-tags $REPO/$PROD_NAME_AIHIT
|
- docker push --all-tags $REPO/$PROD_NAME_AIHIT_SYNCER
|
||||||
tags:
|
tags:
|
||||||
- docker-as
|
- docker
|
||||||
|
|
||||||
|
|
||||||
prod_aihit_deploy:
|
prod_aihit_syncer_deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
environment:
|
environment:
|
||||||
name: parr-aihit-syncher
|
name: parr-aihit-syncer
|
||||||
only:
|
only:
|
||||||
- /^as[0-9]+\.[0-9]+\.[0-9]+$/
|
- /^as[0-9]+\.[0-9]+\.[0-9]+$/
|
||||||
except:
|
except:
|
||||||
@@ -109,10 +159,10 @@ prod_aihit_deploy:
|
|||||||
script:
|
script:
|
||||||
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/as/v/g')
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/as/v/g')
|
||||||
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
|
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
|
||||||
- tag=$IMAGE_VERSION docker compose -f docker-compose.aihit-syncher.yml up -d
|
- tag=$IMAGE_VERSION docker compose -f docker-compose.aihit-syncer.yml up -d
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
- RUNNER: shell-as-1
|
- RUNNER: shell-api-swarm-01
|
||||||
tags:
|
tags:
|
||||||
- ${RUNNER}
|
- ${RUNNER}
|
||||||
|
|
||||||
|
|||||||
16
PARR.AIHITLoader/AihitLoaderInstaller.cs
Normal file
16
PARR.AIHITLoader/AihitLoaderInstaller.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using PARR.BLL;
|
||||||
|
|
||||||
|
namespace PARR.AIHITLoader
|
||||||
|
{
|
||||||
|
public static class AihitLoaderInstaller
|
||||||
|
{
|
||||||
|
public static void InstallAihitLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.InstallBllServices(configuration);
|
||||||
|
|
||||||
|
//todo: config e.t.c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
PARR.AIHITLoader/PARR.AIHITLoader.csproj
Normal file
13
PARR.AIHITLoader/PARR.AIHITLoader.csproj
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
26
PARR.AIHITLoaderWorker/Dockerfile
Normal file
26
PARR.AIHITLoaderWorker/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#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.AIHITLoaderWorker/PARR.AIHITLoaderWorker.csproj", "PARR.AIHITLoaderWorker/"]
|
||||||
|
COPY ["PARR.AIHITLoader/PARR.AIHITLoader.csproj", "PARR.AIHITLoader/"]
|
||||||
|
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||||
|
RUN dotnet restore "./PARR.AIHITLoaderWorker/./PARR.AIHITLoaderWorker.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/PARR.AIHITLoaderWorker"
|
||||||
|
RUN dotnet build "./PARR.AIHITLoaderWorker.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
ARG app_version=0.0.0-default
|
||||||
|
RUN dotnet publish "./PARR.AIHITLoaderWorker.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.AIHITLoaderWorker.dll"]
|
||||||
24
PARR.AIHITLoaderWorker/PARR.AIHITLoaderWorker.csproj
Normal file
24
PARR.AIHITLoaderWorker/PARR.AIHITLoaderWorker.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.AIHITLoaderWorker-a6f3114e-7da7-43fd-888c-f45df76de2bd</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.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PARR.AIHITLoader\PARR.AIHITLoader.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
30
PARR.AIHITLoaderWorker/Program.cs
Normal file
30
PARR.AIHITLoaderWorker/Program.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using PARR.AIHITLoader;
|
||||||
|
using Serilog;
|
||||||
|
using PARR.AIHITLoaderWorker;
|
||||||
|
using Elastic.CommonSchema.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.InstallAihitLoaderServices(builder.Configuration);
|
||||||
|
|
||||||
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
|
host.Run();
|
||||||
14
PARR.AIHITLoaderWorker/Properties/launchSettings.json
Normal file
14
PARR.AIHITLoaderWorker/Properties/launchSettings.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"PARR.AIHITLoaderWorker": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"environmentVariables": {
|
||||||
|
"DOTNET_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"dotnetRunMessages": true
|
||||||
|
},
|
||||||
|
"Docker": {
|
||||||
|
"commandName": "Docker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
PARR.AIHITLoaderWorker/Worker.cs
Normal file
21
PARR.AIHITLoaderWorker/Worker.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
namespace PARR.AIHITLoaderWorker
|
||||||
|
{
|
||||||
|
public class Worker : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly ILogger<Worker> _logger;
|
||||||
|
|
||||||
|
public Worker(ILogger<Worker> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||||
|
await Task.Delay(1000, stoppingToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
PARR.AIHITLoaderWorker/appsettings.Development.json
Normal file
8
PARR.AIHITLoaderWorker/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
PARR.AIHITLoaderWorker/appsettings.json
Normal file
8
PARR.AIHITLoaderWorker/appsettings.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16
PARR.AIHITSyncer/AihitSyncerInstaller.cs
Normal file
16
PARR.AIHITSyncer/AihitSyncerInstaller.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using PARR.BLL;
|
||||||
|
|
||||||
|
namespace PARR.AIHITSyncer
|
||||||
|
{
|
||||||
|
public static class AihitSyncerInstaller
|
||||||
|
{
|
||||||
|
public static void InstallAihitSyncerServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.InstallBllServices(configuration);
|
||||||
|
|
||||||
|
//todo: config e.t.c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
PARR.AIHITSyncer/PARR.AIHITSyncer.csproj
Normal file
14
PARR.AIHITSyncer/PARR.AIHITSyncer.csproj
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PARR.BLL\PARR.BLL.csproj" />
|
||||||
|
<ProjectReference Include="..\PARR.DAL\PARR.DAL.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
28
PARR.AIHITSyncerWorker/Dockerfile
Normal file
28
PARR.AIHITSyncerWorker/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.AIHITSyncerWorker/PARR.AIHITSyncerWorker.csproj", "PARR.AIHITSyncerWorker/"]
|
||||||
|
COPY ["PARR.AIHITSyncer/PARR.AIHITSyncer.csproj", "PARR.AIHITSyncer/"]
|
||||||
|
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.AIHITSyncerWorker/./PARR.AIHITSyncerWorker.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/PARR.AIHITSyncerWorker"
|
||||||
|
RUN dotnet build "./PARR.AIHITSyncerWorker.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
ARG app_version=0.0.0-default
|
||||||
|
RUN dotnet publish "./PARR.AIHITSyncerWorker.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.AIHITSyncerWorker.dll"]
|
||||||
24
PARR.AIHITSyncerWorker/PARR.AIHITSyncerWorker.csproj
Normal file
24
PARR.AIHITSyncerWorker/PARR.AIHITSyncerWorker.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.AIHITSyncerWorker-cd7db85e-5317-46a2-aa90-44eb3e56f076</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.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\PARR.AIHITSyncer\PARR.AIHITSyncer.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
30
PARR.AIHITSyncerWorker/Program.cs
Normal file
30
PARR.AIHITSyncerWorker/Program.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using PARR.AIHITSyncerWorker;
|
||||||
|
using Elastic.CommonSchema.Serilog;
|
||||||
|
using Serilog;
|
||||||
|
using PARR.AIHITSyncer;
|
||||||
|
|
||||||
|
|
||||||
|
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.InstallAihitSyncerServices(builder.Configuration);
|
||||||
|
|
||||||
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
|
host.Run();
|
||||||
14
PARR.AIHITSyncerWorker/Properties/launchSettings.json
Normal file
14
PARR.AIHITSyncerWorker/Properties/launchSettings.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"PARR.AIHITSyncerWorker": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"environmentVariables": {
|
||||||
|
"DOTNET_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"dotnetRunMessages": true
|
||||||
|
},
|
||||||
|
"Docker": {
|
||||||
|
"commandName": "Docker"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
PARR.AIHITSyncerWorker/Worker.cs
Normal file
21
PARR.AIHITSyncerWorker/Worker.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
namespace PARR.AIHITSyncerWorker
|
||||||
|
{
|
||||||
|
public class Worker : BackgroundService
|
||||||
|
{
|
||||||
|
private readonly ILogger<Worker> _logger;
|
||||||
|
|
||||||
|
public Worker(ILogger<Worker> logger)
|
||||||
|
{
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||||
|
await Task.Delay(1000, stoppingToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
PARR.AIHITSyncerWorker/appsettings.Development.json
Normal file
8
PARR.AIHITSyncerWorker/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
PARR.AIHITSyncerWorker/appsettings.json
Normal file
8
PARR.AIHITSyncerWorker/appsettings.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
PARR.API.sln
30
PARR.API.sln
@@ -53,11 +53,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Test", "PARR.Test\PARR
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Constants", "PARR.Constants\PARR.Constants.csproj", "{46B09885-C9FB-449C-ACAA-24C671194C4D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.Constants", "PARR.Constants\PARR.Constants.csproj", "{46B09885-C9FB-449C-ACAA-24C671194C4D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.EsppSync", "PARR.EsppSync\PARR.EsppSync.csproj", "{71121EF7-D4C1-43A4-9243-EF5C4C82030F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppSync", "PARR.EsppSync\PARR.EsppSync.csproj", "{71121EF7-D4C1-43A4-9243-EF5C4C82030F}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.EsppScheduleSync", "PARR.EsppScheduleSync\PARR.EsppScheduleSync.csproj", "{1E7F0EFE-784E-42E1-96BA-1FF743998619}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppScheduleSync", "PARR.EsppScheduleSync\PARR.EsppScheduleSync.csproj", "{1E7F0EFE-784E-42E1-96BA-1FF743998619}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.EsppScheduleSyncWorker", "PARR.EsppScheduleSyncWorker\PARR.EsppScheduleSyncWorker.csproj", "{C597A1D7-1BC5-493B-BC29-03EC830FB090}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PARR.EsppScheduleSyncWorker", "PARR.EsppScheduleSyncWorker\PARR.EsppScheduleSyncWorker.csproj", "{C597A1D7-1BC5-493B-BC29-03EC830FB090}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITLoader", "PARR.AIHITLoader\PARR.AIHITLoader.csproj", "{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITLoaderWorker", "PARR.AIHITLoaderWorker\PARR.AIHITLoaderWorker.csproj", "{E9434123-E697-42E2-B7C0-FE08766B98D1}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITSyncer", "PARR.AIHITSyncer\PARR.AIHITSyncer.csproj", "{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PARR.AIHITSyncerWorker", "PARR.AIHITSyncerWorker\PARR.AIHITSyncerWorker.csproj", "{4FA79176-F833-4879-8437-37EA053BAA94}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -159,6 +167,22 @@ Global
|
|||||||
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C597A1D7-1BC5-493B-BC29-03EC830FB090}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E7F3C8FB-445B-4711-8F89-0B7DA7DB4537}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E9434123-E697-42E2-B7C0-FE08766B98D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E9434123-E697-42E2-B7C0-FE08766B98D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E9434123-E697-42E2-B7C0-FE08766B98D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E9434123-E697-42E2-B7C0-FE08766B98D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4177B13B-585C-44C7-B3C1-6B6E46D6BABC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{4FA79176-F833-4879-8437-37EA053BAA94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4FA79176-F833-4879-8437-37EA053BAA94}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4FA79176-F833-4879-8437-37EA053BAA94}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
10
PARR.BLL/Domain/Mq/AihitDataMq.cs
Normal file
10
PARR.BLL/Domain/Mq/AihitDataMq.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace PARR.BLL.Domain.Mq
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Модель в MQ, данные из АИХИТ
|
||||||
|
/// </summary>
|
||||||
|
internal class AihitDataMq
|
||||||
|
{
|
||||||
|
//TODO:данные из АИХИТ
|
||||||
|
}
|
||||||
|
}
|
||||||
20
docker-compose.aihit-loader.yml
Normal file
20
docker-compose.aihit-loader.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
#AIHIT LOADER
|
||||||
|
services:
|
||||||
|
aihit-loader:
|
||||||
|
image: harbor.dvgd.rzd/parr/parr-aihit-loader:${tag:-latest}
|
||||||
|
container_name: parr-aihit-loader
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
- TZ=Europe/Moscow
|
||||||
|
volumes:
|
||||||
|
- /var/log/parr-aihit-loader:/app/log
|
||||||
|
logging:
|
||||||
|
driver: fluentd
|
||||||
|
options:
|
||||||
|
fluentd-address: dvgd-efk-01.dvgd.oao.rzd:24224
|
||||||
|
fluentd-retry-wait: '30s'
|
||||||
|
fluentd-max-retries: '30'
|
||||||
|
tag: parr.aihit-loader.serilog
|
||||||
@@ -9,8 +9,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Production
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
- TZ=Europe/Moscow
|
- TZ=Europe/Moscow
|
||||||
volumes:
|
#volumes:
|
||||||
- /var/log/parr-aihit-syncher:/app/log
|
#- /var/log/parr-aihit-syncher:/app/log
|
||||||
logging:
|
logging:
|
||||||
driver: fluentd
|
driver: fluentd
|
||||||
options:
|
options:
|
||||||
@@ -18,10 +18,13 @@ services:
|
|||||||
fluentd-retry-wait: '30s'
|
fluentd-retry-wait: '30s'
|
||||||
fluentd-max-retries: '30'
|
fluentd-max-retries: '30'
|
||||||
tag: parr.aihit-syncher.serilog
|
tag: parr.aihit-syncher.serilog
|
||||||
|
deploy:
|
||||||
|
replicas: 4
|
||||||
|
networks:
|
||||||
|
- parr-network
|
||||||
|
|
||||||
|
|
||||||
# последняя версия
|
networks:
|
||||||
#docker compose -f docker-compose.aihit-syncher.yml up -d
|
parr-network:
|
||||||
# указанная версия
|
driver: overlay
|
||||||
#tag=v1.0.0 docker compose -f docker-compose.aihit-syncher.yml up -d
|
external: true
|
||||||
|
|
||||||
Reference in New Issue
Block a user