ancora ottimizzazioni deploy

This commit is contained in:
Samuele Locatelli
2026-05-08 09:45:29 +02:00
parent d9728dc706
commit ec3c5e65e6
17 changed files with 201 additions and 50 deletions
+10 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.RIOC</RootNamespace>
<Version>8.16.2605.808</Version>
<Version>8.16.2605.809</Version>
</PropertyGroup>
<ItemGroup>
@@ -28,6 +28,15 @@
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<None Update="RedisScript\RedisUpdateScript_v5.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="RedisScript\RedisUpdateScript_v6.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
</Target>
+45 -3
View File
@@ -1,4 +1,7 @@
using MP.RIOC.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using MP.Core.Conf;
using MP.Data;
using MP.RIOC.Services;
using NLog;
using NLog.Web;
@@ -23,10 +26,33 @@ logger.Info($"Current ASPNETCORE_ENVIRONMENT: {env.EnvironmentName}");
ConfigurationManager configuration = builder.Configuration;
// REDIS setup
logger.Info("Config OK");
string confRedis = configuration.GetConnectionString("Redis");
string confRedis = configuration.GetConnectionString("Redis") ?? "localhost:6379";
string redisSrvAddr = confRedis.Substring(0, confRedis.IndexOf(":"));
logger.Info("Setup REDIS OK");
builder.Services.Configure<RedisScriptsConfig>(
builder.Configuration.GetSection("RedisScripts"));
logger.Info("RedisScript Provider configured");
// Metodi principali x accesso dati
var connStr = builder.Configuration.GetConnectionString("MP.Data")
?? throw new InvalidOperationException("ConnString 'MP.Data' mancante.");
//builder.Services.AddMemoryCache();
builder.Services.AddDbContextFactory<MoonProContext>(options =>
options.UseSqlServer(connStr)
.EnableSensitiveDataLogging(false) // true solo in Sviluppo
.ConfigureWarnings(w => w.Ignore(CoreEventId.ManyServiceProvidersCreatedWarning)));
// MP.Data DbContext for Stats repositories
string utilsConnString = builder.Configuration.GetConnectionString("MP.Utils") ?? "Server=localhost;Database=MoonPro_Utils; integrated security=True; MultipleActiveResultSets=True; App=MP.IOC;";
builder.Services.AddDbContextFactory<MoonPro_UtilsContext>(options =>
options.UseSqlServer(utilsConnString));
// MP.Data Services Utils - Statistiche DB
builder.Services.AddIocDataLayer();
// 1. Configurazione dell'invoker personalizzato (Risolve i tuoi errori)
var httpClientInvoker = new HttpMessageInvoker(new SocketsHttpHandler
{
@@ -36,7 +62,7 @@ var httpClientInvoker = new HttpMessageInvoker(new SocketsHttpHandler
UseCookies = false,
// Correzione per il tracing: usa il propagatore corrente di sistema
ActivityHeadersPropagator = DistributedContextPropagator.Current,
ConnectTimeout = TimeSpan.FromSeconds(15),
ConnectTimeout = TimeSpan.FromSeconds(30),
// Gestione certificato (ignora errori per localhost/test)
SslOptions = new System.Net.Security.SslClientAuthenticationOptions
@@ -82,6 +108,22 @@ builder.Services.AddRazorPages();
var app = builder.Build();
// Blocco per la migrazione automatica del DB Utils...
using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
try
{
var context = services.GetRequiredService<MoonPro_UtilsContext>();
context.Database.Migrate();
}
catch (Exception ex)
{
var migrateLogger = services.GetRequiredService<ILogger<Program>>();
migrateLogger.LogError(ex, "Si verificato un errore durante l'aggiornamento del database.");
}
}
// 1. Configurazione Base Path
string baseUrl = configuration.GetValue<string>("ServerConf:BaseUrlIoc") ?? "/MP/RIOC";
app.UsePathBase(baseUrl);
+28 -21
View File
@@ -1,25 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://iis01.egalware.com/MP/RIOC/</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>b9188473-f4ae-4f9f-be2d-70edaace0db9</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://iis01.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site/MP/RIOC</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>jenkins</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://iis01.egalware.com/MP/RIOC/</SiteUrlToLaunchAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>b9188473-f4ae-4f9f-be2d-70edaace0db9</ProjectGuid>
<SelfContained>false</SelfContained>
<MSDeployServiceURL>https://iis01.egalware.com:8172/MsDeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>Default Web Site/MP/RIOC</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>false</SkipExtraFilesOnServer>
<ExcludeFoldersFromDeployment>logs</ExcludeFoldersFromDeployment>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>true</EnableMSDeployBackup>
<EnableMsDeployAppOffline>true</EnableMsDeployAppOffline>
<UserName>jenkins</UserName>
<_SavePWD>true</_SavePWD>
<_TargetId>IISWebDeploy</_TargetId>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<MsDeploySkipRules Include="SkipLogsFolder">
<ObjectName>dirPath</ObjectName>
<AbsolutePath>\\logs$</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
</Project>
@@ -2,7 +2,7 @@
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<History>False|2026-05-08T07:04:47.5869659Z||;False|2026-05-08T09:01:28.1405561+02:00||;False|2026-05-08T09:00:37.4358771+02:00||;False|2026-05-08T08:58:53.9394322+02:00||;False|2026-05-08T08:57:18.3710854+02:00||;False|2026-05-08T08:56:39.0642155+02:00||;True|2026-05-08T08:36:15.4113336+02:00||;False|2026-05-08T08:35:31.1992313+02:00||;False|2026-05-08T08:34:56.3101908+02:00||;False|2026-05-08T08:34:41.2943768+02:00||;True|2026-05-08T08:28:29.2065443+02:00||;</History>
<History>True|2026-05-08T07:44:50.2145461Z||;False|2026-05-08T09:42:53.1130763+02:00||;True|2026-05-08T09:34:45.8167687+02:00||;False|2026-05-08T09:34:21.4017890+02:00||;True|2026-05-08T09:24:04.8527556+02:00||;False|2026-05-08T09:04:47.5869659+02:00||;False|2026-05-08T09:01:28.1405561+02:00||;False|2026-05-08T09:00:37.4358771+02:00||;False|2026-05-08T08:58:53.9394322+02:00||;False|2026-05-08T08:57:18.3710854+02:00||;False|2026-05-08T08:56:39.0642155+02:00||;True|2026-05-08T08:36:15.4113336+02:00||;False|2026-05-08T08:35:31.1992313+02:00||;False|2026-05-08T08:34:56.3101908+02:00||;False|2026-05-08T08:34:41.2943768+02:00||;True|2026-05-08T08:28:29.2065443+02:00||;</History>
<LastFailureDetails />
<TimeStampOfAssociatedLegacyPublishXmlFile />
<EncryptedPassword>AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAlmCNMQ0J1UqPM+RugOqtLgAAAAACAAAAAAAQZgAAAAEAACAAAABmDmKQdTOJuzYQ2FFyU+1htQ8H/TQ+IM9D7RchZs6pvgAAAAAOgAAAAAIAACAAAABeb+XK2KUWpsQ2fiYxFKeezXYyZloQPjo9Qkmjbf+FlyAAAAAR+ckV3KTLXMIMyW4f5PBdp6Uxv5tWJ5LldbO4N+tXYUAAAACJwytTC9fJKy3wyHTlSVYRd/OdBUQ8pCweu3wSK3CGvcpgwT+VFYooELXfzgEV8l6P6FrAdGoF0gt9O3yyn1X4</EncryptedPassword>
+31
View File
@@ -0,0 +1,31 @@
<body>
<i>Modulo MP-RIOC </i>
<h4>Versione: {{CURRENT-REL}}</h4>
<br /> Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.8.16.* &rarr;</b>
<ul>
<li>Ottimizzazioni varie x Redis</li>
</ul>
</li>
<li>
<b>v.8.16.* &rarr;</b>
<ul>
<li>Prima release dotNet 8.0 router</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2026</a>
</div>
</div>
</body>
+31
View File
@@ -0,0 +1,31 @@
<body>
<i>Modulo MP-RIOC </i>
<h4>Versione: 8.16.2605.809</h4>
<br /> Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.8.16.* &rarr;</b>
<ul>
<li>Ottimizzazioni varie x Redis</li>
</ul>
</li>
<li>
<b>v.8.16.* &rarr;</b>
<ul>
<li>Prima release dotNet 8.0 router</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2026</a>
</div>
</div>
</body>
+1
View File
@@ -0,0 +1 @@
8.16.2605.809
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.0.0</version>
<url>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/ChangeLog.html</changelog>
<mandatory>false</mandatory>
</item>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2605.809</version>
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
</item>
+2 -3
View File
@@ -1,5 +1,4 @@
using MP.RIOC.Services;
using NLog;
using NLog;
using StackExchange.Redis;
using System.Globalization;
@@ -56,7 +55,7 @@ namespace MP.RIOC.Services
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var interval = _config.GetValue<int>("RouteMan:MetricCalcIntervalSeconds", 20);
var interval = _config.GetValue<int>("RouteMan:MetricCalcIntervalSeconds", 30);
while (!stoppingToken.IsCancellationRequested)
{
+1 -1
View File
@@ -27,7 +27,7 @@ namespace MP.RIOC.Services
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var interval = _config.GetValue<int>("RouteMan:MetricFlushIntervalSeconds", 300);
var interval = _config.GetValue<int>("RouteMan:MetricFlushIntervalSeconds", 180);
while (!stoppingToken.IsCancellationRequested)
{
+24
View File
@@ -0,0 +1,24 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"CodApp": "MP.RIOC",
"ConnectionStrings": {
"MP.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro;User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.RIOC;",
"MP.Utils": "Server=localhost\\SQLEXPRESS;Database=MoonPro_Utils; User ID=steamware;Password=viadante16; integrated security=False; App=MP.RIOC;",
"Redis": "localhost:6379,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "localhost:6379,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
},
"ServerConf": {
"useFactory": false
},
"RedisScripts": {
"Scripts": {
"Update": "RedisScript/RedisUpdateScript_v5.lua"
}
}
}
+10 -1
View File
@@ -22,6 +22,8 @@
"logfile": {
"type": "File",
"fileName": "${basedir}/logs/${shortdate}.log",
"keepFileOpen": false,
"concurrentWrites": true,
"archiveEvery": "Day",
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
"archiveNumbering": "DateAndSequence",
@@ -50,7 +52,7 @@
},
"CodApp": "MP.RIOC",
"RouteMan": {
"MetricCalcIntervalSeconds": 10,
"MetricCalcIntervalSeconds": 20,
"MetricFlushIntervalSeconds": 60,
"DefaultWeightOld": 100,
"DefaultWeightNew": 0,
@@ -71,7 +73,14 @@
"redisShortTimeCache": 30,
"useFactory": true
},
"RedisScripts": {
"Scripts": {
"Update": "RedisScript/RedisUpdateScript_v6.lua"
}
},
"ConnectionStrings": {
"MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; App=MP.IOC;",
"MP.Utils": "Server=SQL2016DEV;Database=MoonPro_Utils; User ID=sa;Password=keyhammer16; integrated security=False; App=MP.RIOC;",
"Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"RedisAdmin": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=5,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
}
@@ -14,15 +14,6 @@ namespace MP.Data
{
public static IServiceCollection AddIocDataLayer(this IServiceCollection services)
{
//// DbContextFactory: preferibile in Blazor Server e scenari concorrenti
//services.AddDbContextFactory<DataLayerContext>(options =>
// options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString)));
//// servizi preliminari
////services.TryAddSingleton<IConnectionMultiplexer>(redisConn);
//services.TryAddSingleton<IRedisService, RedisService>();
//services.TryAddSingleton<IRedisSubscriptionManager, RedisSubscriptionManager>();
// Repository Singleton
services.TryAddSingleton<IMtcSetupRepository, MtcSetupRepository>();
@@ -40,14 +31,6 @@ namespace MP.Data
services.TryAddScoped<IStatsAggrService, StatsAggrService>();
services.TryAddScoped<IStatsDetailService, StatsDetailService>();
//// aggiunta servizi finali Singleton...
//services.TryAddSingleton<IImageCacheService, ImageCacheService>();
//services.TryAddSingleton<IConfigDataService, ConfigDataService>();
//services.TryAddSingleton<ICalcRequestService, CalcRequestService>();
//services.TryAddSingleton<IFileService, FileService>();
//services.TryAddSingleton<IProdService, ProdService>();
return services;
}
}
+1 -1
View File
@@ -25,7 +25,7 @@
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2023</a>
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2026</a>
</div>
</div>
</body>
+2 -1
View File
@@ -2,7 +2,6 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Yarp": "Debug",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore.Database.Command": "Warning",
"Microsoft.EntityFrameworkCore.Infrastructure": "Warning",
@@ -27,6 +26,8 @@
"logfile": {
"type": "File",
"fileName": "${basedir}/logs/${shortdate}.log",
"keepFileOpen": false,
"concurrentWrites": true,
"archiveEvery": "Day",
"archiveFileName": "${basedir}/logs/old/${shortdate}_{#}.log",
"archiveNumbering": "DateAndSequence",