FishMMO-Installer
FishMMO-Installer is a cross-platform .NET 8 console tool that automates FishMMO server dependency setup. It provides an interactive menu-driven interface to install and configure all infrastructure components required to run a FishMMO game server. It also supports a CLI-driven non-interactive mode for headless/automated deployment.
Table of Contents
- Description
- Supported Platforms
- Menu Structure
- CLI / Non-Interactive Mode
- Key Component Versions
- Architecture
- Configuration & Environment
- Prerequisites
- Build and Run
- appsettings.json Example
- install-config.json Schema
- Operational checks after installation
- NGINX setup guide (per OS)
- Flow Diagram
- License
Supported Platforms
| Platform | Install Strategy |
|---|---|
| Windows 10/11 | EXE/ZIP installers + Windows services (UAC elevation) |
| Ubuntu/Debian | apt-get + systemctl |
| Arch Linux / CachyOS | pacman + systemctl |
| RHEL / Fedora | dnf / yum + systemctl |
Menu Structure
=== FishMMO Installer ===
1 : Runtime & Tooling
2 : Database
3 : Web Server
4 : Unity & Build
5 : Configuration
6 : Uninstall
0 : Quit
1 — Runtime & Tooling
| Option | Description |
|---|---|
| 1 | Install dotnet-ef global tool |
| 2 | Install ASP.NET Core Runtime (8.0.x) |
| 3 | Install Visual Studio Build Tools (Windows only) |
VS Build Tools installs the .NET desktop development and Desktop development with C++ workloads plus the Windows 10 SDK silently via the VS 2022 bootstrapper.
2 — Database
| Option | Description |
|---|---|
| 1 | Configure Secrets & Environment (database, mail, service — one file; also Configuration → 3) |
| 2 | Install PostgreSQL |
| 3 | Install PgBouncer (connection pooler) |
| 4 | Install FishMMO Database (user / schema / initial EF migration) |
| 5 | Create a new EF Core database migration |
| 6 | Grant user permissions on the FishMMO database |
| 7 | Delete FishMMO Database (destructive — prompts for confirmation) |
| 8 | Configure PgBouncer (generate pgbouncer.ini, auth_query or userlist.txt, Linux only) |
| 9 | Configure Server Keys (DB-backed deployment secrets — gate secret, HMAC key, KEK) |
| A | Create Admin Account (AdminAccountInstaller: Admin, verified, two-factor enrolled, audited; needs 9 first for the TOTP master key) |
3 — Web Server
| Option | Description |
|---|---|
| 1 | Install NGINX (1.29.5 on Windows; the distribution package plus its stream module on Linux) and configure service startup |
| 2 | Install / Renew Let's Encrypt certificate — Linux offers the DNS challenge through the Porkbun API (default, wildcard) or the HTTP challenge |
| 3 | Deploy FishMMO nginx.conf (from FishMMO-Setup/) for your domain, plus the UDP stream blocks |
| 4 | Configure Firewall Rules (opens FirewallInstaller.DefaultPorts — 443/tcp and 7770-7999/udp; port 80 stays closed) |
| 5 | Register FishMMO Web Servers as systemd Services (Linux: IPFetch, Patcher, WebGL, Control Panel) |
| 6 | Install / Renew Local Development Certificates (Linux) |
| 7 | Point DNS Records at This Host (Porkbun): A records for api, play, game, panel via porkbun-dns-hook.py records, with a dry run and confirmation first |
The menu entry always opens the two default TCP ports. Port ranges and UDP rules — the
game servers' 7770-7999/udp in particular — are expressed in install-config.json's
firewallPorts and applied by the firewall component; see
install-config.json Schema.
On Windows NGINX runs as a Windows service managed by NSSM 2.24 and TLS is automated via win-acme 2.2.9.1701.
On Linux NGINX is managed by systemd and TLS is automated via certbot.
The web server service registration (menu 3-5) registers systemd units on Linux, with environment variables set to Production (configurable via FISHMMO_SERVICE_ENVIRONMENT). On Windows it only logs a reminder: an NSSM registration path exists in SystemdServiceInstaller.InstallWindowsServicesAsync but nothing calls it yet.
4 — Unity & Build
| Option | Description |
|---|---|
| 1 | Install Unity Hub |
| 2 | Install Unity Editor 6000.6.8f1 with selectable modules |
| 3 | Build all C# projects under a selected root directory |
| 4 | Build FishMMO-Unity (Client/Server/Addressables via headless batch mode) |
Available Unity modules
| Module ID | Display Name |
|---|---|
linux-il2cpp |
Linux Build Support (IL2CPP) |
linux-mono |
Linux Build Support (Mono) |
linux-server |
Linux Dedicated Server Build Support |
mac-mono |
Mac Build Support (Mono) |
mac-il2cpp |
Mac Build Support (IL2CPP) |
mac-server |
Mac Dedicated Server Build Support |
windows-mono |
Windows Build Support (Mono) |
windows-il2cpp |
Windows Build Support (IL2CPP) |
windows-server |
Windows Dedicated Server Build Support |
webgl |
Web Build Support |
android |
Android Build Support |
ios |
iOS Build Support |
Default modules installed: linux-il2cpp, linux-server, webgl, windows-mono, windows-il2cpp, windows-server (windows-il2cpp only on a Windows host; the Hub skips it on Linux)
Project build scans the chosen directory recursively for .csproj files, builds dependency-order projects synchronously first (FishMMO-Dependencies → FishMMO-Logger → FishMMO-Database → FishMMO-SharedUtility → FishMMO-Auth), then runs the remaining builds in parallel.
Unity build locates the Unity Editor executable via multiple resolution strategies (env var, default install path, Unity Hub CLI, filesystem probe, interactive prompt), then invokes -batchmode -nographics with the appropriate -executeMethod target from FishMMO.Shared.CustomBuildTool.
5 — Configuration
| Option | Description |
|---|---|
| 1 | Configure Web Server Settings (IPFetch, Patcher, WebGL, Control Panel) |
| 2 | Configure Discord Bot Settings |
| 3 | Configure Secrets & Environment (database, mail, service, Discord token: one file) |
The wizard (AppSettingsInstaller) supports configuration for 5 components:
| Component | Menu | Config File | Key Settings |
|---|---|---|---|
| IPFetch Web Server | 5-1 | appsettings.json |
HttpPort, Npgsql connection string |
| Patcher Web Server | 5-1 | appsettings.json |
HttpPort, Patches directory |
| WebGL Web Server | 5-1 | appsettings.json |
HttpPort |
| Control Panel Web Server | 5-1 | appsettings.json |
HttpPort, Npgsql connection string |
| Discord Bot | 5-2 | appsettings.json |
Guild ID, Npgsql host/port/database/schema, chat bridge, rate limiting. No secrets: option 3 opens Secrets & Environment (5-3), which holds FISHMMO_DISCORD_TOKEN and the FISHMMO_DB_* credentials. |
The installer's own database connection (Host, Port, Database, Username, Password) is
not part of this wizard — it is menu 2-1, DatabaseSecretsInstaller, which writes the
secrets file at DatabaseSecrets.DefaultSecretsFilePath or exports the same values as
environment variables.
For each component, the wizard can generate:
appsettings.json— base configuration (chmod 600on Linux)appsettings.Development.json/appsettings.Production.json— environment overrides (chmod 600)~/.config/fish/conf.d/fishmmo-secrets.fish— fish shell snippet (chmod 600)fishmmo-secrets.env— systemd / Docker.envfile in the target directory (chmod 600)%USERPROFILE%\Documents\WindowsPowerShell\fishmmo-secrets.ps1— PowerShell snippet (Windows)%USERPROFILE%\fishmmo-secrets.cmd— CMD batch snippet (Windows)
All secrets files set the same environment variable format. .NET IConfiguration maps double-underscore (__) to JSON nesting — e.g. Npgsql__Password → Npgsql:Password in appsettings.json.
Note: These env-var secrets files contain database credentials and web server configuration only. Application secrets (gate secret, connection token HMAC key, signing key KEK) are never stored in env files — they are generated by the SecurityKeyInstaller and stored directly in the PostgreSQL database. Client-side
.generated.csfiles (ClientApiSecret.generated.cs,CertificatePins.generated.cs,HostConfig.generated.cs) are written from within the Unity Editor, in FishMMO > FishMMO Dashboard > Game Settings (Write Host Config, Fetch Pins → Write Pins to File, Write Secret to File). SeeFishMMO-Unity/GeneratedFileTemplates/README.md.
CLI / Non-Interactive Mode
The installer supports a full CLI mode for automated/headless deployment. Run FishMMO-Installer --help for the full list.
Usage:
FishMMO-Installer Interactive menu mode (default)
FishMMO-Installer --help / -h Show this help
FishMMO-Installer --version / -v Show version
FishMMO-Installer --component <name> Install one component interactively
FishMMO-Installer --non-interactive -f cfg Unattended install from config file
FishMMO-Installer --dry-run Simulate without making changes
FishMMO-Installer --validate Run post-install health checks
FishMMO-Installer --generate-checksums Generate SHA256 hashes for downloaded files
FishMMO-Installer --quickstart Unattended install with quickstart defaults
FishMMO-Installer --accept-defaults / -y Skip confirmation prompts
FishMMO-Installer --list-components List available component names and exit
FishMMO-Installer --log-file <path> Write log output to a file in addition to console
Full flag list as parsed by CliParser.Parse, including aliases the help text omits:
| Flag | Aliases | Argument | Effect |
|---|---|---|---|
--help |
-h, /? |
— | Print help and exit (before any initialization) |
--version |
-v |
— | Print assembly version and exit |
--list-components |
— | — | Print the component name list and exit |
--component |
-c |
<name> |
Install one component (lower-cased; ignored if the next token starts with -) |
--config |
-f |
<path> |
install-config.json path for --non-interactive (default: install-config.json beside the EXE) |
--non-interactive |
— | — | Run the manifest at --config unattended |
--dry-run |
— | — | Simulate; overrides the manifest's own dryRun to true |
--validate |
— | — | Run HealthChecker and exit 0/1 |
--generate-checksums |
— | — | Hash the files named in checksums.json and rewrite it |
--quickstart |
— | — | Implies --non-interactive --config templates/install-config.quickstart.json (resolved against the EXE directory; exits 1 if absent) |
--accept-defaults |
-y, --yes |
— | InstallerProcessHelper.AcceptDefaults = true — every Y/N prompt auto-accepts |
--configure-server-secrets |
— | <regions> |
Comma-separated region IDs; runs SecurityKeyInstaller.ConfigureDatabaseKeysAsync and exits. Without FISHMMO_PG_SUPERUSER_PASSWORD it prompts for the superuser password |
--log-file |
— | <path> |
Adds a FileLogger to the logging config for this run |
Unknown flags and stray positional arguments are ignored rather than rejected.
Exit codes: 0 on success; 1 for a failed component, a failed health check, a
missing/unparseable config, or a failed logging bootstrap; 2 when pre-flight checks
report a blocking error in a CLI mode other than --validate.
Available component names
| Component | Description |
|---|---|
dotnet-ef |
dotnet-ef global tool (required for database migrations) |
aspnet-runtime |
ASP.NET Core Runtime 8.0 |
vs-build-tools |
Visual Studio Build Tools (Windows only) |
postgresql |
PostgreSQL server |
pgbouncer |
PgBouncer connection pooler |
fishmmo-db |
FishMMO database, user, and initial migration |
nginx |
NGINX reverse proxy |
letsencrypt |
Let's Encrypt TLS certificate |
unity-hub |
Unity Hub |
unity-editor |
Unity Editor + modules |
build-projects |
Build all C# projects |
build-unity |
Build FishMMO-Unity player/addressables |
appsettings |
Configure appsettings.json + secrets |
create-migration |
Create a new EF Core database migration |
firewall |
Configure host firewall rules |
systemd-services |
Register FishMMO web servers as systemd services (Linux) |
all |
Run every component in dependency order |
Pre-flight checks
The installer runs pre-flight checks at startup in all modes. In non-interactive/CLI modes, blocking errors halt installation. In interactive mode, all results are shown as warnings/logs only:
- Internet connectivity (pings
dot.net) - Disk space (minimum 5 GB recommended)
- System memory (minimum 2 GB recommended)
- Administrator / passwordless-sudo access
- Port conflicts on standard FishMMO ports (80, 443, 5432, 6432, 8000, 8080, 8090)
Key Component Versions
| Component | Version |
|---|---|
| dotnet-ef | 5.0.17 (pinned for Unity3D compatibility) |
| ASP.NET Core Runtime | Latest in 8.0 channel (hardcoded fallback 8.0.16) |
| PostgreSQL | latest via package manager (Linux) / EnterpriseDB installer (Windows) |
| PgBouncer | latest via package manager, default port 6432 |
| NGINX | 1.29.5 (Windows ZIP), package manager (Linux) |
| Unity Editor | 6000.6.8f1 (InstallationConstants.UnityDefaultVersion, overridable at prompt) |
| win-acme | 2.2.9.1701 (Windows TLS automation) |
| NSSM | 2.24 (Windows service wrapper for NGINX) |
| Visual Studio Build Tools | VS 2022 bootstrapper (aka.ms/vs/17/release/vs_buildtools.exe) |
Note: The .NET SDK is a prerequisite for running this installer and is not installed by it. The ASP.NET Core Runtime download URL and SHA512 hash are resolved dynamically from Microsoft's official release metadata API, providing cryptographically-verifiable integrity for the hosting bundle download.
Architecture
Root-level installers (one file per subsystem)
| File | Responsibility |
|---|---|
Program.cs |
Entry point — environment setup, config load, interactive menu loop, CLI dispatch |
InstallationConstants.cs |
All download URLs, filenames, version strings, default config values, EF paths, monorepo layout |
InstallerProcessHelper.cs |
Shared process execution, shell detection (fish → bash → cmd), prompting utilities, Linux DotNet PATH/DOTNET_ROOT bootstrap |
DotNetInstaller.cs |
ASP.NET Runtime install and version detection, dotnet-ef tool install, EF migration/database-update commands |
DatabaseSecretsInstaller.cs |
Interactive wizard for the installer's own DB connection (username, password, host, port, database) — writes the secrets file or exports the values as env vars; uses sudo on Linux when the secrets path needs root |
VSBuildToolsInstaller.cs |
VS Build Tools silent install (Windows only) |
PostgreSQLInstaller.cs |
PostgreSQL install, database/user creation, EF migrations, permission grants, database deletion |
PostgreSQLHardening.cs |
PostgreSQL security hardening — rewrites pg_hba.conf to scram-sha-256, updates postgresql.conf (partial class of PostgreSQLInstaller) |
PgBouncerInstaller.cs |
PgBouncer install, systemd service setup, pgbouncer.ini generation with auth_query (recommended) or auth_file/userlist.txt SCRAM-SHA-256 modes |
SecurityKeyInstaller.cs |
Cryptographic key generation and storage in the database (gate secret, connection token HMAC key, signing key KEK). Client .generated.cs files are generated separately from the Unity Editor. |
AdminAccountInstaller.cs |
Database → A. Creates an Administrator through the FishMMO-DB services with the servers' own credentials, mirroring a registration: SRP salt/verifier from the fixed identity, email profile, verified, access level Admin, TOTP secret under the master KEK, recovery codes. All writes are one transaction; the result is audited (source = installer). Shows the authenticator key (QR via qrencode when installed) and recovery codes once. |
NGINXInstaller.cs |
NGINX install, Windows service registration (NSSM), Linux systemd configuration, nginx.conf deployment |
LetsEncryptInstaller.cs |
certbot (Linux) and win-acme (Windows) TLS certificate automation for NGINX |
UnityInstaller.cs |
Unity Hub and Unity Editor install via Unity Hub CLI with module selection |
UnityBuildInstaller.cs |
Unity headless builds (Client/Server/Addressables) via -batchmode -nographics with multi-strategy editor resolution |
ProjectBuildInstaller.cs |
Staged/parallel dotnet build across all discovered .csproj files with priority-based ordering |
AppSettingsInstaller.cs |
Interactive wizard to write appsettings.json, env overlays, and secrets env-var files for FishMMO web servers including the Control Panel (ConfigureAppSettings) and the Discord Bot (ConfigureDiscordBotComponent). Client security files are not generated here — use SecurityKeyInstaller (DB) + the Unity dashboard (client .generated.cs). |
LinuxConfigHardeningHelper.cs |
Atomic privileged file writes via sudo install, one-time .pre-fishmmo.bak backups, idempotent managed-marker detection |
Components (cross-cutting concerns)
| File | Responsibility |
|---|---|
Components/FirewallInstaller.cs |
Host firewall rule creation from FirewallPortSpec values (ufw preferred then firewalld on Linux, netsh on Windows). Exposes DefaultPorts (443/tcp, 7770-7999/udp; never 80/tcp) — the list used by the menu and by any manifest that names no ports |
Components/HealthChecker.cs |
Post-install validation — .NET SDK, ASP.NET Runtime, PostgreSQL, NGINX, PgBouncer, systemd services, database connectivity, disk space |
Components/SystemdServiceInstaller.cs |
Cross-platform service installation — systemd unit files on Linux, NSSM Windows services on Windows. Covers web servers (IPFetch, Patcher, WebGL) and the AppHealthMonitor daemon |
Infrastructure (shared services)
| File | Responsibility |
|---|---|
Infrastructure/CliParser.cs |
CLI argument parsing into CliCommand model, help/version text |
Infrastructure/DotNetReleaseHelper.cs |
Dynamic ASP.NET Core Runtime URL and version resolution from Microsoft release metadata API |
Infrastructure/DownloadHelper.cs |
File downloads with SHA256/SHA512 integrity verification, progress bars, checksum management, disk-space gating |
Infrastructure/InstallOrchestrator.cs |
Multi-component orchestration with dependency ordering, manifest-driven non-interactive installs. RunComponentAsync takes the optional InstallManifest, so the firewall and systemd-services components use the manifest's firewallPorts / webServers instead of hardcoded defaults |
Infrastructure/LinuxPackageManagerHelper.cs |
Package manager detection and command generation (pacman, apt-get, dnf, yum) |
Infrastructure/PlatformAbstractions.cs |
IPlatform interface + Windows/Linux implementations with PlatformFactory singleton |
Infrastructure/PreFlightChecker.cs |
System readiness checks (internet, disk, RAM, admin access, port conflicts) |
Models (data transfer objects)
| File | Responsibility |
|---|---|
Models/CliCommand.cs |
Parsed CLI command record (Help, Version, NonInteractive, DryRun, Validate, GenerateChecksums, Quickstart, AcceptDefaults, ListComponents, LogFilePath, ComponentName, ConfigFilePath) |
Models/InstallManifest.cs |
Deserialized install-config.json model for non-interactive installations |
Models/InstallResult.cs |
Single component installation result (Success, ComponentName, ErrorMessage, Duration) |
Configuration & Environment
At startup, the installer resolves the active environment name once and propagates it to all three standard variables:
FISHMMO_ENVIRONMENT
DOTNET_ENVIRONMENT
ASPNETCORE_ENVIRONMENT
The environment name is resolved via DatabaseConfigurationHelper.ResolveEnvironmentName() which checks (in order): FISHMMO_ENVIRONMENT env var → DOTNET_ENVIRONMENT → ASPNETCORE_ENVIRONMENT. Defaults to "Development" if none are set.
Configuration is loaded via DatabaseConfigurationHelper.BuildDesignTimeConfiguration, which:
- Checks the working directory for
appsettings.json(operator override). - Falls back to the bundled copy in the EXE directory (copied from
FishMMO-Setup/Development/appsettings.Database.jsonat build time). - Merges an optional
appsettings.{Environment}.jsonoverlay. - Applies environment variables as the highest-priority source.
Environment variables for non-interactive mode
When running in non-interactive mode (--non-interactive or --component), some components require credentials that would normally be prompted interactively. Set these environment variables before launching to enable fully unattended operation:
| Variable | Used by | Description |
|---|---|---|
FISHMMO_INSTALL_ROOT |
all | Override monorepo root path (skips auto-detection; useful for published builds) |
FISHMMO_LOG_LEVEL |
all | Override console logging verbosity (e.g. Debug, Verbose). Requires restart. |
FISHMMO_PG_SUPERUSER_PASSWORD |
fishmmo-db |
PostgreSQL superuser password (avoids interactive prompt) |
FISHMMO_PG_LISTEN_ADDRESSES |
PostgreSQL hardening | Override listen_addresses in postgresql.conf (default: localhost) |
FISHMMO_UNITY_EXE |
build-unity |
Path to Unity Editor executable (skips auto-detection) |
FISHMMO_SERVICE_ENVIRONMENT |
service installers | Override the environment name set in systemd/NSSM service units (default: Production) |
FISHMMO_CLIENT_GATE_SECRET |
--configure-server-secrets |
Pre-populate the gate secret for DB storage (if unset, SecurityKeyInstaller generates one automatically). Not read directly by web servers — they load it from the DB at startup. |
FISHMMO_SIGNING_KEY_KEK_BASE64 |
--configure-server-secrets |
Pre-populate the signing key KEK for DB storage (if unset, SecurityKeyInstaller generates one automatically). |
Logging is bootstrapped from logging.json (copied from FishMMO-Setup/logging.json at build time). The FISHMMO_LOG_LEVEL environment variable overrides console verbosity at runtime without editing the file.
Linux DotNet environment
Before any dotnet command runs on Linux, the installer prepares the runtime environment in-process (once per process lifetime):
- Adds
~/.dotnettoPATHif missing - Adds
~/.dotnet/toolstoPATHif missing - Sets
DOTNET_ROOTto~/.dotnetif it exists, otherwise/usr/share/dotnet
EF Core project paths (relative to EXE output directory)
| Role | Path |
|---|---|
| EF project | ./FishMMO-Database/FishMMO-DB/FishMMO-DB.csproj |
| Startup project | ./FishMMO-Database/FishMMO-DB-Migrator/FishMMO-DB-Migrator.csproj |
| Migrations output | Migrations/ (inside the FishMMO-DB project) |
MSBuild note: There is no stash-and-restore step. The installer's
CopyFishMMODatabasetarget (inFishMMO-Installer.csproj) mirrors the FishMMO-Database source tree into its output directory but excludes**\Migrations\**— along withbin,obj, and.vs. Generated migrations therefore stay solely in the realFishMMO-DBproject and are never copied, so an installerdotnet clean/dotnet buildcycle cannot duplicate or clobber them.
Unity executable resolution
Unity builds resolve the editor executable in this order:
- Cached value from a previous successful resolve in the same session
FISHMMO_UNITY_EXEenvironment variable (set this to skip auto-detection)- Default Unity Hub install path for the configured version
- Unity Hub CLI (
unityhub -- --headless editors --installed) output - Common alternate install locations (
/opt,~/.local/share/unityhub, etc.) - Interactive prompt for a user-supplied path
Monorepo root detection
The installer checks FISHMMO_INSTALL_ROOT first (if set), then walks up from the executing assembly until it finds a directory containing both FishMMO-Unity and FishMMO-Setup subdirectories. Falls back to ~/Dev/FishMMO-Dev if not found. If the env var path exists but is missing expected subdirectories, a warning is logged and the path is used anyway.
Prerequisites
- .NET SDK 8+ to build and run this repository
- Administrator / root privileges for system-level installs
- Internet connectivity for downloads and package repositories
- 5 GB+ free disk space recommended (Unity Editor + build tools)
- 2 GB+ RAM recommended
Install .NET SDK (if not already installed)
Windows 10/11
Install from Microsoft:
Then verify:
dotnet --list-sdks
Ubuntu/Debian
sudo apt-get update
sudo apt-get install -y dotnet-sdk-8.0
dotnet --list-sdks
Arch Linux / CachyOS
sudo pacman -S --noconfirm dotnet-sdk
dotnet --list-sdks
RHEL / Fedora
sudo dnf install -y dotnet-sdk-8.0
dotnet --list-sdks
Build and Run
The solution file is at the repository root:
cd path/to/FishMMO-Installer
dotnet build
dotnet run --project FishMMO-Installer/FishMMO-Installer.csproj
Run the compiled binary directly:
- Windows:
Builds/FishMMO-Installer/Debug/net8.0/FishMMO-Installer.exe - Linux:
./Builds/FishMMO-Installer/Debug/net8.0/FishMMO-Installer
Important:
logging.jsonandappsettings.jsonare copied fromFishMMO-Setup/to the output directory automatically by the build. Edit the templates inFishMMO-Setup/Development/with your credentials before building, or use the Configuration wizard (menu 5) to apply overrides. Place a modified copy in the working directory to override the bundled defaults at runtime.
Note:
checksums.jsonis also copied to the output directory. Populate it with SHA256 hashes of your downloaded artifacts to enable integrity verification. See checksums.json below.
appsettings.json Example
Database operations require appsettings.json in the working directory. Non-sensitive settings (host, port, database name, pool sizes) are stored in JSON. Secrets (password) are set via environment variables — see the _comment field in each template for the env var name to set.
{
"_comment": "Non-sensitive defaults only. Override secrets via env vars: Npgsql__Password, Npgsql__Username",
"Npgsql": {
"Database": "fish_mmo_postgresql",
"Schema": "public",
"Username": "",
"Password": "",
"Host": "127.0.0.1",
"Port": "5432",
"CommandTimeout": 10,
"ConnectionTimeout": 15,
"MinPoolSize": 5,
"MaxPoolSize": 100,
"RetryPolicy": {
"MaxRetries": 3,
"BaseDelayMs": 20,
"MaxJitterMs": 10
},
"QueryPerformanceTracking": {
"Enabled": false,
"Level": "Basic",
"SlowQueryThresholdMs": 1000,
"SampleRate": 0.1
}
},
"ConnectionPoolHealth": {
"WarningThresholdPercent": 70,
"CriticalThresholdPercent": 85,
"MonitoringIntervalSeconds": 60
}
}
Npgsql connection string format (for web servers)
The IPFetch and Control Panel web servers read ConnectionStrings:NpgsqlConnection, a
semicolon-delimited Npgsql DSN. The Discord bot does not: it reads the Npgsql section and the
FISHMMO_DB_* credentials, like the game servers.
Host=127.0.0.1;Port=5432;Database=fish_mmo_postgresql;Username=;Password=;Ssl Mode=Prefer;
install-config.json Schema
For non-interactive mode, create an install-config.json:
{
"components": ["postgresql", "fishmmo-db", "nginx", "letsencrypt"],
"configureFirewall": true,
"firewallPorts": [443, "7770-7999/udp"],
"registerSystemdServices": true,
"webServers": ["ipfetch", "patcher", "webgl"],
"validateAfterInstall": true,
"dryRun": false
}
| Field | Type | Description |
|---|---|---|
components |
string[] |
Component names to install, in desired order (sorted by dependency before execution) |
configureFirewall |
bool |
Open firewallPorts after the components finish. Redundant when firewall (or all) is in components: that step already applies firewallPorts, and the post-install pass is skipped so rules are not added twice. |
firewallPorts |
(int \| string)[] |
Ports to open. A bare number is a single TCP port; a string may carry a range and protocol: "443/tcp", "7770-7999/udp" (ranges inclusive, protocol defaults to tcp). Defaults to [443, "7770-7999/udp"] if empty. Add 80 only for the Let's Encrypt HTTP challenge. |
registerSystemdServices |
bool |
Register webServers as systemd services after the components finish (Linux only). Redundant when systemd-services (or all) is in components, which already uses webServers; the post-install pass is then skipped. |
webServers |
string[] |
Web server names to register (ipfetch, patcher, webgl or fishmmo-ipfetch etc). When empty or omitted, all three are registered. |
validateAfterInstall |
bool |
Run health checks after installation completes |
dryRun |
bool |
Simulate without making changes |
Example templates
Quickstart (minimum viable server):
{
"components": ["postgresql", "fishmmo-db", "nginx", "firewall"],
"configureFirewall": true,
"validateAfterInstall": true
}
Full stack (everything):
{
"components": ["dotnet-ef", "aspnet-runtime", "postgresql", "pgbouncer", "fishmmo-db", "nginx", "letsencrypt", "firewall", "systemd-services", "appsettings"],
"configureFirewall": true,
"registerSystemdServices": true,
"validateAfterInstall": true
}
Operational checks after installation
NGINX
- Linux:
sudo systemctl status nginx
sudo nginx -t
- Windows (PowerShell):
sc.exe query "FishMMO-NGINX"
PostgreSQL
- Linux:
sudo systemctl status postgresql
- Windows: verify PostgreSQL service is running in Services or with
sc.exe query.
PgBouncer (Linux)
sudo systemctl status pgbouncer
sudo pgbouncer -V
DotNet + EF tool
dotnet --list-sdks
dotnet tool list --global
Confirm dotnet-ef appears in the global tools list.
FishMMO web server services
Linux (systemd):
systemctl status fishmmo-ipfetch
systemctl status fishmmo-patcher
systemctl status fishmmo-webgl
systemctl status fishmmo-apphealthmonitor
Windows (NSSM / PowerShell):
sc.exe query FishMMO-IpFetch
sc.exe query FishMMO-Patcher
sc.exe query FishMMO-WebGL
sc.exe query FishMMO-AppHealthMonitor
Services are configured with ASPNETCORE_ENVIRONMENT, DOTNET_ENVIRONMENT, and FISHMMO_ENVIRONMENT set to Production (overridable via FISHMMO_SERVICE_ENVIRONMENT env var). On Windows, NSSM passes these via AppEnvironmentExtra; on Linux, systemd uses Environment= directives and an optional EnvironmentFile=-/etc/fishmmo/db-secrets.env for database credentials. Application secrets (gate secret, HMAC key, KEK) are not set via environment — servers load them from the database at startup.
Health check (built-in)
FishMMO-Installer --validate
This checks: .NET SDK, ASP.NET Core Runtime, PostgreSQL, NGINX, PgBouncer, systemd services, database connectivity, and available disk space.
Download integrity verification
The installer supports SHA256 checksum verification for all downloaded artifacts via checksums.json. This file is shipped with the installer and copied to the build output directory.
Current state
checksums.json contains the list of downloadable files with placeholder (empty) SHA256 checksum values and approximate file sizes. Empty checksums skip verification. To enable integrity verification, populate the file with actual hashes.
Exception: The ASP.NET Core Runtime (both Windows Hosting Bundle and Linux tarball) is verified against Microsoft's published SHA512 hash from the .NET release metadata API — this happens automatically at download time, independent of
checksums.json.
Generating checksums
Recommended: Use the built-in command after downloading artifacts:
FishMMO-Installer --generate-checksums
This hashes every file listed in checksums.json that is present in the working directory and writes the updated file back. Copy the result to the source directory to persist across builds.
Manual method: After downloading all artifacts at least once (run the installer interactively or use --non-interactive with a config), you can also compute checksums manually:
# Linux
cd ../Builds/FishMMO-Installer/Debug/net8.0/
for f in *.exe *.zip; do
if [ -f "$f" ]; then
hash=$(sha256sum "$f" | cut -d' ' -f1)
echo " \"$f\": \"$hash\","
fi
done
# Windows PowerShell
Get-ChildItem *.exe,*.zip | ForEach-Object {
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
Write-Output " `"$($_.Name)`": `"$hash`","
}
Then update checksums.json in the source directory (not the bin output) so future builds include the verified hashes.
NGINX setup guide (per OS)
This section shows exactly where to place nginx.conf, which ports must be opened/forwarded, and verification commands.
Required networking model
- Public internet ports to expose (host firewall and router forwarding):
443/tcp— HTTPS forapi.,play.andpanel.80/tcp— not needed with the DNS challenge; leave it closed so nothing unencrypted is reachable. Open it only to use the Let's Encrypt HTTP challenge (nginx then also redirects HTTP to HTTPS).7770-7999/udp— QUIC/WebTransport game traffic. NGINX's stream module listens on these and forwards the datagrams, untouched, to the loopback-bound game servers. At minimum forward the ports actually in use: 7770 (Login), 7780 (World), 7790 upwards (one per Scene server).443/udp— optional, HTTP/3 forplay.
- Keep backend app ports local-only (do not forward publicly):
8000(WebGL),8080(IPFetch),8090(Patcher),8100(Control Panel),5432(PostgreSQL),6432(PgBouncer).
Router/NAT forwarding itself is configured on your router UI (not on the host terminal). Terminal commands below open host firewall rules only.
Linux (Ubuntu/Debian + Arch/CachyOS)
Order matters: certificate first, then nginx.conf. Every HTTPS server block in the FishMMO nginx.conf names the certificate, so nginx -t cannot pass before it exists.
1) Install NGINX and the stream module
Web Server → 1. It installs nginx plus nginx-mod-stream (Arch, Fedora) or libnginx-mod-stream (Debian, Ubuntu); the stream module is what forwards the game's UDP ports.
2) Get the certificate
Web Server → 2, choose DNS through the Porkbun API (default), enter the root domain (e.g. example.com). It issues one certificate for example.com and *.example.com, with --reuse-key, and deploys it for the game servers — see Linux game-server TLS deployment. It needs no nginx and no open port 80.
Using the HTTP challenge instead, nginx must already serve the challenge directory on port 80, from a minimal config (not yet the FishMMO one):
sudo mkdir -p /var/www/certbot/.well-known/acme-challenge
sudo chown -R root:root /var/www/certbot
sudo chmod -R 755 /var/www/certbot
# port-80 server block: location /.well-known/acme-challenge/ { root /var/www/certbot; }
3) Deploy the FishMMO nginx.conf
Web Server → 3. It asks for the root domain and substitutes it for the template's fishmmo.com, checks the certificate exists, loads the stream module (writing /etc/nginx/modules.d/fishmmo-stream.conf on Arch), installs the config (backing up the old one as nginx.conf.pre-fishmmo.bak), runs nginx -t, then installs and runs /usr/local/bin/gen-fishmmo-stream-config.sh to write one UDP block per game port into /etc/nginx/stream.d/, listening on this host's LAN address (not 0.0.0.0, which would include the game servers' own 127.0.0.1 ports). Last it raises NGINX's open-file limit with /etc/systemd/system/nginx.service.d/fishmmo-limits.conf (LimitNOFILE=65535; reuseport opens one socket per worker per UDP port), restarts NGINX, and checks that UDP 7770 is really listening.
4) Open host firewall ports
If using ufw:
sudo ufw allow 443/tcp
sudo ufw allow 7770:7999/udp
sudo ufw allow 443/udp # optional, HTTP/3
sudo ufw status
# 80/tcp only if you use the HTTP challenge instead of DNS
If using firewalld:
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=7770-7999/udp
sudo firewall-cmd --reload
The menu entry (Web Server → 4) and the firewall component both open 443/tcp and 7770-7999/udp, and never 80/tcp.
5) Check NGINX
sudo nginx -t
sudo systemctl status nginx
sudo ss -ulpn | grep ':7770' # nginx listening on the first game port
6) Router/NAT forwarding
Forward these from router WAN to your Linux host's LAN IP (give it a fixed address or DHCP reservation):
TCP 443→<server_lan_ip>(TCP 80only with the HTTP challenge)UDP 7770-7999→<server_lan_ip>UDP 443→<server_lan_ip>(optional)
If the router's WAN address differs from what curl -4 https://ifconfig.me reports, the ISP uses CGNAT and inbound connections cannot reach you; ask the ISP for a public IPv4.
Windows 10/11
1) Place your nginx.conf
If installed by this installer, expected NGINX home is:
C:\nginx\nginx-1.29.5
Copy config (the installer's "Deploy nginx.conf" option automates this):
Copy-Item "C:\path\to\FishMMO-Setup\nginx.conf" "C:\nginx\nginx-1.29.5\conf\nginx.conf" -Force
2) Open Windows Firewall ports 80/443
On Windows the certificate comes from the HTTP challenge, so port 80 must be open for issuance and renewal (nginx answers it with the challenge files and an HTTPS redirect, nothing else). Run PowerShell as Administrator:
netsh advfirewall firewall add rule name="FishMMO NGINX HTTP" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="FishMMO NGINX HTTPS" dir=in action=allow protocol=TCP localport=443
netsh advfirewall firewall show rule name="FishMMO NGINX HTTP"
netsh advfirewall firewall show rule name="FishMMO NGINX HTTPS"
3) Validate and restart NGINX service
The installer manages the NGINX Windows service via NSSM. Service operations (install, start, stop, restart) require Administrator privileges — the installer checks this before any service operation.
# Validate configuration
& "C:\nginx\nginx-1.29.5\nginx.exe" -t
# Restart via NSSM (preferred — handles service state correctly)
& ".\nssm\nssm.exe" stop "FishMMO-NGINX"
Start-Sleep 1.5
& ".\nssm\nssm.exe" start "FishMMO-NGINX"
# Check service status
& ".\nssm\nssm.exe" status "FishMMO-NGINX"
sc.exe query "FishMMO-NGINX"
Troubleshooting:
- Service won't start → check
C:\nginx\nginx-1.29.5\logs\service-err.log(NSSM captures stderr) - Port 80/443 in use →
netstat -ano | findstr :80 - Run installer as Administrator for all service operations
- If NSSM download fails, install manually from https://nssm.cc/release/nssm-2.24.zip
4) Router/NAT forwarding
Forward these from router WAN to your Windows host LAN IP:
TCP 80→<server_lan_ip>:80(the HTTP challenge)TCP 443→<server_lan_ip>:443UDP 7770-7999→<server_lan_ip>(game traffic)
Verify externally after forwarding
From any external machine/network:
curl -I https://play.your-domain
curl -I --max-time 5 http://play.your-domain
Expected outcome:
- HTTPS responds with your configured certificate
- HTTP times out when port 80 is closed (the DNS challenge). With the HTTP challenge it answers with a redirect to HTTPS
Important FishMMO port notes
- Do NOT public-forward
8000,8080,8090,8100. - Do forward
7770-7999/udp: game traffic is QUIC over UDP and reaches the game servers through NGINX's stream module, never through 80/443. There is no WebSocket path. - The public surface is
443/tcp,7770-7999/udpand optionally443/udp(plus80/tcponly with the HTTP challenge). - PostgreSQL hardening (
scram-sha-256,listen_addresses— defaultlocalhost, overridable viaFISHMMO_PG_LISTEN_ADDRESSESenv var) is applied automatically during database setup on Linux.
Flow Diagram
flowchart TD
User[Operator] -->|launches| CLI{CLI args?}
CLI -->|--help/--version/--list-components<br/>--generate-checksums| Help[Print and exit]
CLI -->|--accept-defaults / -y| Accept[Set auto-accept, continue]
CLI -->|--quickstart| Quickstart[Unattended quickstart install]
CLI -->|--validate| Validate[Health checks]
CLI -->|--component X| Single[Install one component]
CLI -->|--non-interactive| Manifest[Install from install-config.json]
CLI -->|none| App[Interactive menu]
App --> Menu{Main menu}
Menu -->|1| Runtime[Runtime & Tooling<br/>dotnet-ef / ASP.NET / VSBuildTools]
Menu -->|2| DB[Database<br/>PostgreSQL + PgBouncer + Server Keys]
Menu -->|3| Web[Web Server<br/>NGINX + LE + Firewall + systemd]
Menu -->|4| Unity[Unity & Build<br/>Unity Hub/Editor + C#/Unity Builds]
Menu -->|5| Cfg[Configuration<br/>AppSettings wizard]
Runtime --> Helper[InstallerProcessHelper<br/>OS-aware exec]
DB --> Helper
DB -->|option 9| Keys[SecurityKeyInstaller<br/>Generates & stores keys in DB]
Keys -->|gate secret / HMAC key / KEK| DBSecrets[(PostgreSQL<br/>deployment_secrets<br/>connection_token_keys)]
Web --> Helper
Unity --> Helper
Helper -->|apt / pacman / dnf / winget / choco| OS[(Host OS)]
Cfg -->|writes| Settings[(appsettings.json)]
Cfg -->|writes| Secrets[(fishmmo-secrets.env<br/>DB creds + web server settings only)]
Unity -->|FishMMO Dashboard > Game Settings| ClientFiles[(ClientApiSecret.generated.cs<br/>CertificatePins.generated.cs<br/>HostConfig.generated.cs)]
Manifest --> PreFlight[Pre-flight checks]
PreFlight --> Orchestrator[InstallOrchestrator]
Orchestrator -->|ordered| Components[Components installed<br/>in dependency order]
Components --> Verify[Post-install validation]
License
See the main FishMMO repository for license information.
Repair or configure local PgBouncer
For the local Linux installation, a single command configures the installed service using the existing application credentials (no database password changes):
sudo python3 /path/to/FishMMO-Dev/FishMMO-Installer/scripts/configure-local-pgbouncer.py --apply
Replace /path/to/FishMMO-Dev with the checkout location. Run without --apply
to list the planned runtime configuration changes. This requires the existing
/etc/fishmmo/db-secrets.env and the packaged pgbouncer account/service. It verifies application
access to PostgreSQL on 5432, installs loopback PgBouncer on 6432, and tests
application authentication and SELECT 1 before changing runtime settings. On a
failed service/connection test it restores the previous PgBouncer files.
After success it updates development templates, Unity's working-directory
appsettings.Development.json, and existing .NET runtime output configurations —
except the Discord bot's: its verification listener holds a LISTEN, which
transaction pooling drops, so the bot always connects to PostgreSQL on 5432.
When local peer authentication allows it, the tool copies the existing SCRAM
verifier. Otherwise it uses the existing application password from the secrets file
in the pgbouncer-owned 0600 auth file. Both modes authenticate with SCRAM; no
PostgreSQL administrator password or database role changes are required.
Production templates, installer settings and migration settings stay unchanged.
Runtime configuration backups are private under /var/backups/fishmmo-pgbouncer.
Restart any running applications afterward. Explicit environment port overrides
still take precedence: runtime processes should use FISHMMO_DB_PORT=6432, while
migration/admin processes should use 5432. Binaries published outside these known
output directories need their runtime settings updated separately.
To configure manually or use auth_query instead:
Build the installer, then authenticate sudo in your terminal before opening it:
sudo -v
dotnet run --project FishMMO-Installer/FishMMO-Installer.csproj
From the FishMMO-Installer directory, choose Database (2) → Configure PgBouncer (8).
Enter the PostgreSQL superuser credentials and select backend port 5432 (or the
actual PostgreSQL port). This port is independent of the runtime application port;
never point the backend at PgBouncer's own listener, 6432. Choose Y for
auth_query, or N to copy the application's current SCRAM verifier.
The systemd service logs to the journal, so no manually created log or PID directory
is needed. Auth-query mode stores only the lookup role's password in
/etc/pgbouncer/userlist.txt, owned by pgbouncer with mode 0600. Reconfiguration
rotates that password and updates the file, repairing roles created by older
installers that discarded the password. It does not change application passwords.
The installer retains one-time configuration backups and checks the service restart.
If application database credentials are available through DatabaseSecrets, it also
connects through PgBouncer and runs SELECT 1; otherwise it reports that this test
still needs to be performed.
Before switching runtime connections, verify with your actual database and role:
psql -h 127.0.0.1 -p 6432 -U fishmmo -d fishmmo -c 'SELECT 1'
After that succeeds, set FISHMMO_DB_PORT=6432 in the environment of runtime
servers, or update their Npgsql port settings. An existing environment variable or
/etc/fishmmo/db-secrets.env port override can take precedence over JSON. Keep
migrations and administrative connections on PostgreSQL's direct port. Restart
runtime processes to pick up their new connection settings. PostgreSQL remains
on 5432; configuring PgBouncer does not automatically switch running applications.
If the service or connection test fails, inspect:
sudo systemctl status pgbouncer --no-pager
sudo journalctl -u pgbouncer -n 50 --no-pager
Linux game-server TLS deployment
Web Server → 2 first asks which ACME challenge to use:
- DNS through the Porkbun API (default). Enter the root domain; the certificate covers
example.comand*.example.com. The first run asks for a Porkbun API key and secret (create them at https://porkbun.com/account/api with DNS permission, and turn on API Access for the domain under Domain Management → Details). They are stored root-only in/etc/letsencrypt/fishmmo-porkbun.ini; later runs offer to reuse them. The hook,/etc/letsencrypt/fishmmo-porkbun-hook.py(source:FishMMO-Installer/Resources/porkbun-dns-hook.py, Python standard library only), creates the_acme-challengeTXT record, waits withdiguntil every Porkbun nameserver serves it, and deletes it afterwards. Certbot stores the hook commands in the renewal configuration, so renewals are unattended. It needs no nginx and no open port 80. - HTTP on port 80. List every host name; nginx must already serve
/.well-known/acme-challenge/from the web root.
Both issue with --reuse-key: release clients pin the certificate's public key, and a new key at each renewal would lock them out.
The action then deploys the certificate to
/etc/fishmmo/certs/fullchain.pem and /etc/fishmmo/certs/privkey.pem, matching the
LoginServer, WorldServer and SceneServer configuration defaults. It prompts for
an existing OS account that runs the game servers and adds it to fishmmo-certs.
Start a new login session (or restart the service) to acquire that membership.
Other game-server accounts must also belong to this group. Directories are
root-owned and group-accessible (0750); certificate and key files are 0640.
The private key is never made readable to all users. If the directory held a
local development certificate, its marker is removed so the development action
can never overwrite the real certificate.
A root-owned Certbot deploy hook at
/etc/letsencrypt/renewal-hooks/deploy/fishmmo-certificates validates that the
certificate is unexpired and matches the key, then publishes both through an
atomic current symlink switch. Unrelated certificate renewals are ignored.
Previous release directories remain available for recovery. The installer enables
certbot.timer or certbot-renew.timer when supplied by the distribution;
otherwise it installs a twice-daily fishmmo-certbot-renew.timer. Successful renewal
also tests and reloads nginx when it is active. Restart running game servers
after renewal, since WebTransport loads its certificates at startup; the hook
does not interrupt running game sessions automatically.
It does not issue localhost development certificates. Selecting Let's Encrypt staging still produces an untrusted test certificate. Running the updated installer is required to deploy these changes on an existing machine; rebuilding a Unity server alone does not install host certificates.
Local development certificates (Linux)
Choose Web Server → 6: Install/Renew Local Development Certificates, or run
FishMMO-Installer --component dev-certificates. This requires OpenSSL and sudo;
it does not require nginx, public DNS, port forwarding, or Let's Encrypt.
Choose the OS account that runs the game servers (for example jim). Choose Y
when asked to trust the development CA if you want native clients on this machine
to connect. The trust decision is local to this machine; other client machines
need the public CA certificate imported separately. This component is deliberately
excluded from --component all.
The action creates a persistent, root-only local CA in /etc/fishmmo/dev-ca/ and
issues an ECDSA P-256 leaf certificate valid for 13 days with SANs for localhost,
127.0.0.1, and ::1. It installs the certificate and key at the existing server
configuration paths /etc/fishmmo/certs/fullchain.pem and
/etc/fishmmo/certs/privkey.pem, with group access for the selected server account.
It refuses to overwrite unmanaged/production certificates or a production renewal
hook. No certificate validation is disabled. No Unity server rebuild is needed.
Start a new login session, then restart Unity and running game servers so they receive the new group membership and certificates. Keep the API/WebGL local HTTP settings; this certificate action does not reconfigure nginx or web servers.
For WebGL, supply the printed SHA-256 fingerprint via the client's
WebTransport.SetServerCertificateHashes(...) before connecting. It is the leaf
certificate's DER hash, not the API SPKI pin from the Dashboard's Certificate
Pins section. The fingerprint is also saved to
/etc/fishmmo/certs/server-certificate.sha256. Browser certificate hashes must be
provided even if you trusted the local CA on the host. The installer does not yet
automatically inject this fingerprint into WebGL builds.
Rerun the same action before the 13-day certificate expires, restart servers, and
update WebGL hashes after rotation. The CA is retained so native clients do not
need to trust a new CA each time. Previous leaf releases are retained for recovery.
The public CA is /etc/fishmmo/certs/development-ca.crt; never copy the CA private
key or the server private key to clients.
For testing generation without sudo or system changes, the source script supports
bash FishMMO-Installer/Resources/InstallDevelopmentCertificates.sh --generate-only /tmp/fishmmo-dev-certs-test.