Add MariaDB to installer. Adjust SetupWizard to support it

Closes #1603
This commit is contained in:
Jordan Dominion
2023-07-20 02:38:54 -04:00
parent 26123c4dfd
commit 25651e37ba
9 changed files with 227 additions and 16 deletions
+3 -3
View File
@@ -14,10 +14,10 @@
<TgsHostWatchdogVersion>1.3.0</TgsHostWatchdogVersion>
<TgsContainerScriptVersion>1.2.1</TgsContainerScriptVersion>
<TgsMigratorVersion>1.0.2</TgsMigratorVersion>
<TgsNetMajorVersion>6</TgsNetMajorVersion>
<TgsNugetNetFramework>netstandard2.0</TgsNugetNetFramework>
<TgsNetMajorVersion>6</TgsNetMajorVersion>
<!-- Update this frequently with dotnet runtime patches. MAJOR MUST MATCH ABOVE! -->
<!-- You also need to update the .Bundle project's ExePackagePayload hash and file size after changing it -->
<TgsDotnetRedistUrl>https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/6.0.20/dotnet-hosting-6.0.20-win.exe</TgsDotnetRedistUrl>
<TgsDotnetRedistUrl>https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/6.0.20/dotnet-hosting-6.0.20-win.exe</TgsDotnetRedistUrl>
<TgsMariaDBRedistUrl>https://ftp.osuosl.org/pub/mariadb/mariadb-11.0.2/winx64-packages/mariadb-11.0.2-winx64.msi</TgsMariaDBRedistUrl>
</PropertyGroup>
</Project>
@@ -1,7 +1,7 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx">
<Bundle Name="tgstation-server" Manufacturer="/tg/station 13" Version="$(var.ProductVersion)" AboutUrl="https://github.com/tgstation/tgstation-server/blob/tgstation-server-v$(var.ProductVersion)/LICENSE" IconSourceFile="../../../tgs.ico" HelpUrl="https://github.com/tgstation/tgstation-server/discussions/categories/q-a" UpdateUrl="https://github.com/tgstation/tgstation-server/releases/latest" UpgradeCode="542535f4-49ad-45c4-9b96-6d8235ed8b87">
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication LicenseUrl="https://github.com/tgstation/tgstation/tree/tgstation-server-v$(var.ProductVersion)" Theme="hyperlinkLicense" LogoFile="../../../tgs.ico" ShowVersion="yes" SuppressOptionsUI="yes" />
<bal:WixStandardBootstrapperApplication LicenseUrl="https://github.com/tgstation/tgstation/tree/tgstation-server-v$(var.ProductVersion)" LocalizationFile="Theme.wxl" Theme="hyperlinkLicense" LogoFile="../../../tgs.ico" ShowVersion="yes" SuppressOptionsUI="yes" ThemeFile="Theme.xml" />
</BootstrapperApplication>
<netfx:DotNetCoreSearch RuntimeType="aspnet" Platform="x64" MajorVersion="$(var.NetMajorVersion)" Variable="AspNetCorex64Status" />
@@ -13,11 +13,11 @@
<WixVariable Id="AspNetCoreDetectCondition" Value="(NetCorex64Status AND AspNetCorex64Status) OR (NetCorex86Status AND AspNetCorex86Status)" />
<Chain>
<ExePackage PerMachine="yes" DetectCondition="!(wix.AspNetCoreDetectCondition)" Vital="yes" Permanent="yes" Protocol="burn" InstallArguments="/install /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" RepairArguments="/repair /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" UninstallArguments="/uninstall /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" Cache="remove" LogPathVariable="HOSTING_BUNDLE_LOG_PATH" RepairCondition="FALSE">
<ExePackagePayload Name="Microsoft.DotNet.HostingBundle.$(var.NetMajorVersion)" DownloadUrl="$(var.DotnetRedistUrl)" Hash="0B1D92A5161C9A2665085C90FC48567E0E9B92973B4221AB26C215D5520B3A83DC1014102C31CF99E67A875FE4F0069DC27A5B5B7CE08B0621230BB78FEEE88A" Size="71735488" Compressed="no" />
</ExePackage>
<MsiPackage InstallCondition="InstallMariaDBCheckbox=1" RepairCondition="FALSE" Visible="yes" Permanent="yes" DownloadUrl="$(var.MariaDBRedistUrl)" Compressed="no" SourceFile="mariadb.msi" bal:DisplayInternalUICondition="1" />
<ExePackage PerMachine="yes" DetectCondition="!(wix.AspNetCoreDetectCondition)" Permanent="yes" Protocol="burn" InstallArguments="/install /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" RepairArguments="/repair /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" UninstallArguments="/uninstall /quiet /norestart /log [HOSTING_BUNDLE_LOG_PATH]" Cache="remove" LogPathVariable="HOSTING_BUNDLE_LOG_PATH" RepairCondition="FALSE" DownloadUrl="$(var.DotnetRedistUrl)" SourceFile="hosting-bundle.exe" Compressed="no" />
<MsiPackage SourceFile="$(var.Tgstation.Server.Host.Service.Wix.TargetPath)">
<MsiProperty Name="WIX_BOOTSTRAPPER_UILEVEL" Value="[WixBundleUILevel]" />
<MsiProperty Name="MARIADB_INSTALLED" Value="TRUE" Condition="InstallMariaDBCheckbox=1" />
</MsiPackage>
</Chain>
@@ -1,7 +1,7 @@
<Project Sdk="WixToolset.Sdk/4.0.1" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Import Project="../../../Common.props" />
<PropertyGroup>
<DefineConstants>ProductVersion=$(TgsCoreVersion);NetMajorVersion=$(TgsNetMajorVersion);DotnetRedistUrl=$(TgsDotnetRedistUrl)</DefineConstants>
<DefineConstants>ProductVersion=$(TgsCoreVersion);NetMajorVersion=$(TgsNetMajorVersion);DotnetRedistUrl=$(TgsDotnetRedistUrl);MariaDBRedistUrl=$(TgsMariaDBRedistUrl)</DefineConstants>
<OutputType>Bundle</OutputType>
<Platforms>x86</Platforms>
<OutputName>tgstation-server-installer</OutputName>
@@ -19,6 +19,10 @@
<Message Importance="high" Text="SignBundle: @(SignBundle)" />
<Exec Command="powershell.exe NonInteractive ExecutionPolicy Unrestricted Command &quot;Set-AuthenticodeSignature %(SignBundle.FullPath) -Certificate (Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq \&quot;$(CertificateThumbprint)\&quot; }) -TimestampServer http://timestamp.digicert.com&quot;" />
</Target>
<ItemGroup>
<BindPath Include="../../../../artifacts" />
<Content Include="Theme.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.1" />
@@ -0,0 +1,70 @@
<!-- https://github.com/wixtoolset/wix/blob/e0641f1479c6f67f6ec119d448b66a74ad5d6b88/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.wxl -->
<WixLocalization Culture="en-us" Language="1033" xmlns="http://wixtoolset.org/schemas/v4/wxl">
<String Id="MariaDBCheckbox" Value="Install MariaDB for use as the TGS backing database. x64 only. Works well with SS13 servers."/>
<String Id="Title" Value="[WixBundleName] v[WixBundleVersion]" />
<String Id="Caption" Value="[WixBundleName] Setup" />
<String Id="CheckingForUpdatesLabel" Value="Checking for updates" />
<String Id="UpdateButton" Value="&amp;Update to version [WixStdBAUpdateAvailable]" />
<String Id="InstallHeader" Value="Welcome" />
<String Id="InstallMessage" Value="Setup will install [WixBundleName] on your computer. Click Install to continue or Cancel to exit." />
<String Id="InstallMessageOptions" Value="Setup will install [WixBundleName] on your computer. Click Install to continue, Options to set installation options, or Cancel to exit." />
<String Id="InstallVersion" Value="Version [WixBundleVersion]" />
<String Id="ConfirmCancelMessage" Value="Are you sure you want to cancel?" />
<String Id="ExecuteUpgradeRelatedBundleMessage" Value="Previous version" />
<String Id="HelpHeader" Value="Setup Help" />
<String Id="HelpText" Value="/install | /repair | /uninstall | /layout [directory] - installs, repairs, uninstalls or&#xA; creates a complete local copy of the bundle in directory. Install is the default.&#xA;&#xA;/passive | /quiet - displays minimal UI with no prompts or displays no UI and&#xA; no prompts. By default UI and all prompts are displayed.&#xA;&#xA;/norestart - suppress any attempts to restart. By default UI will prompt before restart.&#xA;/log log.txt - logs to a specific file. By default a log file is created in %TEMP%." />
<String Id="HelpCloseButton" Value="&amp;Close" />
<String Id="InstallLicenseLinkText" Value="[WixBundleName] &lt;a href=&quot;#&quot;&gt;license terms (AGPL-3.0)&lt;/a&gt;." />
<String Id="InstallAcceptCheckbox" Value="I &amp;agree to the license terms and conditions" />
<String Id="InstallOptionsButton" Value="&amp;Options" />
<String Id="InstallInstallButton" Value="&amp;Install" />
<String Id="InstallCancelButton" Value="&amp;Cancel" />
<String Id="OptionsHeader" Value="Setup Options" />
<String Id="OptionsLocationLabel" Value="Install location:" />
<String Id="OptionsBrowseButton" Value="&amp;Browse" />
<String Id="OptionsOkButton" Value="&amp;OK" />
<String Id="OptionsCancelButton" Value="&amp;Cancel" />
<String Id="ProgressHeader" Value="Setup Progress" />
<String Id="ProgressLabel" Value="Processing:" />
<String Id="OverallProgressPackageText" Value="Initializing..." />
<String Id="ProgressCancelButton" Value="&amp;Cancel" />
<String Id="ModifyHeader" Value="Modify Setup" />
<String Id="ModifyRepairButton" Value="&amp;Repair" />
<String Id="ModifyUninstallButton" Value="&amp;Uninstall" />
<String Id="ModifyCancelButton" Value="&amp;Cancel" />
<String Id="SuccessHeader" Value="Setup Successful" />
<String Id="SuccessCacheHeader" Value="Cache Successfully Completed" />
<String Id="SuccessInstallHeader" Value="Installation Successfully Completed" />
<String Id="SuccessLayoutHeader" Value="Layout Successfully Completed" />
<String Id="SuccessModifyHeader" Value="Modify Successfully Completed" />
<String Id="SuccessRepairHeader" Value="Repair Successfully Completed" />
<String Id="SuccessUninstallHeader" Value="Uninstall Successfully Completed" />
<String Id="SuccessUnsafeUninstallHeader" Value="Uninstall Successfully Completed" />
<String Id="SuccessLaunchButton" Value="&amp;Launch" />
<String Id="SuccessRestartText" Value="You must restart your computer before you can use the software." />
<String Id="SuccessUninstallRestartText" Value="You must restart your computer to complete the removal of the software." />
<String Id="SuccessRestartButton" Value="&amp;Restart" />
<String Id="SuccessCloseButton" Value="&amp;Close" />
<String Id="FailureHeader" Value="Setup Failed" />
<String Id="FailureCacheHeader" Value="Cache Failed" />
<String Id="FailureInstallHeader" Value="Setup Failed" />
<String Id="FailureLayoutHeader" Value="Layout Failed" />
<String Id="FailureModifyHeader" Value="Modify Failed" />
<String Id="FailureRepairHeader" Value="Repair Failed" />
<String Id="FailureUninstallHeader" Value="Uninstall Failed" />
<String Id="FailureUnsafeUninstallHeader" Value="Uninstall Failed" />
<String Id="FailureHyperlinkLogText" Value="One or more issues caused the setup to fail. Please fix the issues and then retry setup. For more information see the &lt;a href=&quot;#&quot;&gt;log file&lt;/a&gt;." />
<String Id="FailureRestartText" Value="You must restart your computer to complete the rollback of the software." />
<String Id="FailureRestartButton" Value="&amp;Restart" />
<String Id="FailureCloseButton" Value="&amp;Close" />
<String Id="FilesInUseTitle" Value="Files In Use" />
<String Id="FilesInUseLabel" Value="The following applications are using files that need to be updated:" />
<String Id="FilesInUseNetfxCloseRadioButton" Value="Close the &amp;applications." />
<String Id="FilesInUseCloseRadioButton" Value="Close the &amp;applications and attempt to restart them." />
<String Id="FilesInUseDontCloseRadioButton" Value="&amp;Do not close applications. A reboot will be required." />
<String Id="FilesInUseRetryButton" Value="&amp;Retry" />
<String Id="FilesInUseIgnoreButton" Value="&amp;Ignore" />
<String Id="FilesInUseExitButton" Value="E&amp;xit" />
</WixLocalization>
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://github.com/wixtoolset/wix/blob/e0641f1479c6f67f6ec119d448b66a74ad5d6b88/src/ext/Bal/wixstdba/Resources/HyperlinkTheme.xml -->
<Theme xmlns="http://wixtoolset.org/schemas/v4/thmutil">
<Font Id="0" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>
<Font Id="1" Height="-24" Weight="500" Foreground="windowtext">Segoe UI</Font>
<Font Id="2" Height="-22" Weight="500" Foreground="graytext">Segoe UI</Font>
<Font Id="3" Height="-12" Weight="500" Foreground="windowtext" Background="window">Segoe UI</Font>
<Window Width="514" Height="300" HexStyle="100a0000" FontId="0" Caption="#(loc.Caption)">
<ImageControl X="11" Y="11" Width="64" Height="64" ImageFile="logo.png" Visible="yes"/>
<Label X="80" Y="11" Width="-11" Height="64" FontId="1" Visible="yes" DisablePrefix="yes">#(loc.Title)</Label>
<Page Name="Help">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.HelpHeader)</Label>
<Label X="11" Y="112" Width="-11" Height="-35" FontId="3" DisablePrefix="yes">#(loc.HelpText)</Label>
<Button Name="HelpCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.HelpCloseButton)</Text>
<CloseWindowAction />
</Button>
</Page>
<Page Name="Loading">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes" Visible="no" Name="CheckingForUpdatesLabel" />
</Page>
<Page Name="Install">
<Hypertext Name="EulaHyperlink" X="11" Y="121" Width="-11" Height="25" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>
<Checkbox Name="InstallMariaDBCheckbox" X="11" Y="146" Width="500" Height="26" TabStop="yes" FontId="3">#(loc.MariaDBCheckbox)</Checkbox>
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>
<Button Name="InstallUpdateButton" X="11" Y="-11" Width="200" Height="23" TabStop="yes" FontId="0" EnableCondition="WixStdBAUpdateAvailable" HideWhenDisabled="yes">#(loc.UpdateButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="InstallCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.InstallCancelButton)</Text>
<CloseWindowAction />
</Button>
</Page>
<Page Name="Progress">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ProgressHeader)</Label>
<Label X="11" Y="121" Width="70" Height="17" FontId="3" DisablePrefix="yes">#(loc.ProgressLabel)</Label>
<Label Name="OverallProgressPackageText" X="85" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OverallProgressPackageText)</Label>
<Progressbar Name="OverallCalculatedProgressbar" X="11" Y="143" Width="-11" Height="15" />
<Button Name="ProgressCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ProgressCancelButton)</Button>
</Page>
<Page Name="Modify">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.ModifyHeader)</Label>
<Button Name="ModifyUpdateButton" X="11" Y="-11" Width="200" Height="23" TabStop="yes" FontId="0" EnableCondition="WixStdBAUpdateAvailable" HideWhenDisabled="yes">#(loc.UpdateButton)</Button>
<Button Name="RepairButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.ModifyRepairButton)</Button>
<Button Name="UninstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.ModifyUninstallButton)</Button>
<Button Name="ModifyCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.ModifyCancelButton)</Text>
<CloseWindowAction />
</Button>
</Page>
<Page Name="Success">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">
<Text>#(loc.SuccessHeader)</Text>
<Text Condition="WixBundleAction = 2">#(loc.SuccessLayoutHeader)</Text>
<Text Condition="WixBundleAction = 3">#(loc.SuccessUnsafeUninstallHeader)</Text>
<Text Condition="WixBundleAction = 4">#(loc.SuccessUninstallHeader)</Text>
<Text Condition="WixBundleAction = 5">#(loc.SuccessCacheHeader)</Text>
<Text Condition="WixBundleAction = 6">#(loc.SuccessInstallHeader)</Text>
<Text Condition="WixBundleAction = 7">#(loc.SuccessModifyHeader)</Text>
<Text Condition="WixBundleAction = 8">#(loc.SuccessRepairHeader)</Text>
</Label>
<Button Name="LaunchButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessLaunchButton)</Button>
<Label X="-11" Y="-51" Width="400" Height="34" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBARestartRequired">
<Text>#(loc.SuccessRestartText)</Text>
<Text Condition="WixBundleAction = 3">#(loc.SuccessUninstallRestartText)</Text>
</Label>
<Button Name="SuccessRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.SuccessRestartButton)</Button>
<Button Name="SuccessCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.SuccessCloseButton)</Text>
<CloseWindowAction />
</Button>
</Page>
<Page Name="Failure">
<Label X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">
<Text>#(loc.FailureHeader)</Text>
<Text Condition="WixBundleAction = 2">#(loc.FailureLayoutHeader)</Text>
<Text Condition="WixBundleAction = 3">#(loc.FailureUnsafeUninstallHeader)</Text>
<Text Condition="WixBundleAction = 4">#(loc.FailureUninstallHeader)</Text>
<Text Condition="WixBundleAction = 5">#(loc.FailureCacheHeader)</Text>
<Text Condition="WixBundleAction = 6">#(loc.FailureInstallHeader)</Text>
<Text Condition="WixBundleAction = 7">#(loc.FailureModifyHeader)</Text>
<Text Condition="WixBundleAction = 8">#(loc.FailureRepairHeader)</Text>
</Label>
<Hypertext Name="FailureLogFileLink" X="11" Y="121" Width="-11" Height="42" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext>
<Hypertext Name="FailureMessageText" X="22" Y="163" Width="-11" Height="51" FontId="3" TabStop="yes" HideWhenDisabled="yes" />
<Label X="-11" Y="-51" Width="400" Height="34" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBARestartRequired">#(loc.FailureRestartText)</Label>
<Button Name="FailureRestartButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button>
<Button Name="FailureCloseButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">
<Text>#(loc.FailureCloseButton)</Text>
<CloseWindowAction />
</Button>
</Page>
</Window>
</Theme>
@@ -8,6 +8,7 @@
<CustomAction Id="DetachStopTgsServiceIfRunningAction" BinaryRef="InstallerExtensionsBinary" DllEntry="DetachStopTgsServiceIfRunning" Execute="deferred" />
<CustomAction Id="RunTgsConfigure" Execute="deferred" FileRef="ServiceExecutableFile" ExeCommand="-c -p=--appsettings-base-path=[APPLICATIONDATADIRECTORY]" />
<CustomAction Id="RunTgsConfigureMariaDB" Execute="deferred" FileRef="ServiceExecutableFile" ExeCommand="-c -p=&quot;--appsettings-base-path=[APPLICATIONDATADIRECTORY] --Internal:MariaDBSetup=true&quot;" />
<Icon Id="tgs.ico" SourceFile="../../../tgs.ico" />
@@ -15,7 +16,8 @@
<InstallExecuteSequence>
<Custom Action="DetachStopTgsServiceIfRunningAction" Condition="UPGRADINGPRODUCTCODE OR REINSTALL" Before="StopServices" />
<Custom Action="RunTgsConfigure" Before="StartServices" Condition="(NOT REMOVE~=&quot;ALL&quot;) AND (NOT PRODUCTIONAPPSETTINGSPRESENT) AND ((WIX_BOOTSTRAPPER_UILEVEL >= 4) OR (UILevel >= 4))" />
<Custom Action="RunTgsConfigure" Before="StartServices" Condition="(NOT MARIADB_INSTALLED) AND (NOT REMOVE~=&quot;ALL&quot;) AND (NOT PRODUCTIONAPPSETTINGSPRESENT) AND ((WIX_BOOTSTRAPPER_UILEVEL >= 4) OR (UILevel >= 4))"/>
<Custom Action="RunTgsConfigureMariaDB" Before="StartServices" Condition="MARIADB_INSTALLED AND (NOT REMOVE~=&quot;ALL&quot;) AND (NOT PRODUCTIONAPPSETTINGSPRESENT) AND ((WIX_BOOTSTRAPPER_UILEVEL >= 4) OR (UILevel >= 4))"/>
<StartServices Condition="(NOT REMOVE~=&quot;ALL&quot;) AND ((WIX_BOOTSTRAPPER_UILEVEL >= 4) OR (UILevel >= 4) OR PRODUCTIONAPPSETTINGSPRESENT)"/>
</InstallExecuteSequence>
@@ -13,6 +13,7 @@ try
[XML]$versionXML = Get-Content build/Version.props -ErrorAction Stop
$redistUrl = $versionXML.Project.PropertyGroup.TgsDotnetRedistUrl
$dbRedistUrl = $versionXML.Project.PropertyGroup.TgsMariaDBRedistUrl
mkdir artifacts
$previousProgressPreference = $ProgressPreference
@@ -20,6 +21,7 @@ try
try
{
Invoke-WebRequest -Uri $redistUrl -OutFile artifacts/hosting-bundle.exe
Invoke-WebRequest -Uri $dbRedistUrl -OutFile artifacts/mariadb.msi
} finally {
$ProgressPreference = $previousProgressPreference
}
@@ -24,5 +24,10 @@
/// The base path for the app settings configuration files.
/// </summary>
public string AppSettingsBasePath { get; set; }
/// <summary>
/// Coerce the <see cref="Setup.SetupWizard"/> to select <see cref="DatabaseType.MariaDB"/>.
/// </summary>
public bool MariaDBSetup { get; set; }
}
}
+40 -7
View File
@@ -362,6 +362,12 @@ namespace Tgstation.Server.Host.Setup
{
if (firstTime)
{
if (internalConfiguration.MariaDBSetup)
{
await console.WriteAsync("It looks like you just installed MariaDB. Selecting it as the database type.", true, cancellationToken);
return DatabaseType.MariaDB;
}
await console.WriteAsync(String.Empty, true, cancellationToken);
await console.WriteAsync(
"NOTE: If you are serious about hosting public servers, it is HIGHLY reccommended that TGS runs on a database *OTHER THAN* Sqlite.",
@@ -413,19 +419,30 @@ namespace Tgstation.Server.Host.Setup
{
DatabaseType = await PromptDatabaseType(firstTime, cancellationToken),
};
firstTime = false;
string serverAddress = null;
ushort? serverPort = null;
bool isSqliteDB = databaseConfiguration.DatabaseType == DatabaseType.Sqlite;
var definitelyLocalMariaDB = firstTime && internalConfiguration.MariaDBSetup;
var isSqliteDB = databaseConfiguration.DatabaseType == DatabaseType.Sqlite;
IPHostEntry serverAddressEntry = null;
if (!isSqliteDB)
do
{
await console.WriteAsync(null, true, cancellationToken);
await console.WriteAsync("Enter the server's address and port [<server>:<port> or <server>] (blank for local): ", false, cancellationToken);
serverAddress = await console.ReadLineAsync(false, cancellationToken);
if (definitelyLocalMariaDB)
{
await console.WriteAsync("Enter the server's port (blank for 3306): ", false, cancellationToken);
var enteredPort = await console.ReadLineAsync(false, cancellationToken);
if (!String.IsNullOrWhiteSpace(enteredPort) && enteredPort.Trim() != "3306")
serverAddress = $"localhost:{enteredPort}";
}
else
{
await console.WriteAsync("Enter the server's address and port [<server>:<port> or <server>] (blank for local): ", false, cancellationToken);
serverAddress = await console.ReadLineAsync(false, cancellationToken);
}
if (String.IsNullOrWhiteSpace(serverAddress))
serverAddress = null;
else if (databaseConfiguration.DatabaseType == DatabaseType.SqlServer)
@@ -463,7 +480,7 @@ namespace Tgstation.Server.Host.Setup
while (true);
await console.WriteAsync(null, true, cancellationToken);
await console.WriteAsync($"Enter the database {(isSqliteDB ? "file path" : "name")} (Can be from previous installation. Otherwise, should not exist): ", false, cancellationToken);
await console.WriteAsync($"Enter the database {(isSqliteDB ? "file path" : "name")} ({(definitelyLocalMariaDB ? "leave blank for \"tgs\")" : "Can be from previous installation. Otherwise, should not exist")}): ", false, cancellationToken);
string databaseName;
bool dbExists = false;
@@ -484,6 +501,8 @@ namespace Tgstation.Server.Host.Setup
null,
cancellationToken);
}
else if (definitelyLocalMariaDB)
databaseName = "tgs";
if (String.IsNullOrWhiteSpace(databaseName))
await console.WriteAsync("Invalid database name!", true, cancellationToken);
@@ -510,8 +529,17 @@ namespace Tgstation.Server.Host.Setup
if (!isSqliteDB)
if (!useWinAuth)
{
await console.WriteAsync("Enter username: ", false, cancellationToken);
username = await console.ReadLineAsync(false, cancellationToken);
if (definitelyLocalMariaDB)
{
await console.WriteAsync("Using username: root", true, cancellationToken);
username = "root";
}
else
{
await console.WriteAsync("Enter username: ", false, cancellationToken);
username = await console.ReadLineAsync(false, cancellationToken);
}
await console.WriteAsync("Enter password: ", false, cancellationToken);
password = await console.ReadLineAsync(true, cancellationToken);
}
@@ -625,6 +653,11 @@ namespace Tgstation.Server.Host.Setup
await console.WriteAsync(e.Message, true, cancellationToken);
await console.WriteAsync(null, true, cancellationToken);
await console.WriteAsync("Retrying database configuration...", true, cancellationToken);
if (definitelyLocalMariaDB)
await console.WriteAsync("No longer assuming MariaDB is the target.", true, cancellationToken);
firstTime = false;
}
}
while (true);