diff --git a/Dev.Dockerfile b/Dev.Dockerfile index f2cceca..984b8b6 100644 --- a/Dev.Dockerfile +++ b/Dev.Dockerfile @@ -1,7 +1,7 @@ # FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base FROM registry.cn-qingdao.aliyuncs.com/jisheyun/aspnetcore:9.0.6_ub24_simsun_pdp_v341 AS base WORKDIR /app -EXPOSE 8080 +EXPOSE 10500 EXPOSE 443 ENV TZ=Asia/Shanghai ENV ASPNETCORE_ENVIRONMENT=Development diff --git a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj index 4027a34..87a3d6e 100644 --- a/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj +++ b/host/JiShe.IoT.HttpApi.Host/JiShe.IoT.HttpApi.Host.csproj @@ -75,6 +75,19 @@ + + + + + + Always + + + Always + + + Always + diff --git a/host/JiShe.IoT.HttpApi.Host/Program.cs b/host/JiShe.IoT.HttpApi.Host/Program.cs index 08711f4..778e170 100644 --- a/host/JiShe.IoT.HttpApi.Host/Program.cs +++ b/host/JiShe.IoT.HttpApi.Host/Program.cs @@ -1,3 +1,5 @@ +using Microsoft.Extensions.Configuration; + namespace JiShe.IoT; public class Program @@ -16,11 +18,21 @@ public class Program SerilogToEsExtensions.SetSerilogConfiguration( loggerConfiguration, context.Configuration); + }) + .ConfigureAppConfiguration((context, builder) => + { + var env = context.HostingEnvironment.EnvironmentName; + Log.Information("µ±Ç°»·¾³ £º" + env); + string[] filePathArray = new string[] { Environment.CurrentDirectory, "configs" }; + string jsonPath = Path.Combine(filePathArray); + + builder.AddJsonFile(Path.Combine(jsonPath, "appsettings.json"), false, true); + builder.AddJsonFile(Path.Combine(jsonPath, $"appsettings.{env}.json"), false, true); }); + await builder.AddApplicationAsync(); -#if DEBUG + builder.WebHost.ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 1024 * 50; }); builder.WebHost.UseUrls($"http://+:10500"); -#endif var app = builder.Build(); await app.InitializeApplicationAsync(); await app.RunAsync(); diff --git a/host/JiShe.IoT.HttpApi.Host/UploadFile/20250527/host/abp-file-management/3a1a2465-af54-6f30-0714-9c00c778dea3 b/host/JiShe.IoT.HttpApi.Host/UploadFile/20250527/host/abp-file-management/3a1a2465-af54-6f30-0714-9c00c778dea3 deleted file mode 100644 index 6283fd8..0000000 Binary files a/host/JiShe.IoT.HttpApi.Host/UploadFile/20250527/host/abp-file-management/3a1a2465-af54-6f30-0714-9c00c778dea3 and /dev/null differ diff --git a/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json similarity index 98% rename from host/JiShe.IoT.HttpApi.Host/appsettings.Development.json rename to host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json index 970fc92..4b54789 100644 --- a/host/JiShe.IoT.HttpApi.Host/appsettings.Development.json +++ b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Development.json @@ -98,8 +98,8 @@ "UseDistributedCache": true }, "FreeSqlProviderOptions": { - "UsePrepayDB": true, - "UseEnergyDB": true, + "UsePrepayDB": false, + "UseEnergyDB": false, "PrintLog": false }, "OneNETSecureReceiveOptions": { diff --git a/host/JiShe.IoT.HttpApi.Host/appsettings.Production.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.Production.json similarity index 100% rename from host/JiShe.IoT.HttpApi.Host/appsettings.Production.json rename to host/JiShe.IoT.HttpApi.Host/configs/appsettings.Production.json diff --git a/host/JiShe.IoT.HttpApi.Host/appsettings.json b/host/JiShe.IoT.HttpApi.Host/configs/appsettings.json similarity index 100% rename from host/JiShe.IoT.HttpApi.Host/appsettings.json rename to host/JiShe.IoT.HttpApi.Host/configs/appsettings.json diff --git a/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs b/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs index f67266e..3174626 100644 --- a/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs +++ b/src/JiShe.IoT.Domain/Data/IoTDbMigrationService.cs @@ -40,41 +40,41 @@ namespace JiShe.IoT.Data Logger.LogInformation("Started database migrations..."); - await MigrateDatabaseSchemaAsync(); - await SeedDataAsync(); + //await MigrateDatabaseSchemaAsync(); + //await SeedDataAsync(); await InitIoTDBTable(); - Logger.LogInformation($"Successfully completed host database migrations."); + //Logger.LogInformation($"Successfully completed host database migrations."); - var tenants = await _tenantRepository.GetListAsync(includeDetails: true); + //var tenants = await _tenantRepository.GetListAsync(includeDetails: true); - var migratedDatabaseSchemas = new HashSet(); - foreach (var tenant in tenants) - { - using (_currentTenant.Change(tenant.Id)) - { - if (tenant.ConnectionStrings.Any()) - { - var tenantConnectionStrings = tenant.ConnectionStrings - .Select(x => x.Value) - .ToList(); + //var migratedDatabaseSchemas = new HashSet(); + //foreach (var tenant in tenants) + //{ + // using (_currentTenant.Change(tenant.Id)) + // { + // if (tenant.ConnectionStrings.Any()) + // { + // var tenantConnectionStrings = tenant.ConnectionStrings + // .Select(x => x.Value) + // .ToList(); - if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings)) - { - await MigrateDatabaseSchemaAsync(tenant); + // if (!migratedDatabaseSchemas.IsSupersetOf(tenantConnectionStrings)) + // { + // await MigrateDatabaseSchemaAsync(tenant); - migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings); - } - } + // migratedDatabaseSchemas.AddIfNotContains(tenantConnectionStrings); + // } + // } - await SeedDataAsync(tenant); - } + // await SeedDataAsync(tenant); + // } - Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations."); - } + // Logger.LogInformation($"Successfully completed {tenant.Name} tenant database migrations."); + //} - Logger.LogInformation("Successfully completed all database migrations."); - Logger.LogInformation("You can safely end this process..."); + //Logger.LogInformation("Successfully completed all database migrations."); + //Logger.LogInformation("You can safely end this process..."); } private async Task MigrateDatabaseSchemaAsync(Tenant tenant = null)