feat:config move to consul and framework upgrade to 8.0.1
This commit is contained in:
parent
36ff1c955c
commit
e44f4593af
@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<!-- All Fake packages -->
|
||||
<FakePackageVersion>8.0.0</FakePackageVersion>
|
||||
<FakePackageVersion>8.0.1</FakePackageVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@ -2,6 +2,7 @@ using Serilog;
|
||||
using TrackCenter.Api;
|
||||
|
||||
var builder = WebApplication.CreateSlimBuilder(args);
|
||||
builder.Configuration.AddConsul("idwms/trackapi", source => source.ReloadOnChange = true);
|
||||
var configuration = builder.Configuration;
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.ReadFrom.Configuration(configuration)
|
||||
@ -13,7 +14,6 @@ try
|
||||
builder.Host.UseAutofac().UseSerilog();
|
||||
builder.Services.AddApplication<TrackCenterApiModule>();
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
app.InitializeApplication();
|
||||
app.Run();
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<ProjectReference Include="..\TrackCenter.Application\TrackCenter.Application.csproj" />
|
||||
<ProjectReference Include="..\TrackCenter.Repository\TrackCenter.Repository.csproj" />
|
||||
<PackageReference Include="Fake.Autofac" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Fake.Consul" Version="$(FakePackageVersion)" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="10.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
|
||||
@ -1,200 +1,8 @@
|
||||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Debug",
|
||||
"Override": {
|
||||
"Microsoft.AspNetCore": "Debug"
|
||||
}
|
||||
},
|
||||
"Properties": {
|
||||
"ServiceName": "track-api"
|
||||
},
|
||||
"Enrich": [
|
||||
"FromLogContext",
|
||||
"WithMachineName",
|
||||
"WithProcessId",
|
||||
"WithThreadId"
|
||||
],
|
||||
"WriteTo": [
|
||||
{
|
||||
"Name": "Console",
|
||||
"Args": {
|
||||
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {SourceContext} - {Message:lj}{NewLine}{Exception}",
|
||||
"formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"App": {
|
||||
"Urls": [
|
||||
"http://*:8889"
|
||||
],
|
||||
"CorsOrigins": [
|
||||
"http://localhost:8889"
|
||||
]
|
||||
},
|
||||
"itfx": {
|
||||
"BaseAddress": "http://43.139.210.35:8888/"
|
||||
},
|
||||
"TrackApp": {
|
||||
"TrackRefreshFetchCount": 4,
|
||||
"OrderPullStatusScanInterval": 60,
|
||||
"TrackButtomUpScanInterval":600,
|
||||
"WarningNotifyUrl": "http://xxxx",
|
||||
"ItfxBaseAddress": "http://43.139.210.35:8888/"
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"Default": "server=129.204.22.146;database=track_center;uid=dev;pwd=itd!@#123;charset=utf8mb4;"
|
||||
},
|
||||
"FeiShuNotice": {
|
||||
"TitlePrefix": "track-dev",
|
||||
"Webhook": "https://open.feishu.cn/open-apis/bot/v2/hook/94e24bce-619d-4b3b-936c-e206353ce802",
|
||||
"Timeout": 20
|
||||
},
|
||||
"Redis": {
|
||||
"Host": "129.204.22.146:6379",
|
||||
"Password": "itd!@#123",
|
||||
"MaxPoolSize": 1000,
|
||||
"Database": 1,
|
||||
"Prefix": ""
|
||||
},
|
||||
"RabbitMQ": {
|
||||
"Connections": {
|
||||
"Default": {
|
||||
"HostName": "129.204.22.146",
|
||||
"Port": 5672,
|
||||
"UserName": "rabbit",
|
||||
"Password": "itd!@#123",
|
||||
"DispatchConsumersAsync": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticSearch": {
|
||||
"NodeUrls": [ "http://129.204.22.146:9200" ],
|
||||
"LoginName": "elastic",
|
||||
"Password": "itd!@#123",
|
||||
"ShowLogInfo": false,
|
||||
"IndexPrefix": ""
|
||||
},
|
||||
"Kafka": {
|
||||
"BootstrapServers": "81.71.47.150:9092",
|
||||
"Consumer": {
|
||||
// 会话超时时间ms,超时时间未收到客户端心跳,则会移除该客户端同时触发自平衡
|
||||
"SessionTimeoutMs": 45000,
|
||||
// 超过这个时间消息没有消费,则认为消费失败同时组也认为消费失败,触发自平衡给其他消费者
|
||||
"MaxPollIntervalMs": 300000,
|
||||
// 心跳间隔ms
|
||||
"HeartbeatIntervalMs": 3000,
|
||||
// 提取消息的最小字节数1024*64,
|
||||
"FetchMinBytes": 65536,
|
||||
// 提取消息的最大字节数
|
||||
"FetchMaxBytes": 1048576,
|
||||
// 等待填充Fetch的最大ms
|
||||
"FetchWaitMaxMs": 3000
|
||||
},
|
||||
"Producer": {
|
||||
// 发送重试次数
|
||||
"MessageSendMaxRetries": 3,
|
||||
// 请求超时ms
|
||||
"RequestTimeoutMs": 30000,
|
||||
// 压缩类型 None/Gzip/Snappy/Lz4/Zstd
|
||||
"CompressionType": "Lz4",
|
||||
// Gzip 0-9 LZ4 0-12 数值越大压缩效果越好cpu占用越多
|
||||
"CompressionLevel": 6,
|
||||
// 最多允许累计多少ms消息积压
|
||||
"LingerMs": 3000,
|
||||
// 批处理最大尺寸 1024 * 256 字节
|
||||
"BatchSize": 262144,
|
||||
// 批处理最大消息数
|
||||
"BatchNumMessages": 2000,
|
||||
// 生产者队列最大消息数量
|
||||
"QueueBufferingMaxMessages": 100000,
|
||||
// 生产者队列最大尺寸
|
||||
"QueueBufferingMaxKbytes": 1048576,
|
||||
// 分区器 Random/Consistent/ConsistentRandom/Murmur2/Murmur2Random
|
||||
"Partitioner": "ConsistentRandom"
|
||||
}
|
||||
},
|
||||
"CAP": {
|
||||
"FailedRetryCount": 3,
|
||||
"FailedRetryInterval": 60,
|
||||
"FallbackWindowLookbackSeconds": 2400,
|
||||
"PrefetchCount": 1,
|
||||
"SucceedMessageExpiredAfter": 21600,
|
||||
"EnableSubscriberParallelExecute": true,
|
||||
"EnablePublishParallelSend" : false
|
||||
},
|
||||
// 预警任务配置,优先级0最高,可选0,1,2
|
||||
"WarningTask": {
|
||||
// 业务中台系统id
|
||||
"MiddleSystemId": 9498,
|
||||
// 预警计算批量大小
|
||||
"WarningCalcBatchSize": 1000,
|
||||
// 预警计算间隔ms
|
||||
"WarningCalcInterval": 60000,
|
||||
// 预警计算最大重试次数
|
||||
"WarningCalcMaxRetryCount": 3,
|
||||
// 通知任务优先级
|
||||
"ScanWarningNotifyTaskLevel": 1,
|
||||
// 预警通知任务扫描间隔(小时)
|
||||
"ScanWarningNotifyTaskHourInterval": 4,
|
||||
// 回传预警最大重试次数
|
||||
"ReturnWarningMaxRetryCount": 3,
|
||||
// 回传重试推送任务优先级
|
||||
"ScanReturnWarningRetryPushTaskLevel": 0,
|
||||
// 回传重试推送任务扫描间隔(分钟)
|
||||
"ScanReturnWarningRetryPushTaskMinuteInterval": 3,
|
||||
// 预警明细生成任务优先级
|
||||
"ScanTransportWarningDetailsGenerateTaskLevel": 0,
|
||||
// 预警明细生成任务扫描间隔(分钟)
|
||||
"ScanTransportWarningDetailsGenerateTaskMinuteInterval": 5
|
||||
},
|
||||
"InterfaceRelayParamsConfig": {
|
||||
"OrderPath": "",
|
||||
"OrderNoName": "trackNo",
|
||||
"TrackDetailsPath": "data",
|
||||
"TrackContentCodeName": "code",
|
||||
"TrackStatusName": "status",
|
||||
"TrackContentName": "content",
|
||||
"TrackPlaceName": "location",
|
||||
"TrackUtcTimeName": "timeUtc",
|
||||
"TrackIsoTimeName": "timeIso",
|
||||
"TrackTimeName": "time",
|
||||
"TrackTimeZoneName": "timezone",
|
||||
"TrackExtraNames": "extra",
|
||||
"GetTrackInterfaceCode": "getTrack",
|
||||
"PushTrackInterfaceCode": "pushTrack",
|
||||
"TrackUpdateInterfaceCode": "updateTrack",
|
||||
"OrderPodPullInterfaceCode": "A059"
|
||||
},
|
||||
"OTel": {
|
||||
"ExporterUrl": "",
|
||||
"ExporterTimeoutSeconds":10, //导出超时时间(秒) 默认 10秒
|
||||
"ServiceName": "TrackCenter.Api.Test",//服务名称
|
||||
"ServiceVersion": "1.0.0",//服务版本
|
||||
"SamplerType":"AlwaysOn",// 采样类型 默认 AlwaysOn
|
||||
//枚举
|
||||
//0 AlwaysOn 总是采样
|
||||
//1 AlwaysOff 从不采样
|
||||
//2 TraceIdRatio 概率采样 与SamplerProbability 字段结合使用
|
||||
//3 ParentBasedSampler 与ChildBasedSampler 结合使用
|
||||
"SamplerProbability":0.5,// 采样率 10%上报采样
|
||||
"EnableStaticWeav":true,//启动静态编织 默认 true
|
||||
"EnableAspNetCore": true,//启动AspNetCore 默认 true
|
||||
"EnableHttpClient": true,//启用HTTP请求 默认 true
|
||||
"EnableSql": true,//启动SQL 默认 true
|
||||
"EnableSqlParameters": true //启动SQL参数,默认 false
|
||||
},
|
||||
"JwtSettings": {
|
||||
"SecretKey": "YourSuperSecretKeyThatIsAtLeast32CharactersLong!",
|
||||
"Issuer": "SimpleAdmin",
|
||||
"Audience": "SimpleAdminClient",
|
||||
"ExpiryInMinutes": 60,
|
||||
"RefreshExpiryInDays": 7
|
||||
},
|
||||
"SignatureValidation": {
|
||||
"Enabled": true, // 是否启用签名验证
|
||||
"MaxTimestampOffset": 300 // 时间戳允许的最大偏差(秒),默认300秒(5分钟)
|
||||
"UseLocalConfigs": false,
|
||||
"Consul": {
|
||||
"Address": "http://81.71.47.150:8500",
|
||||
"Datacenter": "dc1",
|
||||
"Token": "97217125-df0b-5c0a-dbfc-8885def5e471"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user