mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-20 04:22:51 +01:00
Fix migrator references to V5 and update version
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@
|
||||
<TgsInteropVersion>5.6.1</TgsInteropVersion>
|
||||
<TgsHostWatchdogVersion>1.4.0</TgsHostWatchdogVersion>
|
||||
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
|
||||
<TgsMigratorVersion>1.0.2</TgsMigratorVersion>
|
||||
<TgsMigratorVersion>2.0.0</TgsMigratorVersion>
|
||||
<TgsNugetNetFramework>netstandard2.0</TgsNugetNetFramework>
|
||||
<TgsNetMajorVersion>8</TgsNetMajorVersion>
|
||||
<!-- Update this frequently with dotnet runtime patches. MAJOR MUST MATCH ABOVE! -->
|
||||
|
||||
@@ -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!");
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user