diff --git a/src/ServiceControl.Config/Commands/UpgradeAuditInstanceCommand.cs b/src/ServiceControl.Config/Commands/UpgradeAuditInstanceCommand.cs index b622c08ae8..d67ce0d696 100644 --- a/src/ServiceControl.Config/Commands/UpgradeAuditInstanceCommand.cs +++ b/src/ServiceControl.Config/Commands/UpgradeAuditInstanceCommand.cs @@ -1,6 +1,7 @@ namespace ServiceControl.Config.Commands { using System; + using System.Diagnostics; using System.ServiceProcess; using System.Threading.Tasks; using Caliburn.Micro; @@ -50,14 +51,25 @@ public override async Task ExecuteAsync(InstanceDetailsViewModel model) var instance = InstanceFinder.FindInstanceByName(model.Name); instance.Service.Refresh(); - if (instance.PersistenceManifest.Name == "RavenDB35") + var compatibleStorageEngine = instance.PersistenceManifest.Name == StorageEngineNames.RavenDB5; + + if (!compatibleStorageEngine) { - var docsUrl = "https://docs.particular.net/servicecontrol/upgrades/zero-downtime"; + var upgradeGuide4to5url = "https://docs.particular.net/servicecontrol/upgrades/4to5/"; - await windowManager.ShowMessage("UPGRADE NOTE", -$@"Please note that the storage format has changed and that upgrading existing instances using RavenDB 3.5 will only be supported for a limited period of time. + var openUpgradeGuide = await windowManager.ShowYesNoDialog("STORAGE ENGINE INCOMPATIBLE", + $"Please note that the storage format has changed and the {instance.PersistenceManifest.DisplayName} storage engine is no longer available. Upgrading requires a side-by-side deployment of both versions. Migration guidance is available in the version 4 to 5 upgrade guidance at {upgradeGuide4to5url}", + "Open online ServiceControl 4 to 5 upgrade guide in system default browser?", + "Yes", + "No" + ); -See our zero downtime upgrade guidance, {docsUrl}, for instructions how migrate to the new storage format by adding a new audit instance.", hideCancel: true); + if (openUpgradeGuide) + { + Process.Start(new ProcessStartInfo(upgradeGuide4to5url) { UseShellExecute = true }); + } + + return; } var upgradeInfo = UpgradeControl.GetUpgradeInfoForTargetVersion(serviceControlInstaller.ZipInfo.Version, instance.Version); diff --git a/src/ServiceControl.Config/Commands/UpgradeServiceControlInstanceCommand.cs b/src/ServiceControl.Config/Commands/UpgradeServiceControlInstanceCommand.cs index 3957842a00..c3ffe299e1 100644 --- a/src/ServiceControl.Config/Commands/UpgradeServiceControlInstanceCommand.cs +++ b/src/ServiceControl.Config/Commands/UpgradeServiceControlInstanceCommand.cs @@ -1,6 +1,7 @@ namespace ServiceControl.Config.Commands { using System; + using System.Diagnostics; using System.ServiceProcess; using System.Threading.Tasks; using Caliburn.Micro; @@ -60,6 +61,27 @@ public override async Task ExecuteAsync(InstanceDetailsViewModel model) instance.Service.Refresh(); + var compatibleStorageEngine = instance.PersistenceManifest.Name == StorageEngineNames.RavenDB5; + + if (!compatibleStorageEngine) + { + var upgradeGuide4to5url = "https://docs.particular.net/servicecontrol/upgrades/4to5/"; + + var openUpgradeGuide = await windowManager.ShowYesNoDialog("STORAGE ENGINE INCOMPATIBLE", + $"Please note that the storage format has changed and the {instance.PersistenceManifest.DisplayName} storage engine is no longer available. Upgrading requires a side-by-side deployment of both versions. Migration guidance is available in the version 4 to 5 upgrade guidance at {upgradeGuide4to5url}", + "Open online ServiceControl 4 to 5 upgrade guide in system default browser?", + "Yes", + "No" + ); + + if (openUpgradeGuide) + { + Process.Start(new ProcessStartInfo(upgradeGuide4to5url) { UseShellExecute = true }); + } + + return; + } + var upgradeInfo = UpgradeControl.GetUpgradeInfoForTargetVersion(serviceControlInstaller.ZipInfo.Version, instance.Version); var upgradeOptions = new ServiceControlUpgradeOptions { UpgradeInfo = upgradeInfo }; diff --git a/src/ServiceControl.Management.PowerShell/Cmdlets/AuditInstances/InvokeAuditUpgrade.cs b/src/ServiceControl.Management.PowerShell/Cmdlets/AuditInstances/InvokeAuditUpgrade.cs index 34a1732d5e..9d5f28df8d 100644 --- a/src/ServiceControl.Management.PowerShell/Cmdlets/AuditInstances/InvokeAuditUpgrade.cs +++ b/src/ServiceControl.Management.PowerShell/Cmdlets/AuditInstances/InvokeAuditUpgrade.cs @@ -36,10 +36,9 @@ protected override void ProcessRecord() foreach (var name in Name) { - var instance = InstanceFinder.FindServiceControlInstance(name); - if (instance == null) + if (InstanceFinder.FindServiceControlInstance(name) is not ServiceControlAuditInstance instance) { - WriteWarning($"No action taken. An instance called {name} was not found"); + WriteWarning($"No action taken. An audit instance called {name} was not found"); break; } diff --git a/src/ServiceControlInstaller.Engine/Instances/ServiceControlAuditNewInstance.cs b/src/ServiceControlInstaller.Engine/Instances/ServiceControlAuditNewInstance.cs index 8bb092a5a9..0e982cda19 100644 --- a/src/ServiceControlInstaller.Engine/Instances/ServiceControlAuditNewInstance.cs +++ b/src/ServiceControlInstaller.Engine/Instances/ServiceControlAuditNewInstance.cs @@ -21,7 +21,7 @@ public static ServiceControlAuditNewInstance CreateWithDefaultPersistence() public static ServiceControlAuditNewInstance CreateWithDefaultPersistence(string deploymentCachePath) { - const string persisterToUseForBrandNewInstances = "RavenDB5"; + const string persisterToUseForBrandNewInstances = StorageEngineNames.RavenDB5; return CreateWithPersistence(deploymentCachePath, persisterToUseForBrandNewInstances); } diff --git a/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs b/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs index f8f9d11acc..d41e7b0ad8 100644 --- a/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs +++ b/src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs @@ -22,7 +22,7 @@ public static ServiceControlNewInstance CreateWithDefaultPersistence() public static ServiceControlNewInstance CreateWithDefaultPersistence(string deploymentCachePath) { - const string persisterUsedForBrandNewInstances = "RavenDB5"; + const string persisterUsedForBrandNewInstances = StorageEngineNames.RavenDB5; return CreateWithPersistence(deploymentCachePath, persisterUsedForBrandNewInstances); } diff --git a/src/ServiceControlInstaller.Engine/Instances/StorageEngineNames.cs b/src/ServiceControlInstaller.Engine/Instances/StorageEngineNames.cs new file mode 100644 index 0000000000..6d785a5799 --- /dev/null +++ b/src/ServiceControlInstaller.Engine/Instances/StorageEngineNames.cs @@ -0,0 +1,7 @@ +namespace ServiceControlInstaller.Engine.Instances +{ + public static class StorageEngineNames + { + public const string RavenDB5 = "RavenDB5"; + } +} \ No newline at end of file diff --git a/src/ServiceControlInstaller.Engine/Unattended/UnattendAuditInstaller.cs b/src/ServiceControlInstaller.Engine/Unattended/UnattendAuditInstaller.cs index 3d7a45941c..9bd5ff5da1 100644 --- a/src/ServiceControlInstaller.Engine/Unattended/UnattendAuditInstaller.cs +++ b/src/ServiceControlInstaller.Engine/Unattended/UnattendAuditInstaller.cs @@ -104,8 +104,17 @@ public async Task Add(ServiceControlAuditNewInstance details, Func Add(ServiceControlNewInstance details, Func