ASC.Data.Storage.Migration: bugfix

This commit is contained in:
maksim 2020-08-24 09:52:17 +03:00
parent 280604e41d
commit eecf23f214
11 changed files with 31 additions and 33 deletions

View File

@ -62,7 +62,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup", "common\s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Core", "products\ASC.Files\Core\ASC.Files.Core.csproj", "{F0A39728-940D-4DBE-A37A-05D4EB57F342}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{43331B08-2E36-4C08-A1EF-0521211B681D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{02356BD7-7E99-457B-BEFF-090CE4DF067D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -182,10 +182,10 @@ Global
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.Build.0 = Release|Any CPU
{43331B08-2E36-4C08-A1EF-0521211B681D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43331B08-2E36-4C08-A1EF-0521211B681D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43331B08-2E36-4C08-A1EF-0521211B681D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43331B08-2E36-4C08-A1EF-0521211B681D}.Release|Any CPU.Build.0 = Release|Any CPU
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,2 @@
echo "RUN ASC.Migration"
call dotnet run --project ..\..\common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=migration

View File

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
<ProjectReference Include="..\..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
</ItemGroup>
</Project>

View File

@ -54,7 +54,7 @@ namespace ASC.Data.Storage.Migration
{
Notify.Subscribe((n) =>
{
var scope = ServiceProvider.CreateScope();
using var scope = ServiceProvider.CreateScope();
var service = scope.ServiceProvider.GetService<MigrationService>();
service.Migrate(n.TenantId, new StorageSettings { Module = n.StorSettings.Module, });
}, CacheNotifyAction.Insert);

View File

@ -3,7 +3,7 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55754/",
"applicationUrl": "http://localhost:5017/",
"sslPort": 0
}
},
@ -29,7 +29,7 @@
"log__dir": "../../../Logs",
"core__products__folder": "../../../products"
},
"applicationUrl": "http://localhost:55754/"
"applicationUrl": "http://localhost:5017/"
}
}
}

View File

@ -1,5 +1,5 @@
{
"kafka": {
"BootstrapServers": "localhost:9092"
"BootstrapServers": ""
}
}

View File

@ -150,8 +150,8 @@ namespace ASC.Api.Settings
private StudioSmsNotificationSettingsHelper StudioSmsNotificationSettingsHelper { get; }
private CoreSettings CoreSettings { get; }
private StorageSettingsHelper StorageSettingsHelper { get; }
private ServiceClient ServiceClient { get; }
public ILog Log { get; set; }
public ICacheNotify<MigrationCache> MigrationNotify { get; }
public SettingsController(
IOptionsMonitor<ILog> option,
@ -204,7 +204,7 @@ namespace ASC.Api.Settings
MobileDetector mobileDetector,
IOptionsSnapshot<AccountLinker> accountLinker,
FirstTimeTenantSettings firstTimeTenantSettings,
ICacheNotify<MigrationCache> migrationNotify)
ServiceClient serviceClient)
{
Log = option.Get("ASC.Api");
WebHostEnvironment = webHostEnvironment;
@ -256,7 +256,7 @@ namespace ASC.Api.Settings
StudioSmsNotificationSettingsHelper = studioSmsNotificationSettingsHelper;
CoreSettings = coreSettings;
StorageSettingsHelper = storageSettingsHelper;
MigrationNotify = migrationNotify;
ServiceClient = serviceClient;
}
[Read("", Check = false)]
@ -1623,8 +1623,7 @@ namespace ASC.Api.Settings
if (!CoreBaseSettings.Standalone) return -1;
var migrateClient = new ServiceClient(MigrationNotify);
return migrateClient.GetProgress(Tenant.TenantId);
return ServiceClient.GetProgress(Tenant.TenantId);
}
[Update("storage")]
@ -1707,8 +1706,7 @@ namespace ASC.Api.Settings
try
{
var migrateClient = new ServiceClient(MigrationNotify);
migrateClient.UploadCdn(Tenant.TenantId, "/", WebHostEnvironment.ContentRootPath, settings);
ServiceClient.UploadCdn(Tenant.TenantId, "/", WebHostEnvironment.ContentRootPath, settings);
}
catch (Exception e)
{
@ -1750,10 +1748,8 @@ namespace ASC.Api.Settings
//}
private void StartMigrate(StorageSettings settings)
{
var migrateClient = new ServiceClient(MigrationNotify);
migrateClient.Migrate(Tenant.TenantId, settings);
{
ServiceClient.Migrate(Tenant.TenantId, settings);
Tenant.SetStatus(TenantStatus.Migrating);
TenantManager.SaveTenant(Tenant);