mirror of
				https://gitee.com/ThingsGateway/ThingsGateway.git
				synced 2025-10-31 15:43:59 +08:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			10.11.43.0
			...
			10.11.44.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0e3898218b | 
| @@ -106,6 +106,17 @@ public static class Runtime | ||||
|  | ||||
| #if NET6_0_OR_GREATER | ||||
|  | ||||
|  | ||||
|     public static Boolean IsSystemd | ||||
|     { | ||||
|         get | ||||
|         { | ||||
|             var id = Environment.GetEnvironmentVariable("INVOCATION_ID"); | ||||
|             return !string.IsNullOrEmpty(id); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public static Boolean? isLegacyWindows; | ||||
|  | ||||
|     /// <summary> | ||||
|   | ||||
| @@ -21,6 +21,7 @@ public class Setting : Config<Setting> | ||||
|     #region 属性 | ||||
|     /// <summary>是否启用全局调试。默认启用</summary> | ||||
|     [Description("全局调试。XTrace.Debug")] | ||||
|     [XmlIgnore, IgnoreDataMember] | ||||
|     public Boolean Debug { get; set; } = true; | ||||
|  | ||||
|     /// <summary>日志等级,只输出大于等于该级别的日志,All/Debug/Info/Warn/Error/Fatal,默认Info</summary> | ||||
| @@ -30,6 +31,7 @@ public class Setting : Config<Setting> | ||||
|  | ||||
|     /// <summary>文件日志目录。默认Log子目录</summary> | ||||
|     [Description("文件日志目录。默认Log子目录")] | ||||
|     [XmlIgnore, IgnoreDataMember] | ||||
|     public String LogPath { get; set; } = "Logs/XLog"; | ||||
|  | ||||
|     /// <summary>日志文件上限。超过上限后拆分新日志文件,默认5MB,0表示不限制大小</summary> | ||||
| @@ -42,6 +44,7 @@ public class Setting : Config<Setting> | ||||
|  | ||||
|     /// <summary>日志文件格式。默认{0:yyyy_MM_dd}.log,支持日志等级如 {1}_{0:yyyy_MM_dd}.log</summary> | ||||
|     [Description("日志文件格式。默认{0:yyyy_MM_dd}.log,支持日志等级如 {1}_{0:yyyy_MM_dd}.log")] | ||||
|     [XmlIgnore, IgnoreDataMember] | ||||
|     public String LogFileFormat { get; set; } = "{0:yyyy_MM_dd}.log"; | ||||
|  | ||||
|     /// <summary>日志行格式。默认Time|ThreadId|Kind|Name|Message,还支持Level</summary> | ||||
|   | ||||
| @@ -52,7 +52,7 @@ | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> | ||||
| 		<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||||
| 		<PackageReference Include="Newtonsoft.Json" Version="13.0.4" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| <Project> | ||||
|  | ||||
| 	<PropertyGroup> | ||||
| 		<PluginVersion>10.11.43</PluginVersion> | ||||
| 		<ProPluginVersion>10.11.43</ProPluginVersion> | ||||
| 		<DefaultVersion>10.11.43</DefaultVersion> | ||||
| 		<PluginVersion>10.11.44</PluginVersion> | ||||
| 		<ProPluginVersion>10.11.44</ProPluginVersion> | ||||
| 		<DefaultVersion>10.11.44</DefaultVersion> | ||||
| 		<AuthenticationVersion>10.11.5</AuthenticationVersion> | ||||
| 		<SourceGeneratorVersion>10.11.4</SourceGeneratorVersion> | ||||
| 		<NET8Version>8.0.20</NET8Version> | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
| 	</PropertyGroup> | ||||
|  | ||||
| 	<ItemGroup> | ||||
| 		<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||||
| 		<PackageReference Include="Newtonsoft.Json" Version="13.0.4" /> | ||||
| 		<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes" Version="1.5.376.244" /> | ||||
| 	</ItemGroup> | ||||
|  | ||||
|   | ||||
| @@ -39,7 +39,7 @@ public class RealDBProducerProperty : BusinessPropertyWithCacheInterval | ||||
|     /// <summary> | ||||
|     /// 历史表脚本 | ||||
|     /// </summary> | ||||
|     [DynamicProperty(Remark = "必须为间隔上传,才生效")] | ||||
|     [DynamicProperty] | ||||
|     [AutoGenerateColumn(Visible = true, IsVisibleWhenEdit = false, IsVisibleWhenAdd = false)] | ||||
|     public string? BigTextScriptHistoryTable { get; set; } | ||||
| } | ||||
|   | ||||
| @@ -85,7 +85,6 @@ public partial class QuestDBProducer : BusinessBaseWithCacheIntervalVariable | ||||
|     { | ||||
|         _db.DbMaintenance.CreateDatabase(); | ||||
|  | ||||
|         //必须为间隔上传 | ||||
|         if (!_driverPropertys.BigTextScriptHistoryTable.IsNullOrEmpty()) | ||||
|         { | ||||
|             DynamicSQLBase? hisModel = CSharpScriptEngineExtension.Do<DynamicSQLBase>(_driverPropertys.BigTextScriptHistoryTable); | ||||
|   | ||||
| @@ -112,7 +112,6 @@ public partial class SqlDBProducer : BusinessBaseWithCacheIntervalVariable | ||||
|     { | ||||
|         _db.DbMaintenance.CreateDatabase(); | ||||
|  | ||||
|         //必须为间隔上传 | ||||
|         if (!_driverPropertys.BigTextScriptHistoryTable.IsNullOrEmpty()) | ||||
|         { | ||||
|             var hisModel = CSharpScriptEngineExtension.Do<DynamicSQLBase>(_driverPropertys.BigTextScriptHistoryTable); | ||||
|   | ||||
| @@ -69,13 +69,13 @@ public class SqlDBProducerProperty : BusinessPropertyWithCacheInterval | ||||
|     /// <summary> | ||||
|     /// 实时表脚本 | ||||
|     /// </summary> | ||||
|     [DynamicProperty(Remark = "必须为间隔上传,才生效")] | ||||
|     [DynamicProperty] | ||||
|     [AutoGenerateColumn(Visible = true, IsVisibleWhenEdit = false, IsVisibleWhenAdd = false)] | ||||
|     public string? BigTextScriptRealTable { get; set; } | ||||
|     /// <summary> | ||||
|     /// 历史表脚本 | ||||
|     /// </summary> | ||||
|     [DynamicProperty(Remark = "必须为间隔上传,才生效")] | ||||
|     [DynamicProperty] | ||||
|     [AutoGenerateColumn(Visible = true, IsVisibleWhenEdit = false, IsVisibleWhenAdd = false)] | ||||
|     public string? BigTextScriptHistoryTable { get; set; } | ||||
| } | ||||
|   | ||||
| @@ -102,7 +102,6 @@ public partial class TDengineDBProducer : BusinessBaseWithCacheIntervalVariable | ||||
|     { | ||||
|         _db.DbMaintenance.CreateDatabase(); | ||||
|  | ||||
|         //必须为间隔上传 | ||||
|         if (!_driverPropertys.BigTextScriptHistoryTable.IsNullOrEmpty()) | ||||
|         { | ||||
|             var hisModel = CSharpScriptEngineExtension.Do<DynamicSQLBase>(_driverPropertys.BigTextScriptHistoryTable); | ||||
|   | ||||
| @@ -1,7 +1,4 @@ | ||||
| { | ||||
|   "Debug": "true", | ||||
|   "LogPath": "Logs/XLog", | ||||
|   "LogFileMaxBytes": "5", //5mb最大日志文件 | ||||
|   "LogFileBackups": "50", //50个日志文件 | ||||
|   "LogFileFormat": "{0:yyyy_MM_dd}.log" | ||||
|   "LogFileBackups": "50" //50个日志文件 | ||||
| } | ||||
| @@ -36,6 +36,7 @@ public class Program | ||||
|         ClaimConst.Scheme = $"{typeof(Program).Assembly.GetName().Name}{SchemeHelper.GetOrCreate()}"; | ||||
|  | ||||
|         Runtime.CreateConfigOnMissing = true; | ||||
|  | ||||
|         #region 控制台输出Logo | ||||
|  | ||||
|         Console.Write(Environment.NewLine); | ||||
| @@ -72,8 +73,17 @@ public class Program | ||||
|  | ||||
|                 if (Runtime.IsLegacyWindows) | ||||
|                     builder.Logging.ClearProviders(); //去除默认的事件日志提供者,某些情况下会日志输出异常,导致程序崩溃 | ||||
|  | ||||
|  | ||||
|             }).ConfigureBuilder(builder => | ||||
|                { | ||||
|  | ||||
|                    if (Runtime.IsSystemd) | ||||
|                    { | ||||
|                        builder.Logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Warning); | ||||
|                    } | ||||
|  | ||||
|  | ||||
|                    if (!builder.Environment.IsDevelopment()) | ||||
|                    { | ||||
|                        builder.Services.AddResponseCompression( | ||||
| @@ -108,6 +118,8 @@ public class Program | ||||
|  | ||||
| #endif | ||||
|  | ||||
|  | ||||
|  | ||||
|                     ReflectionInoHelper.RemoveAllCache(); | ||||
|                     InstanceFactory.RemoveCache(); | ||||
|                 }) | ||||
| @@ -136,6 +148,12 @@ public class Program | ||||
|  | ||||
|             }).ConfigureBuilder(builder => | ||||
|             { | ||||
|  | ||||
|                 if (Runtime.IsSystemd) | ||||
|                 { | ||||
|                     builder.ConfigureLogging(a => a.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Warning)); | ||||
|                 } | ||||
|  | ||||
|                 // 设置接口超时时间和上传大小-Kestrel | ||||
|                 builder.ConfigureKestrel(u => | ||||
|                 { | ||||
| @@ -144,11 +162,7 @@ public class Program | ||||
|                     u.Limits.MaxRequestBodySize = null; | ||||
|                 }).UseKestrel().Configure(app => | ||||
|                 { | ||||
|                     // ✅ 最小中间件 | ||||
|                     app.Run(context => | ||||
|                     { | ||||
|                         return context.Response.WriteAsync("web is disable"); | ||||
|                     }); | ||||
|                     app.Run(context => context.Response.WriteAsync("web is disable")); | ||||
|                 }); | ||||
|             }) | ||||
|                 .Configure(app => | ||||
|   | ||||
| @@ -73,7 +73,6 @@ public class Startup : AppStartup | ||||
|  | ||||
|             services.AddRazorPages(); | ||||
|  | ||||
|  | ||||
|             services.AddMvcFilter<RequestAuditFilter>(); | ||||
|  | ||||
|             services.AddControllers() | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
|  | ||||
| #docker run -d --name tg  --restart always -p 127.0.0.1:5000:5000 -e ASPNETCORE_ENVIRONMENT=Demo -v /thingsgateway/Keys:/app/Keys -v /thingsgateway/DB:/app/DB  --memory="512m" registry.cn-shenzhen.aliyuncs.com/thingsgateway/thingsgateway:latest | ||||
| #docker run -d --log-driver json-file --log-opt max-size=50m --log-opt max-file=5 --name tg --restart always -p 127.0.0.1:5000:5000 -p 502:502 -e ASPNETCORE_ENVIRONMENT=Demo -v /thingsgateway/Keys:/app/Keys -v /thingsgateway/DB:/app/DB --memory="512m" registry.cn-shenzhen.aliyuncs.com/thingsgateway/thingsgateway:latest | ||||
|  | ||||
| version: "latest"    # Docker Compose 配置版本 | ||||
|  | ||||
|   | ||||
| @@ -25,6 +25,14 @@ Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false | ||||
| [Install] | ||||
| WantedBy=multi-user.target | ||||
|  | ||||
| # 文件配置 | ||||
| # [Journal] | ||||
| # SystemMaxUse=200M      # 日志最大占用200MB磁盘空间 | ||||
| # SystemMaxFileSize=50M  # 单个日志文件最大50MB | ||||
| # MaxRetentionSec=1month # 日志只保留1个月 | ||||
| # RuntimeMaxUse=100M     # 内存中最多缓存100MB日志 | ||||
|  | ||||
|  | ||||
|  | ||||
| # 加载服务配置文件 | ||||
| # systemctl daemon-reload | ||||
|   | ||||
		Reference in New Issue
	
	Block a user