From 13d0489ed2259d9d5647b150237d7dfcf3ccfa3e Mon Sep 17 00:00:00 2001 From: Jordan Dominion Date: Thu, 27 Jul 2023 00:48:52 -0400 Subject: [PATCH] Fix migrator references to V5 and update version --- build/Version.props | 2 +- .../Program.cs | 20 ++++---- tools/Tgstation.Server.Migrator/Program.cs | 46 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/build/Version.props b/build/Version.props index d1fc8f38c3..44127192af 100644 --- a/build/Version.props +++ b/build/Version.props @@ -13,7 +13,7 @@ 5.6.1 1.4.0 1.2.1 - 1.0.2 + 2.0.0 netstandard2.0 8 diff --git a/tools/Tgstation.Server.Migrator.Comms/Program.cs b/tools/Tgstation.Server.Migrator.Comms/Program.cs index 2e069acb46..e83f874734 100644 --- a/tools/Tgstation.Server.Migrator.Comms/Program.cs +++ b/tools/Tgstation.Server.Migrator.Comms/Program.cs @@ -64,7 +64,7 @@ static class Program Console.WriteLine("Connected!"); - Console.WriteLine("Connecting to TGS5..."); + Console.WriteLine("Connecting to TGS6..."); var assemblyName = Assembly.GetExecutingAssembly().GetName(); var productInfoHeaderValue = new ProductInfoHeaderValue( @@ -73,7 +73,7 @@ static class Program var serverUrl = new Uri($"http://localhost:{apiPort}"); var clientFactory = new ServerClientFactory(productInfoHeaderValue.Product); - var tgs5Client = await clientFactory.CreateFromLogin( + var TGS6Client = await clientFactory.CreateFromLogin( serverUrl, DefaultCredentials.AdminUserName, DefaultCredentials.DefaultAdminUserPassword); @@ -217,7 +217,7 @@ static class Program Console.WriteLine("Detaching TGS3 instance..."); tgs3Client.Server.InstanceManager.DetachInstance(instanceName); - Console.WriteLine("Creating TGS5 attach file..."); + Console.WriteLine("Creating TGS6 attach file..."); File.WriteAllText(Path.Combine(instancePath, "TGS4_ALLOW_INSTANCE_ATTACH"), String.Empty); Console.WriteLine("Checking BYOND install..."); @@ -309,22 +309,22 @@ static class Program Console.WriteLine("Deleting TGDreamDaemonBridge.dll..."); File.Delete(Path.Combine(instancePath, "TGDreamDaemonBridge.dll")); - Console.WriteLine("Attaching TGS5 instance..."); - var tgs5Instance = await tgs5Client.Instances.CreateOrAttach(new InstanceCreateRequest + Console.WriteLine("Attaching TGS6 instance..."); + var TGS6Instance = await TGS6Client.Instances.CreateOrAttach(new InstanceCreateRequest { ConfigurationType = ConfigurationType.Disallowed, Name = instanceName, Path = instancePath, }, default); - Console.WriteLine($"Onlining TGS5 instance ID {tgs5Instance.Id}..."); - tgs5Instance = await tgs5Client.Instances.Update(new InstanceUpdateRequest + Console.WriteLine($"Onlining TGS6 instance ID {TGS6Instance.Id}..."); + TGS6Instance = await TGS6Client.Instances.Update(new InstanceUpdateRequest { Online = true, - Id = tgs5Instance.Id + Id = TGS6Instance.Id }, default); - var v5InstanceClient = tgs5Client.Instances.CreateClient(tgs5Instance); + var v5InstanceClient = TGS6Client.Instances.CreateClient(TGS6Instance); if (byondVersionRequest != null) { @@ -350,7 +350,7 @@ static class Program await v5InstanceClient.ChatBots.Create(chatBotCreateRequest, default); } - Console.WriteLine($"Instance {instanceName} (TGS5 ID: {tgs5Instance.Id}) successfully migrated!"); + Console.WriteLine($"Instance {instanceName} (TGS6 ID: {TGS6Instance.Id}) successfully migrated!"); } Console.WriteLine("All enabled V3 instances migrated into V5 and detached from V3!"); diff --git a/tools/Tgstation.Server.Migrator/Program.cs b/tools/Tgstation.Server.Migrator/Program.cs index 69783b68f3..651c5e1852 100644 --- a/tools/Tgstation.Server.Migrator/Program.cs +++ b/tools/Tgstation.Server.Migrator/Program.cs @@ -44,7 +44,7 @@ try var commandLineArguments = commandLine.Skip(1); var skipPreamble = commandLineArguments.Any(x => x.Equals("--skip-preamble", StringComparison.OrdinalIgnoreCase)); - Console.WriteLine("This is a very straightfoward script to migrate the instances of a TGS3 install into a new TGS5 install"); + Console.WriteLine("This is a very straightfoward script to migrate the instances of a TGS3 install into a new TGS6 install"); static bool PromptYesOrNo(string question) { @@ -194,7 +194,7 @@ try Console.WriteLine("- DISABLED INSTANCES WILL NOT BE MIGRATED! PLEASE ENABLE ALL INSTANCES YOU WISH TO MIGRATE BEFORE CONTINUING!"); Console.WriteLine("- INSTANCE AUTO UPDATE CAN INTERFERE WITH THE MIGRATION! PLEASE DISABLE IT ON ALL INSTANCES BEING MIGRATED BEFORE CONTINUING!"); Console.WriteLine("- DO NOT ATTEMPT TO USE TGS3 VIA NORMAL METHODS WHILE THIS MIGRATION IS TAKING PLACE OR YOU COULD CORRUPT YOUR DATA!"); - Console.WriteLine("Side note: You can skip the TGS5 setup wizard step by copying your premade appsettings.Production.yml file next to this .exe NOW."); + Console.WriteLine("Side note: You can skip the TGS6 setup wizard step by copying your premade appsettings.Production.yml file next to this .exe NOW."); if (!PromptYesOrNo("Proceed with upgrade?")) { Console.WriteLine("Prerequisite not met."); @@ -338,7 +338,7 @@ try } - // TGS5 ONLINE LOCATING + // TGS6 ONLINE LOCATING Console.WriteLine("Now we're going to locate the latest version of the TGS service."); Console.WriteLine("(This migrator does not support the console runner, but you may switch the installation to it after completion)"); @@ -376,14 +376,14 @@ try ExitPause(4); } - // TGS5 SETUP WIZARD + // TGS6 SETUP WIZARD Console.WriteLine("We are now going to run the TGS setup wizard to generate your new server configuration file."); var serverFactory = Tgstation.Server.Host.Core.Application.CreateDefaultServerFactory(); _ = await serverFactory.CreateServer(new[] { $"General:SetupWizardMode={SetupWizardMode.Only}" }, null, default); // This is where the wizard actually runs - // TGS5 DOWNLOAD AND UNZIP - Console.WriteLine("Downloading TGS5..."); + // TGS6 DOWNLOAD AND UNZIP + Console.WriteLine("Downloading TGS6..."); using (var loggerFactory = LoggerFactory.Create(builder => { })) { @@ -397,7 +397,7 @@ try await using (tgsFiveZipBuffer) { - Console.WriteLine("Unzipping TGS5..."); + Console.WriteLine("Unzipping TGS6..."); await serverFactory.IOManager.ZipToDirectory( tgsInstallPath, await tgsFiveZipBuffer.GetResult(default), @@ -405,7 +405,7 @@ try } } - // TGS5 CONFIG SETUP + // TGS6 CONFIG SETUP const string ConfigurationFileName = "appsettings.Production.yml"; Console.WriteLine("Extracting API port from configuration..."); ushort configuredApiPort; @@ -424,8 +424,8 @@ try Console.WriteLine("Moving configuration file from setup wizard to installation folder..."); File.Copy(ConfigurationFileName, Path.Combine(tgsInstallPath, ConfigurationFileName)); - // TGS5 SERVICE SETUP - Console.WriteLine("Installing TGS5 service..."); + // TGS6 SERVICE SETUP + Console.WriteLine("Installing TGS6 service..."); using (var processInstaller = new ServiceProcessInstaller()) using (var installer = new ServiceInstaller()) { @@ -448,42 +448,42 @@ try installer.Install(state); } - Console.WriteLine("Starting TGS5 service..."); + Console.WriteLine("Starting TGS6 service..."); var allServices = ServiceController.GetServices(); - using (var tgs5Service = allServices.FirstOrDefault(service => service.ServiceName == NewServiceName)) + using (var TGS6Service = allServices.FirstOrDefault(service => service.ServiceName == NewServiceName)) { - if (tgs5Service == null) + if (TGS6Service == null) { - Console.WriteLine("Unable to locate newly installed TGS5 service!"); + Console.WriteLine("Unable to locate newly installed TGS6 service!"); ExitPause(11); } foreach (var service in allServices) { - if (service == tgs5Service) + if (service == TGS6Service) continue; service.Dispose(); } - tgs5Service.Start(); - tgs5Service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMinutes(2)); + TGS6Service.Start(); + TGS6Service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMinutes(2)); } - // TGS5 CLIENT CONNECTION + // TGS6 CLIENT CONNECTION const int MaxWaitMinutes = 5; - Console.WriteLine($"Connecting to TGS5 (Max {MaxWaitMinutes} minute wait)..."); + Console.WriteLine($"Connecting to TGS6 (Max {MaxWaitMinutes} minute wait)..."); var giveUpAt = DateTimeOffset.UtcNow.AddMinutes(MaxWaitMinutes); var serverUrl = new Uri($"http://localhost:{configuredApiPort}"); var clientFactory = new ServerClientFactory(productInfoHeaderValue.Product); - IServerClient tgs5Client; + IServerClient TGS6Client; for (var I = 1; ; ++I) { try { Console.WriteLine($"Attempt {I}..."); - tgs5Client = await clientFactory.CreateFromLogin( + TGS6Client = await clientFactory.CreateFromLogin( serverUrl, DefaultCredentials.AdminUserName, DefaultCredentials.DefaultAdminUserPassword); @@ -505,7 +505,7 @@ try } } - Console.WriteLine("Successfully connected to TGS5!"); + Console.WriteLine("Successfully connected to TGS6!"); // COMMS MIGRATION Console.WriteLine("Deferring to Comms binary to migrate instances..."); @@ -533,7 +533,7 @@ try Console.WriteLine("Failed to disable TGS3 service! This isn't critical, however."); Console.WriteLine("Migration complete! Please continue uninstall TGS3 using Add/Remove Programs."); - Console.WriteLine("Then configure TGS5 using an interactive client to build and start your server."); + Console.WriteLine("Then configure TGS6 using an interactive client to build and start your server."); ExitPause(0); } catch (Exception ex)