feat(esppOrderLoader): подключены все сервисы. Docker.
This commit is contained in:
@@ -4,6 +4,7 @@ variables:
|
|||||||
PROD_NAME_AIHIT: "parr/parr-aihit-syncher"
|
PROD_NAME_AIHIT: "parr/parr-aihit-syncher"
|
||||||
PROD_NAME_ESPP_TEMPLATE: "parr/parr-espp-template-sync"
|
PROD_NAME_ESPP_TEMPLATE: "parr/parr-espp-template-sync"
|
||||||
PROD_NAME_GENERATOR_TEMPLATES: "parr/parr-generator-templates"
|
PROD_NAME_GENERATOR_TEMPLATES: "parr/parr-generator-templates"
|
||||||
|
PROD_NAME_ESPP_ORDER_LOADER: "parr/parr-espp-order-loader"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
@@ -211,3 +212,52 @@ prod_generator_templates_deploy:
|
|||||||
- RUNNER: shell-api-swarm-01
|
- RUNNER: shell-api-swarm-01
|
||||||
tags:
|
tags:
|
||||||
- ${RUNNER}
|
- ${RUNNER}
|
||||||
|
|
||||||
|
|
||||||
|
### ESPP ORDER LOADER ###
|
||||||
|
#PROD_NAME_ESPP_ORDER_LOADER
|
||||||
|
prod_espp_order_loader_build:
|
||||||
|
stage: build
|
||||||
|
only:
|
||||||
|
- /^ol[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=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 ol)
|
||||||
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ol/v/g')
|
||||||
|
- docker build -t $REPO/$PROD_NAME_ESPP_ORDER_LOADER:$IMAGE_VERSION -t $REPO/$PROD_NAME_ESPP_ORDER_LOADER:latest -t $PROD_NAME_ESPP_ORDER_LOADER:$IMAGE_VERSION -t $PROD_NAME_ESPP_ORDER_LOADER:latest --build-arg app_version=$APP_VERSION -f PARR.EsppOrderLoaderWorker/Dockerfile .
|
||||||
|
- docker login -u $HARBOR_PUSH_USER -p $HARBOR_PUSH_PASS $REPO
|
||||||
|
- docker push --all-tags $REPO/$PROD_NAME_ESPP_ORDER_LOADER
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
|
||||||
|
prod_espp_order_loader_deploy:
|
||||||
|
stage: deploy
|
||||||
|
environment:
|
||||||
|
name: parr-espp-order-loader
|
||||||
|
only:
|
||||||
|
- /^ol[0-9]+\.[0-9]+\.[0-9]+$/
|
||||||
|
except:
|
||||||
|
- branches
|
||||||
|
script:
|
||||||
|
- IMAGE_VERSION=$(echo $CI_COMMIT_TAG | sed 's/ol/v/g')
|
||||||
|
- docker login -u $HARBOR_PULL_USER -p $HARBOR_PULL_PASS $REPO
|
||||||
|
- tag=$IMAGE_VERSION docker stack deploy -c docker-compose.espp-order-loader.yml parr-espp-order-loader --with-registry-auth
|
||||||
|
parallel:
|
||||||
|
matrix:
|
||||||
|
- RUNNER: shell-api-swarm-01
|
||||||
|
tags:
|
||||||
|
- ${RUNNER}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using PARR.BLL;
|
||||||
|
using PARR.DAL;
|
||||||
|
using PARR.EsppApi;
|
||||||
|
|
||||||
namespace PARR.EsppOrderLoader
|
namespace PARR.EsppOrderLoader
|
||||||
{
|
{
|
||||||
@@ -7,7 +10,9 @@ namespace PARR.EsppOrderLoader
|
|||||||
{
|
{
|
||||||
public static void InstallEsppOrderLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
public static void InstallEsppOrderLoaderServices(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
//TODO: добавить настройи bll и dal и espp api
|
services.InstallBllServices(configuration);
|
||||||
|
services.InstallDalServices(configuration);
|
||||||
|
services.InstallEsppApiServices(configuration);
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
//SettingsFromDb configuration
|
//SettingsFromDb configuration
|
||||||
@@ -18,5 +23,17 @@ namespace PARR.EsppOrderLoader
|
|||||||
//add other services
|
//add other services
|
||||||
//services.AddTransient<IEsppApiService, EsppApiService>();
|
//services.AddTransient<IEsppApiService, EsppApiService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IConfigurationBuilder AddEsppOrderLoaderConfigurations(this IConfigurationBuilder builder, IServiceCollection services)
|
||||||
|
{
|
||||||
|
builder.AddDalConfigurations(services);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddEsppOrderLoaderSettings(this IServiceCollection services, IConfiguration configuration)
|
||||||
|
{
|
||||||
|
services.AddDallSettings(configuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
26
PARR.EsppOrderLoaderWorker/Dockerfile
Normal file
26
PARR.EsppOrderLoaderWorker/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
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["NuGet.config", "."]
|
||||||
|
COPY ["PARR.EsppOrderLoaderWorker/PARR.EsppOrderLoaderWorker.csproj", "PARR.EsppOrderLoaderWorker/"]
|
||||||
|
COPY ["PARR.EsppOrderLoader/PARR.EsppOrderLoader.csproj", "PARR.EsppOrderLoader/"]
|
||||||
|
COPY ["PARR.BLL/PARR.BLL.csproj", "PARR.BLL/"]
|
||||||
|
COPY ["PARR.DAL/PARR.DAL.csproj", "PARR.DAL/"]
|
||||||
|
COPY ["PARR.EsppApi/PARR.EsppApi.csproj", "PARR.EsppApi/"]
|
||||||
|
RUN dotnet restore "PARR.EsppOrderLoaderWorker/PARR.EsppOrderLoaderWorker.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/PARR.EsppOrderLoaderWorker"
|
||||||
|
RUN dotnet build "PARR.EsppOrderLoaderWorker.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
ARG app_version=0.0.0-default
|
||||||
|
RUN dotnet publish "PARR.EsppOrderLoaderWorker.csproj" -c Release -o /app/publish /p:UseAppHost=false /p:Version=$app_version
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "PARR.EsppOrderLoaderWorker.dll"]
|
||||||
@@ -5,10 +5,17 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<UserSecretsId>dotnet-PARR.EsppOrderLoaderWorker-9450cc7f-81ad-4405-8442-7d14419c7952</UserSecretsId>
|
<UserSecretsId>dotnet-PARR.EsppOrderLoaderWorker-9450cc7f-81ad-4405-8442-7d14419c7952</UserSecretsId>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Elastic.CommonSchema.Serilog" Version="8.6.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
|
<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>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,10 +1,31 @@
|
|||||||
|
using Elastic.CommonSchema.Serilog;
|
||||||
|
using Serilog;
|
||||||
using PARR.EsppOrderLoaderWorker;
|
using PARR.EsppOrderLoaderWorker;
|
||||||
|
using PARR.EsppOrderLoader;
|
||||||
|
|
||||||
IHost host = Host.CreateDefaultBuilder(args)
|
var builder = Host.CreateApplicationBuilder();
|
||||||
.ConfigureServices(services =>
|
|
||||||
{
|
|
||||||
services.AddHostedService<Worker>();
|
|
||||||
})
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
|
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.InstallEsppOrderLoaderServices(builder.Configuration);
|
||||||
|
builder.Configuration.AddEsppOrderLoaderConfigurations(builder.Services);
|
||||||
|
builder.Services.AddEsppOrderLoaderSettings(builder.Configuration);
|
||||||
|
|
||||||
|
builder.Services.AddHostedService<Worker>();
|
||||||
|
|
||||||
|
var host = builder.Build();
|
||||||
host.Run();
|
host.Run();
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
{
|
{
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"PARR.EsppOrderLoaderWorker": {
|
"PARR.EsppOrderLoaderWorker": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"dotnetRunMessages": true,
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"DOTNET_ENVIRONMENT": "Development"
|
"DOTNET_ENVIRONMENT": "Development"
|
||||||
}
|
},
|
||||||
|
"dotnetRunMessages": true
|
||||||
|
},
|
||||||
|
"Docker": {
|
||||||
|
"commandName": "Docker"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,11 +11,12 @@ namespace PARR.EsppOrderLoaderWorker
|
|||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||||
{
|
//while (!stoppingToken.IsCancellationRequested)
|
||||||
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
//{
|
||||||
await Task.Delay(1000, stoppingToken);
|
// _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
||||||
}
|
// await Task.Delay(1000, stoppingToken);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,29 @@
|
|||||||
{
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;"
|
||||||
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Microsoft.Hosting.Lifetime": "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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
docker-compose.espp-order-loader.yml
Normal file
18
docker-compose.espp-order-loader.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
version: '3.4'
|
||||||
|
|
||||||
|
# ESPP ORDER LOADER
|
||||||
|
services:
|
||||||
|
parr-espp-order-loader:
|
||||||
|
image: harbor.dvgd.rzd/parr/parr-espp-order-loader:${tag:-latest}
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
- TZ=Europe/Moscow
|
||||||
|
logging:
|
||||||
|
driver: fluentd
|
||||||
|
options:
|
||||||
|
fluentd-address: dvgd-mng-02.dvgd.oao.rzd:24224
|
||||||
|
tag: parr.parr-espp-order-loader.serilog
|
||||||
|
deploy:
|
||||||
|
replicas: 1
|
||||||
|
networks:
|
||||||
|
- parr-network
|
||||||
Reference in New Issue
Block a user