16 Commits

Author SHA1 Message Date
Samuele Locatelli 3066866c1e Merge tag 'FixWarningMysql_03' into develop
Update con reinserimento controlli health check (tranne redis full)
2025-09-23 10:34:27 +02:00
Samuele Locatelli 71ab37f101 Merge branch 'release/FixWarningMysql_03' 2025-09-23 10:34:10 +02:00
Samuele Locatelli 6aed95aa68 Ri abilitato controllo Health 2025-09-23 10:33:51 +02:00
Samuele Locatelli 8a8f9fd7e6 Merge tag 'FixWarningMysql_02' into develop
Sistemazione CI/CD x rename versioni SDK
2025-09-23 09:34:16 +02:00
Samuele Locatelli 21bbcccf76 Merge branch 'release/FixWarningMysql_02' 2025-09-23 09:33:52 +02:00
Samuele Locatelli 3c2370748e update yaml x evitare modifiche non necessarie 2025-09-23 09:32:55 +02:00
Samuele Locatelli 52819429cb commentata sezione che da problemi CI/CD 2025-09-23 09:26:02 +02:00
Samuele Locatelli 9385a4a974 Merge tag 'FixWarningMysql_01' into develop
Update conf x errori warning disconnessione frequenti (50sec)
2025-09-23 09:15:58 +02:00
Samuele Locatelli 9c9e3df572 Merge branch 'release/FixWarningMysql_01' 2025-09-23 09:15:32 +02:00
Samuele Locatelli 1c114905fc Update parametri connessione: NON scadono subito connessioni e non da warning così rapidi/ricorrenti 2025-09-23 09:15:02 +02:00
Samuele Locatelli 07464904a9 Merge branch 'SDK' into develop 2025-09-22 19:37:27 +02:00
Samuele Locatelli 7f78fe8f31 Inizio modifiche x evitare errori in MariaDB call 2025-09-22 19:37:14 +02:00
Samuele Locatelli 5a2dc3e797 Merge branch 'develop' into SDK 2024-08-08 11:09:03 +02:00
Samuele Locatelli 101f36bcd4 Merge branch 'develop' into SDK 2024-08-05 14:29:04 +02:00
Samuele Locatelli f5f0a790ee Merge branch 'develop' into SDK 2024-08-05 13:55:47 +02:00
Samuele Locatelli a0e23f60d5 Merge branch 'develop' into SDK 2024-07-17 08:13:43 +02:00
19 changed files with 133 additions and 109 deletions
+3 -5
View File
@@ -71,10 +71,6 @@ variables:
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH) $env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH) $env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH)
$env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy) $env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy)
$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
$newContenuto = $newContenuto -replace 'EgalWare © 2021', $env:NEW_COPYRIGHT
$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
# display versioni generate # display versioni generate
$resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB; $resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
Write-Output $resoconto; Write-Output $resoconto;
@@ -167,6 +163,9 @@ EgwProxy.MagMan:staging:
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted' - '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# INSTALLER
# --------------------------------
installer: installer:
stage: installer stage: installer
tags: tags:
@@ -189,7 +188,6 @@ installer:
# -------------------------------- # --------------------------------
# RELEASE # RELEASE
# -------------------------------- # --------------------------------
EgwProxy.MagMan:release: EgwProxy.MagMan:release:
stage: release stage: release
needs: ["EgwProxy.MagMan:build"] needs: ["EgwProxy.MagMan:build"]
+3 -2
View File
@@ -35,10 +35,11 @@ namespace MagMan.Data.Admin
public static bool CheckCreateUser(string username, string pwd, string dbName) public static bool CheckCreateUser(string username, string pwd, string dbName)
{ {
bool answ = false; bool answ = false;
int numUser = 0;
using (ServerAdminContext adbCtx = new ServerAdminContext()) using (ServerAdminContext adbCtx = new ServerAdminContext())
{ {
// ricerca utente... // ricerca utente...
var numUser = adbCtx numUser = adbCtx
.UserList .UserList
.Where(x => x.User == username) .Where(x => x.User == username)
.ToList() .ToList()
@@ -54,7 +55,7 @@ namespace MagMan.Data.Admin
adbCtx.Database.ExecuteSqlRaw(sqlCommand); adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';"; sqlCommand = $"CREATE USER '{username}'@'localhost' IDENTIFIED BY '{pwd}';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand); adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = $"GRANT ALL ON *.* TO '{username}'@'localhost';"; sqlCommand = $"GRANT ALL PRIVILEGES ON {dbName}.* TO '{username}'@'localhost';";
adbCtx.Database.ExecuteSqlRaw(sqlCommand); adbCtx.Database.ExecuteSqlRaw(sqlCommand);
sqlCommand = "FLUSH PRIVILEGES;"; sqlCommand = "FLUSH PRIVILEGES;";
adbCtx.Database.ExecuteSqlRaw(sqlCommand); adbCtx.Database.ExecuteSqlRaw(sqlCommand);
+12 -7
View File
@@ -51,12 +51,16 @@ namespace MagMan.Data.Admin
public static ServerVersion CustomAutoDetect(string connectionString) public static ServerVersion CustomAutoDetect(string connectionString)
{ {
#if false
using var connection = new MySqlConnection( using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString) new MySqlConnectionStringBuilder(connectionString)
{ {
Database = string.Empty, Database = string.Empty,
// AutoEnlist = false, Pooling = false, // AutoEnlist = false, Pooling = false,
}.ConnectionString); }.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open(); connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion); ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers; return currVers;
@@ -82,15 +86,16 @@ namespace MagMan.Data.Admin
{ {
DATABASE_SERV = server; DATABASE_SERV = server;
// tutto fisso x gestione utenti // tutto fisso x gestione utenti
CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;"; CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
// stringa admin con utente admin dell'applicazione (già creato)... // stringa admin con utente admin dell'applicazione (già creato)...
ADMIN_CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database=mysql;uid=egalware;pwd=Egalware_24068!;sslmode=None;"; ADMIN_CONNECTION_STRING = $"Server={DATABASE_SERV};port=3306;database=mysql;uid=egalware;pwd=Egalware_24068!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
} }
public static ServerVersion MysqlServerVersion(string connString) public static ServerVersion MysqlServerVersion(string connString)
{ {
// fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859 // fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859
//Log.Info($"MysqlServerVersion | {connString}"); //Log.Info($"MysqlServerVersion | {connString}");
//ServerVersion serverVersion = ServerVersion.Parse("10.11.13-MariaDB");
ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql"); ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql");
bool versOk = false; bool versOk = false;
try try
+2 -1
View File
@@ -51,7 +51,8 @@ namespace MagMan.Data.Admin
// commentato x test su cluster in ufficio // commentato x test su cluster in ufficio
#if DEBUG #if DEBUG
//connString = "Server=localhost;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;"; //connString = "Server=localhost;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
connString = "Server=mdb03.ufficio;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;"; //connString = "Server=mdb03.ufficio;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
connString = "Server=mdb.ufficio;port=3306;database=MagMan_Admin;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
#endif #endif
var serverVersion = DbConfig.MysqlServerVersion(connString); var serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion); optionsBuilder.UseMySql(connString, serverVersion);
+11 -8
View File
@@ -62,9 +62,8 @@ namespace MagMan.Data.Admin
// chiave cablata x gestione Server se fosse vuota... // chiave cablata x gestione Server se fosse vuota...
if (string.IsNullOrEmpty(connString)) if (string.IsNullOrEmpty(connString))
{ {
connString = "Server=localhost;port=3306;database=mysql;user=egalware;pwd=Egalware_24068!;sslmode=None;"; connString = "Server=localhost;port=3306;database=mysql;user=egalware;pwd=Egalware_24068!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;";
} }
ServerVersion serverVersion = DbConfig.MysqlServerVersion(connString); ServerVersion serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion); optionsBuilder.UseMySql(connString, serverVersion);
@@ -78,13 +77,17 @@ namespace MagMan.Data.Admin
public static ServerVersion CustomAutoDetect(string connectionString) public static ServerVersion CustomAutoDetect(string connectionString)
{ {
#if false
using var connection = new MySqlConnection( using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString) new MySqlConnectionStringBuilder(connectionString)
{ {
Database = string.Empty, Database = string.Empty,
// AutoEnlist = false, // AutoEnlist = false,
// Pooling = false, // Pooling = false,
}.ConnectionString); }.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open(); connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion); ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers; return currVers;
@@ -43,7 +43,6 @@ namespace MagMan.Data.Admin.Services
// chiudo log // chiudo log
Log.Info("MTAdminService started!"); Log.Info("MTAdminService started!");
_userManager = userManager;
} }
#endregion Public Constructors #endregion Public Constructors
+11 -7
View File
@@ -34,12 +34,15 @@ namespace MagMan.Data.Tenant
public static ServerVersion CustomAutoDetect(string connectionString) public static ServerVersion CustomAutoDetect(string connectionString)
{ {
#if false
using var connection = new MySqlConnection( using var connection = new MySqlConnection(
new MySqlConnectionStringBuilder(connectionString) new MySqlConnectionStringBuilder(connectionString)
{ {
Database = string.Empty, Database = string.Empty,
// AutoEnlist = false, Pooling = false, // AutoEnlist = false, Pooling = false,
}.ConnectionString); }.ConnectionString);
#endif
using var connection = new MySqlConnection(connectionString);
connection.Open(); connection.Open();
ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion); ServerVersion currVers = ServerVersion.Parse(connection.ServerVersion);
return currVers; return currVers;
@@ -48,7 +51,7 @@ namespace MagMan.Data.Tenant
public static string CustomerConnString(string server, int nKey) public static string CustomerConnString(string server, int nKey)
{ {
string dbName = $"MagMan_{nKey:000000}"; string dbName = $"MagMan_{nKey:000000}";
return $"server={server};port=3306;database={dbName};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=10;"; return $"server={server};port=3306;database={dbName};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
//LoadBalance=RoundRobin;Pooling=true; //LoadBalance=RoundRobin;Pooling=true;
} }
@@ -64,7 +67,7 @@ namespace MagMan.Data.Tenant
{ {
DATABASE_SERV = server; DATABASE_SERV = server;
DATABASE_NAME = $"MagMan_{nKey:000000}"; DATABASE_NAME = $"MagMan_{nKey:000000}";
CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=10;"; CONNECTION_STRING = $"server={DATABASE_SERV};port=3306;database={DATABASE_NAME};uid={DATABASE_USER};pwd={DATABASE_PWD};sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
//LoadBalance=RoundRobin;Pooling=true; //LoadBalance=RoundRobin;Pooling=true;
} }
@@ -72,6 +75,7 @@ namespace MagMan.Data.Tenant
{ {
// fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859 // fix come da https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1859
//Log.Info($"MysqlServerVersion | {connString}"); //Log.Info($"MysqlServerVersion | {connString}");
//ServerVersion serverVersion = ServerVersion.Parse("10.11.13-MariaDB");
ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql"); ServerVersion serverVersion = ServerVersion.Parse("10.5.25-mysql");
bool versOk = false; bool versOk = false;
try try
+1 -1
View File
@@ -32,7 +32,7 @@ namespace MagMan.Data.Tenant.DbModels
public int QtyAvail { get; set; } = 0; public int QtyAvail { get; set; } = 0;
/// <summary> /// <summary>
/// Bool for logical delete (clound and on PC...) /// Bool for logical delete (cloud and on PC...)
/// </summary> /// </summary>
public bool IsDeleted { get; set; } = false; public bool IsDeleted { get; set; } = false;
+2 -1
View File
@@ -74,8 +74,9 @@ namespace MagMan.Data.Tenant
{ {
// commentato x test su cluster in ufficio // commentato x test su cluster in ufficio
#if DEBUG #if DEBUG
connString = "Server=localhost;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;"; //connString = "Server=localhost;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
////connString = "Server=mdb03.ufficio;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;"; ////connString = "Server=mdb03.ufficio;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;";
connString = "Server=mdb.ufficio;port=3306;database=MagMan_000470;uid=MagMan_DbUser;pwd=viad@nte16!;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;ConnectionIdleTimeout=30;ConnectionLifeTime=300;";
#endif #endif
var serverVersion = DbConfig.MysqlServerVersion(connString); var serverVersion = DbConfig.MysqlServerVersion(connString);
optionsBuilder.UseMySql(connString, serverVersion, options => options.EnableRetryOnFailure( optionsBuilder.UseMySql(connString, serverVersion, options => options.EnableRetryOnFailure(
+30 -26
View File
@@ -1,13 +1,14 @@
using MagMan.Data.Tenant.DbModels; using MagMan.Data;
using MagMan.Data; using MagMan.Data.Admin;
using MagMan.Data.Admin.DbModels;
using MagMan.Data.Tenant;
using MagMan.Data.Tenant.DbModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Diagnostics.HealthChecks;
using MySqlConnector;
using NLog; using NLog;
using Org.BouncyCastle.Pqc.Crypto.Lms; using Org.BouncyCastle.Pqc.Crypto.Lms;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using MagMan.Data.Admin;
using MagMan.Data.Admin.DbModels;
using Microsoft.EntityFrameworkCore;
using MagMan.Data.Tenant;
namespace MagMan.UI.Health namespace MagMan.UI.Health
{ {
@@ -19,6 +20,7 @@ namespace MagMan.UI.Health
#endregion Private Fields #endregion Private Fields
#region Public Methods #region Public Methods
public static async Task<HealthCheckResult> DbIdentity(string dbName) public static async Task<HealthCheckResult> DbIdentity(string dbName)
@@ -30,8 +32,9 @@ namespace MagMan.UI.Health
var healthCheckData = new Dictionary<string, object>(); var healthCheckData = new Dictionary<string, object>();
try try
{ {
string sqlQuery = $"SELECT 'AspNetUsers' AS TableName, COUNT(*) AS Count FROM information_schema.tables WHERE table_schema = '{dbName}' AND table_name = 'AspNetUsers' LIMIT 1;"; var dbParam = new MySqlParameter("dbName", dbName);
var table = await Task.FromResult(appDb.DbSetCounts.FromSqlRaw(sqlQuery).ToList()); string sqlQuery = $"SELECT 'AspNetUsers' AS TableName, COUNT(*) AS Count FROM information_schema.tables WHERE table_schema = @dbName AND table_name = 'AspNetUsers' LIMIT 1;";
var table = await appDb.DbSetCounts.FromSqlRaw(sqlQuery, dbParam).ToListAsync();
// provo a controllare se ho tab utenti // provo a controllare se ho tab utenti
if (table != null && table.Count > 0) if (table != null && table.Count > 0)
@@ -59,9 +62,9 @@ namespace MagMan.UI.Health
var healthCheckData = new Dictionary<string, object>(); var healthCheckData = new Dictionary<string, object>();
using (MultiTenantContext localDbCtx = new MultiTenantContext()) using (MultiTenantContext localDbCtx = new MultiTenantContext())
{ {
var dbCount = localDbCtx var dbCount = await localDbCtx
.DbSetCustomers .DbSetCustomers
.Count(); .CountAsync();
if (dbCount > 0) if (dbCount > 0)
{ {
description = $"Check CUSTOMERS table, found {dbCount} records"; description = $"Check CUSTOMERS table, found {dbCount} records";
@@ -76,27 +79,27 @@ namespace MagMan.UI.Health
public static async Task<HealthCheckResult> DbUserRoot(string dbName) public static async Task<HealthCheckResult> DbUserRoot(string dbName)
{ {
using (var adminDb = new ServerAdminContext()) List<MagMan.Data.Admin.DbModels.UserPriv> userList = new List<MagMan.Data.Admin.DbModels.UserPriv>();
string description = "Try check MySql User table";
var healthCheckData = new Dictionary<string, object>();
try
{ {
string description = "Try check MySql User table"; // provo a controllare se ho tab utenti
List<MagMan.Data.Admin.DbModels.UserPriv> userList = new List<MagMan.Data.Admin.DbModels.UserPriv>(); using (var adminDb = new ServerAdminContext())
var healthCheckData = new Dictionary<string, object>();
try
{ {
// provo a controllare se ho tab utenti userList = await adminDb.UserList.ToListAsync();
userList = await Task.FromResult(adminDb.UserList.ToList()).ConfigureAwait(false);
if (userList.Count > 0)
{
description = $"Check MySql User table, found {userList.Count} records";
return HealthCheckResult.Healthy(description, healthCheckData);
}
} }
catch (Exception exc) if (userList.Count > 0)
{ {
Log.Error(exc, "Errore in esecuzione DbUserRoot"); description = $"Check MySql User table, found {userList.Count} records";
return HealthCheckResult.Healthy(description, healthCheckData);
} }
return HealthCheckResult.Unhealthy(description + $" {dbName}", null, healthCheckData);
} }
catch (Exception exc)
{
Log.Error(exc, "Errore in esecuzione DbUserRoot");
}
return HealthCheckResult.Unhealthy(description + $" {dbName}", null, healthCheckData);
} }
public static async Task<HealthCheckResult> PingCheck(string hostName) public static async Task<HealthCheckResult> PingCheck(string hostName)
@@ -105,7 +108,8 @@ namespace MagMan.UI.Health
{ {
return HealthCheckResult.Unhealthy($"Wrong Hostname: {hostName}"); return HealthCheckResult.Unhealthy($"Wrong Hostname: {hostName}");
} }
else { else
{
using (var thePing = new Ping()) using (var thePing = new Ping())
{ {
var pingResult = await thePing.SendPingAsync(hostName); var pingResult = await thePing.SendPingAsync(hostName);
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<Version>1.0.2408.0514</Version> <Version>1.0.2509.2310</Version>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<EnableNETAnalyzers>true</EnableNETAnalyzers> <EnableNETAnalyzers>true</EnableNETAnalyzers>
+34 -29
View File
@@ -43,11 +43,9 @@ string admConnStr = MagMan.Data.Admin.DbConfig.CONNECTION_STRING;
// inizializzo il DB e creo (se necessario) l'utente // inizializzo il DB e creo (se necessario) l'utente
MagMan.Data.Admin.DbConfig.CheckUser(nKey, sKey); MagMan.Data.Admin.DbConfig.CheckUser(nKey, sKey);
MagMan.Data.Admin.DbConfig.ExecMigrationIdentity();
// migrazione Db x gestione multitenant // migrazione Db x gestione multitenant
MagMan.Data.Admin.DbConfig.ExecMigrationMultiTenant(); MagMan.Data.Admin.DbConfig.ExecMigrationMultiTenant();
string connStringDB = MagMan.Data.Admin.DbConfig.CONNECTION_STRING; string connStringDB = MagMan.Data.Admin.DbConfig.CONNECTION_STRING;
/* /*
@@ -59,29 +57,33 @@ string connStringDB = MagMan.Data.Admin.DbConfig.CONNECTION_STRING;
* ExecStart=/usr/bin/dotnet /var/www/magman/MagMan.UI.dll --urls "http://10.74.82.92:5005" * ExecStart=/usr/bin/dotnet /var/www/magman/MagMan.UI.dll --urls "http://10.74.82.92:5005"
* *
* */ * */
// abilitazione blobale healthCheck...
bool enabHealth = builder.Configuration.GetValue<bool>("OptConf:EnableHealth");
if (enabHealth)
{
builder.Services.AddHealthChecks()
.AddMySql(connStringDB, "MySql instance")
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => MagMan.UI.Health.Checks.PingCheck(dbServerAddr))
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => MagMan.UI.Health.Checks.PingCheck(redisSrvAddr))
// 512 MB max allocated memory
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded)
// 2025.09.23 problemi con sentinel... commentato!
//.AddRedis(connStringRedis, "Redis", failureStatus: HealthStatus.Degraded)
//.AddRedis(builder.Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded)
.AddAsyncCheck($"MySql Identity", () => MagMan.UI.Health.Checks.DbIdentity(MagMan.Data.Admin.DbConfig.DATABASE_NAME))
.AddAsyncCheck($"MySql Customers", () => MagMan.UI.Health.Checks.CustomersCount())
;
builder.Services.AddHealthChecksUI(s =>
builder.Services.AddHealthChecks() {
.AddMySql(connStringDB, "MySql instance") s.AddHealthCheckEndpoint("MagMan_Services", "health");
.AddAsyncCheck($"DB PING ({dbServerAddr})", () => MagMan.UI.Health.Checks.PingCheck(dbServerAddr)) s.SetEvaluationTimeInSeconds(60);
.AddAsyncCheck($"Redis PING ({redisSrvAddr})", () => MagMan.UI.Health.Checks.PingCheck(redisSrvAddr)) s.SetMinimumSecondsBetweenFailureNotifications(120);
// 512 MB max allocated memory s.SetApiMaxActiveRequests(5);
.AddProcessAllocatedMemoryHealthCheck(512, "Max Process memory (<512MB)", failureStatus: HealthStatus.Degraded) s.SetHeaderText("MagMan Health Check Status");
.AddRedis(builder.Configuration.GetConnectionString("Redis"), "Redis", failureStatus: HealthStatus.Degraded) })
.AddAsyncCheck($"MySql Identity", () => MagMan.UI.Health.Checks.DbIdentity(MagMan.Data.Admin.DbConfig.DATABASE_NAME)) .AddInMemoryStorage();
.AddAsyncCheck($"MySql Customers", () => MagMan.UI.Health.Checks.CustomersCount()) }
;
builder.Services.AddHealthChecksUI(s =>
{
s.AddHealthCheckEndpoint("MagMan_Services", "health");
s.SetEvaluationTimeInSeconds(60);
s.SetMinimumSecondsBetweenFailureNotifications(120);
s.SetApiMaxActiveRequests(5);
s.SetHeaderText("MagMan Health Check Status");
})
.AddInMemoryStorage();
// cookie applicazione da 14 gg (defaul) a 30 // cookie applicazione da 14 gg (defaul) a 30
builder.Services.ConfigureApplicationCookie(o => builder.Services.ConfigureApplicationCookie(o =>
@@ -179,12 +181,15 @@ app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); endpoints.MapControllers();
endpoints.MapBlazorHub(); endpoints.MapBlazorHub();
endpoints.MapHealthChecksUI(); if (enabHealth)
endpoints.MapHealthChecks("/health", new HealthCheckOptions
{ {
Predicate = _ => true, endpoints.MapHealthChecksUI();
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse endpoints.MapHealthChecks("/health", new HealthCheckOptions
}); {
Predicate = _ => true,
ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
}
endpoints.MapFallbackToPage("/_Host"); endpoints.MapFallbackToPage("/_Host");
}); });
+5 -5
View File
@@ -8,11 +8,11 @@
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:26379, serviceName=prod-ovh, DefaultDatabase=14, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false", "Redis": "localhost:26379, serviceName=prod-ovh, DefaultDatabase=14, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false",
"UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;" "MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;"
}, },
"DbConfig": { "DbConfig": {
"Server": "localhost", "Server": "localhost",
+5 -5
View File
@@ -8,11 +8,11 @@
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:6379,DefaultDatabase=14,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", "Redis": "localhost:6379,DefaultDatabase=14,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;" "MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;"
}, },
"DbConfig": { "DbConfig": {
"Server": "localhost", "Server": "localhost",
+1 -1
View File
@@ -7,7 +7,7 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "redis01.ufficio:26379,serviceName=devel,DefaultDatabase=14,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true" "Redis": "redis.ufficio:26379,serviceName=devel,DefaultDatabase=14,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true"
}, },
//"DbConfig": { //"DbConfig": {
// "Server": "localhost", // "Server": "localhost",
+9 -6
View File
@@ -2,17 +2,19 @@
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Debug",
"MySqlConnector": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning"
} }
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Redis": "localhost:26379, redis01.ufficio:26379, redis02.ufficio:26379, serviceName=devel, DefaultDatabase=14, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, allowAdmin=true", "Redis": "redis.ufficio:26379, serviceName=devel, DefaultDatabase=14, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, allowAdmin=true",
"UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "UserIdentityDbContextConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AuthConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "DefaultConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;", "AdminConnection": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;",
"MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;" "MagMan.Data": "Server=localhost;port=3306;database=MagMan_Dev;user=MagMan;pwd=MagMan_secret_pwd;sslmode=None;Connection Lifetime=60;Connection Timeout=15;DefaultCommandTimeout=30;"
}, },
"DbConfig": { "DbConfig": {
//"Server": "localhost", //"Server": "localhost",
@@ -25,6 +27,7 @@
"OptConf": { "OptConf": {
"CodApp": "MagMan", "CodApp": "MagMan",
"NumPar": 4, "NumPar": 4,
"EnableHealth": true,
"msRefresh": "4000", "msRefresh": "4000",
"BaseAddr": "https://localhost:7207/", "BaseAddr": "https://localhost:7207/",
"BaseAppPath": "", "BaseAppPath": "",
+1 -1
View File
@@ -1,6 +1,6 @@
<body> <body>
<i>MagMan - Wood Warehouse Management System</i> <i>MagMan - Wood Warehouse Management System</i>
<h4>Versione: 1.0.2408.0514</h4> <h4>Versione: 1.0.2509.2310</h4>
<br /> Note di rilascio: <br /> Note di rilascio:
<ul> <ul>
<li> <li>
+1 -1
View File
@@ -1 +1 @@
1.0.2408.0514 1.0.2509.2310
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<item> <item>
<version>1.0.2408.0514</version> <version>1.0.2509.2310</version>
<url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url> <url>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog> <changelog>http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory> <mandatory>false</mandatory>