Class NGINXInstaller
- Namespace
- FishMMO.Installer
- Assembly
- FishMMO-Installer.dll
Handles NGINX installation and detection. Supports Windows (zip download + Windows service) and Linux (pacman, apt-get, dnf, yum + systemd).
public static class NGINXInstaller
- Inheritance
-
NGINXInstaller
- Inherited Members
Fields
LimitsDropInPath
systemd drop-in that raises NGINX's open-file limit for the UDP stream sockets.
public const string LimitsDropInPath = "/etc/systemd/system/nginx.service.d/fishmmo-limits.conf"
Field Value
StreamGeneratorInstallPath
Where the stream generator is installed, matching nginx.conf's comments and the README.
public const string StreamGeneratorInstallPath = "/usr/local/bin/gen-fishmmo-stream-config.sh"
Field Value
StreamGeneratorName
The UDP stream generator in FishMMOSetupPath.
public const string StreamGeneratorName = "gen-fishmmo-stream-config.sh"
Field Value
TemplateDomain
The placeholder domain the repository's nginx.conf is written for.
public const string TemplateDomain = "fishmmo.com"
Field Value
Methods
DeployNginxConfigAsync()
Deploys the canonical FishMMO nginx.conf from
FishMMOSetupPath to the system NGINX config
location and reloads the service. Existing files are backed up once with
.pre-fishmmo.bak. Runs nginx -t before reload to validate syntax.
public static Task DeployNginxConfigAsync()
Returns
Remarks
On Linux it also substitutes the operator's root domain for TemplateDomain, refuses to run before that domain's certificate exists (every server block names it), loads the stream module, and installs and runs the UDP stream generator.
EnsureNssmInstalledAsync()
Ensures NSSM is available locally for reliable Windows service management.
public static Task<string> EnsureNssmInstalledAsync()
Returns
ForDomain(string, string)
Rewrites the template's placeholder domain (host names and the certificate lineage path)
to domain.
public static string ForDomain(string template, string domain)
Parameters
Returns
GetExpectedWindowsNginxHomePath()
Computes the expected NGINX home directory from configured zip filename.
public static string GetExpectedWindowsNginxHomePath()
Returns
- string
Absolute NGINX home directory path.
InstallNGINX()
Installs NGINX based on the operating system.
public static Task InstallNGINX()
Returns
IsNGINXInstalledAsync()
Checks if NGINX is installed by running 'nginx -v'.
public static Task<bool> IsNGINXInstalledAsync()
Returns
IsRunningAsAdministrator()
Checks whether the current process is running with Administrator privileges. Returns true on non-Windows (Linux uses sudo for individual commands).
public static bool IsRunningAsAdministrator()
Returns
NssmInstallAsync(string, string, string, string, string)
NSSM install with AppDirectory and Start set automatically.
public static Task<bool> NssmInstallAsync(string nssmExe, string serviceName, string exePath, string appDirectory, string appParameters)
Parameters
Returns
NssmServiceExistsAsync(string, string)
Stops an NSSM-managed service.
public static Task<bool> NssmServiceExistsAsync(string nssmExe, string serviceName)
Parameters
Returns
NssmSetEnvironmentAsync(string, string, IReadOnlyList<string>)
Sets NSSM AppEnvironmentExtra entries for a service. Each string should be in KEY=VALUE format.
public static Task NssmSetEnvironmentAsync(string nssmExe, string serviceName, IReadOnlyList<string> environmentVariables)
Parameters
nssmExestringserviceNamestringenvironmentVariablesIReadOnlyList<string>
Returns
NssmStartServiceAsync(string, string)
Starts an NSSM-managed service.
public static Task<bool> NssmStartServiceAsync(string nssmExe, string serviceName)
Parameters
Returns
NssmStopServiceAsync(string, string)
public static Task<bool> NssmStopServiceAsync(string nssmExe, string serviceName)
Parameters
Returns
SetNssmParamAsync(string, string, string, string)
Sets an NSSM parameter for a service (best-effort).
public static Task SetNssmParamAsync(string nssmExe, string serviceName, string parameter, string value)