Skip to content

edgetools/vrising-server-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

V Rising Server Manager

Windows PowerShell cmdlets for easily managing multiple dedicated V Rising servers on a Windows machine

module main main-auto

Ready to install? Jump to Installation

Features

  • Out-of-box support for PowerShell 5.1+ (which is already included in most modern Windows installations)

  • Start, Stop, Update, and Restart multiple servers with a service-like command interface

  • Automatically update server on startup

  • Servers run in the background so you can close the PowerShell window

  • Search for and customize Game, Host, and Voip settings

  • Read and tail log files

Feature Roadmap

These features will be added in future releases

  • (Coming Soon!) Automatically download and install steamcmd and mcrcu

  • (Coming Soon!) Send system messages to players in-game from the console

  • Automatically send system messages on restart or shutdown

  • Automatically restart servers on a schedule

  • Rotate and archive log files

  • Archive save files

Release Notes

0.7.0 (2022-07-19)

Features

  • show time since last successful update (801d909)
  • allow update to fail on startup (385653a)

Bug Fixes

  • Monitor: prevent command errors from crashing the monitor (c3a1fd5)

Table of Contents

Requirements

Installation

Usage

Concepts

Command Reference

Technical Details

Development

License

Requirements

Requires PowerShell 5.1 or greater

Tip: Check your PowerShell version with $PSVersionTable.PSVersion.ToString()

Tested with:

  • Windows Server 2019
  • Windows 10
  • Windows 11

Note: Other platforms may also work that meet the minimum requirements, but have not been tested.

Installation

Install from PowerShellGallery

Install-Module -Name VRisingServerManager

OR

Install from source

Follow the instructions below for Building from source

Copy the module folder into a supported module path

Usage

Tip: This module never deletes a server installation, game settings, or save data when removing a Server configuration. You may safely delete and re-create or re-import a Server configuration at any time.

Import the module

Before you can run commands, you first must import the module.

Tip: Some module behavior can be temporarily customized using VRisingServerManagerFlags prior to import

Import-Module VRisingServerManager

Set the Default Servers Folder

To make creating servers easier, vrcreate uses the DefaultServersDir to suggest a path for the InstallDir, DataDir, and LogDir.

Tip: If you prefer to put the InstallDir, LogDir, or DataDir in different locations (like separate drives), you can customize specific values for each path during server creation.

vrmset DefaultServersDir 'D:\VRisingServerManager\Servers'

Set the Default Apps Folder

To make managing servers easier, if you don't have steamcmd or mcrcu yet, the module will automatically prompt to download and install them to the DefaultAppsDir.

You can override this path using vrmset:

vrmset DefaultAppsDir 'D:\VRisingServerManager\Apps'

If you already have steamcmd or mcrcu installed, you can use them by setting their paths with vrmset:

vrmset SteamCmdPath 'D:\VRisingServerManager\Apps\steamcmd\steamcmd.exe'
vrmset MCRCUPath 'D:\VRisingServerManager\Apps\mcrcu\mcrcu.exe'

Create or import a Server

Note: This name must be a valid ShortName, and you can also change the InstallDir, DataDir, and LogDir after creation.

To prompt for all required values:

vrcreate

To temporarily override the DefaultServersDir:

vrcreate `
  -ShortName MyServer `
  -ServersDir 'C:\Servers'

To explicitely provide some (or all) values at creation:

vrcreate `
  -ShortName MyServer `
  -DataDir 'C:\Servers\MyServer\Data' `
  -InstallDir 'C:\Servers\MyServer\Install' `
  -LogDir 'C:\Servers\MyServer\Log'

Check Server status

List all Servers

vrget

List a specific Server

vrget MyServer

Update Server

Tip: This can also be used for first-time installation

Update all Servers

vrupdate

Update a specific Server

vrupdate MyServer

Start Server

Start all Servers

vrstart

Start a specific Server

vrstart MyServer

Stop Server

Stop all Servers

vrstop

Stop a specific Server

vrstop MyServer

Restart Server

Restart all Servers

vrrestart

Restart a specific Server

vrrestart MyServer

View Server Logs

There are multiple log types which can be easily read using vrlog, please refer to the command description for a full list of log types.

The most common log type you will read is the log from the dedicated game server, known as the Game log.

The vrlog command defaults to the Game log, so to read the log for a specific server, you can simply type:

vrlog MyServer

You may occasionally need to read other logs, like the logs from the process monitor.

To read a specific log for a specific server, in this example the MonitorError log:

vrlog MyServer MonitorError

To read the last 10 lines of a log and continuously watch the log for new changes, use -Tail and -Follow :

vrlog MyServer Game -Tail 10 -Follow

Send a System Message

Message all Servers

vrsay 'This is a system message'

Message a specific Server

vrsay MyServer 'This is a system message'

Remove Server

Note: to prevent unintentionally removing server data, this does not remove the InstallDir, DataDir, or LogDir which must be manually deleted if you wish to completely uninstall a server installation.

If you accidentally remove a server, you can easily add it again with vrcreate.

Remove all Servers

vrdelete

Remove a specific Server

vrdelete MyServer

Disable Server Monitor

Disabling the server monitor process will cause it to shut down, but will still leave the server process running.

Disable all Server Monitors

vrdisable

Disable a specific Server Monitor

vrdisable MyServer

Enable Server Monitor

Note: The server monitor automatically launches whenever running Server commands.

Enable all Server Monitors

vrenable

Enable a specific Server Monitor

vrenable MyServer

Update Server Manager

Steps to Update to a new version:

  1. Stop (Disable) any running Monitor(s)

    vrdisable
    
    (VRisingServer) [foo] Monitor disabled
  2. Wait for Monitor(s) to Stop, then verify Monitor(s) are "Disabled"

    vrget
    Monitor
    -------
    Disabled
  3. Update the Module

    Update-Module -Name VRisingServerManager
  4. Exit the current PowerShell session

    The module is compiled during import, so you must open a new powershell session after upgrading to ensure the new version is loaded correctly.

    exit
  5. Open a new PowerShell session

  6. Import the Updated Module

    Import-Module VRisingServerManager
  7. Start (Re-Enable) the Monitor(s)

    vrenable
    
    (VRisingServer) [foo] Monitor enabled
    (VRisingServer) [foo] Monitor launched
  8. Verify the Monitor(s) are Running (Idle)

    vrget
    Monitor
    -------
    Idle

Concepts

VRisingServerManagerFlags

Some module behavior can be temporarily customized by settings flags on [hashtable] $VRisingServerManagerFlags prior to import

Supported flags:

  • SkipNewVersionCheck: Disables checking for new package versions when loading the module (see: SkipNewVersionCheck).

Example:

$VRisingServerManagerFlags = @{
    SkipNewVersionCheck = $true
}
Import-Module VRisingServerManager

VRisingServerManagerConfigOption

Some settings for the manager itself can be retrieved or modified using vrmget and vrmset.

These settings are persisted to disk.

SkipNewVersionCheck

Type: boolean

Default: $false

The module will automatically check PowerShellGallery for new versions of the module.

This behavior can be disabled by setting SkipNewVersionCheck to $true

DefaultServersDir

Type: string

Default: D:\VRisingServerManager\Servers

When new servers are created, their InstallDir, DataDir, and LogDir are automatically configured as a subfolder of DefaultServersDir named after their ShortName (e.g. D:\VRisingServers\MyServer)

Example: Set the Default Servers Folder

DefaultAppsDir

Type: string

Default: D:\VRisingServerManager\Apps

If steamcmd or mcrcu are automatically installed, they will be installed to a subfolder of the DefaultAppsDir

Example: Set the Default Apps Folder

Server

The Server represents a single server configuration in the manager. When using vrget, a list of Servers is returned and can be interacted with using its methods and properties.

Server configuration files are stored in C:\ProgramData\edgetools\VRisingServerManager\Servers

ShortName

Type: string

The ShortName is a concise nickname for an individual Server which is used when running various manager commands.

Unlike the DisplayName, the only allowed characters are alphanumeric ( A-Z a-z 0-9 ), dash ( - ), and underscore ( _ )

DisplayName

Type: string

The DisplayName is what players will see when searching for the server online or connecting to it in game.

This is a Host Setting and can be modified using vrset.

InstallDir

Type: string

The InstallDir is where steamcmd will install the V Rising dedicated game server files.

This is a Service Setting and can be modified using vrset.

DataDir

Type: string

The DataDir is where the dedicated game server will store its save files and settings.

This is a Service Setting and can be modified using vrset.

LogDir

Type: string

The LogDir is where log files from the dedicated game server, server updates, and the process monitor will be written.

These files can easily be read using vrlog.

This is a Service Setting and can be modified using vrset.

UpdateOnStartup

Type: boolean

Default: $true

If UpdateOnStartup is enabled, steamcmd will automatically run and install any updates prior to starting or restarting the dedicated game server.

This is a Service Setting and can be modified using vrset.

AnnounceShutdown

Type: boolean

Default: $true

If AnnounceShutdown is enabled, mcrcu will automatically run and announce when the server is being shut down.

If ShutdownDelay is greater than 0, a message will also be sent every minute until shutdown.

This is a Service Setting and can be modified using vrset.

ShutdownDelay

Type: int

Default: 5

ShutdownDelay is the duration in minutes to wait until shutting down the server when receiving a stop or restart command.

If the value is unset or set to 0, the server shuts down immediately.

This is a Service Setting and can be modified using vrset.

Setting

Many settings for the dedicated game server can be retrieved using vrget and modified using vrset.

Host Setting

A Host Setting correlates to a value in ServerHostSettings.json inside the Settings folder of the DataDir.

Game Setting

A Game Setting correlates to a value in ServerGameSettings.json inside the Settings folder of the DataDir.

Voip Setting

A Voip Setting correlates to a value in ServerVoipSettings.json inside the Settings folder of the DataDir.

Service Setting

A Service Setting correlates to a configurable option when running the dedicated game server using this module.

Monitor

The Process Monitors are separate PowerShell sessions which are automatically launched, one for each server, whenever a command is executed.

This allows orchestrating complex features like waiting for the ShutdownDelay and running UpdateOnStartup against multiple servers in parallel, all without blocking the operator from using the console.

Once the monitor is launched, it checks for any commands in the queue, executes them if found, and when it has nothing else to do, then it exits.

Some commands support a -Queue option which allows the command to be queued for execution, which is useful for ensuring a task is still ran even if the monitor is currently busy.

Since it launches steamcmd and the dedicated game server in separate processes, the monitor can exit and the server will keep running.

See Technical Details for more detailed information.

Command Reference

Note: Most commands have convenient aliases, which are automatically configured when importing the module. Command examples will use the alias, when available.

Using ShortName or Server

Most commands can operate against specific server(s), which may be specified as a ShortName or using the Server object.

Using ShortName

When using the -ShortName, pass the name directly to the command:

vrfoo MyServer

Using Server

When using -Server, first store the server in an object using vrget:

$myserver = vrget MyServer

Then pass the object using -Server:

vrfoo -Server $myserver

New-VRisingServer

Alias: vrcreate

vrcreate [ShortName] [OPTIONS]

Creates new Server configuration on the local machine with the specified ShortName, DataDir, InstallDir, and LogDir.

Arguments

  • ShortName: Required. The ShortName to use for the new server.

    Tip: This value will be used when running most commands, so pick something short, concise, and easy to type.

Options

  • -ServersDir: Optional. A directory path to use instead of the DefaultServersDir. This value is used when generating the suggested values for DataDir, InstallDir, and LogDir. Type: string. Example: D:\VRisingServerManager\Servers

  • -DataDir: Optional. A directory path to use for the DataDir instead of the suggested directory. Type: string. Example: D:\VRisingServerManager\Servers\MyServer\Data

  • -InstallDir: Optional. A directory path to use for the InstallDir instead of the suggested directory. Type: string. Example: D:\VRisingServerManager\Servers\MyServer\Install

  • -LogDir: Optional. A directory path to use for the LogDir instead of the suggested directory. Type: string. Example: D:\VRisingServerManager\Servers\MyServer\Log

Examples

Get-VRisingServer

Alias: vrget

For retrieving a Server:

vrget [ShortNames or Servers]

Arguments

Examples

For retrieving a server Setting:

vrget [ShortNames or Servers] [SettingsType] [SettingName]

Arguments

  • ShortNames or Servers: Required. The Server(s) to retrieve specified setting from.

  • SettingsType: Required. The Setting type to retrieve. Example: Host

  • SettingName: Optional. The Setting name to retrieve.

    • If unspecified, all values for the specified setting type will be retrieved.

    • You can use wildcards (*) to search for any setting names matching input.

      Example: vrget MyServer Game *Castle*

Set-VRisingServer

Alias: vrset

Modifies or resets the value of a Setting for specified Server(s).

vrset [ShortNames or Servers] [SettingsType] [SettingName] [SettingValue or Default]

Arguments

  • ShortNames or Servers: Required. The Server(s) to modify specified setting for.

  • SettingsType: Required. The Setting type to modify. Example: Host

  • SettingName: Required. The Setting name to modify. Example: Port

  • SettingValue or -Default: Required. The value to assign to the specified Setting.

    • If the specified value matches the default value, or if -Default is used instead, then any overridden value will be reset back to the default.

      Example: vrset MyServer Host Port -Default

Start-VRisingServer

Alias: vrstart

vrstart [ShortNames or Servers] [OPTIONS]

Starts specified Server(s), including orchestrating UpdateOnStartup, if enabled.

Arguments

Options

  • -Queue: Optional. Adds the command to the Monitor queue even if a command is already running. Type: switch

Examples

Stop-VRisingServer

Alias: vrstop

vrstop [ShortNames or Servers] [OPTIONS]

Stops specified Server(s), including orchestrating AnnounceShutdown and ShutdownDelay, if enabled.

Arguments

Options

  • -Queue: Optional. Adds the command to the Monitor queue even if a command is already running. Type: switch

Examples

Restart-VRisingServer

Alias: vrrestart

vrrestart [ShortNames or Servers] [OPTIONS]

Restarts specified Server(s), including orchestrating AnnounceShutdown, ShutdownDelay, and UpdateOnStartup, if enabled.

Arguments

Options

  • -Queue: Optional. Adds the command to the Monitor queue even if a command is already running. Type: switch

Examples

Update-VRisingServer

Alias: vrupdate

vrupdate [ShortNames or Servers] [OPTIONS]

Updates specified Server(s) using steamcmd.

Arguments

Options

  • -Queue: Optional. Adds the command to the Monitor queue even if a command is already running. Type: switch

Examples

Read-VRisingServerLogs

Alias: vrlog

vrlog [ShortName or Server] [LogType] [OPTIONS]

Reads a specified Server's log file from disk.

Arguments

  • ShortName or Server: Required. The Server to read a log file from.

  • LogType: Optional. The Log type to read. Default: Game

    Log types:

    • Game

      The Game log contains the output from VRisingServer.exe.

    • Update

      The Update log contains the output from steamcmd during the update process.

    • UpdateError

      The UpdateError log contains error output from steamcmd during the update process. This log will typically be empty unless an error occured during an update.

    • Monitor

      The Monitor log contains the output from the process Monitor which orchestrates commands such as starting, stopping, restarting, and updating the server.

    • MonitorError

      The MonitorError log contains error output from the process Monitor. This log will typically be empty unless the monitor crashed.

    • Service

      The Service log contains any standard output from VRisingServer.exe. This log will typically be empty because V Rising sends the log output to the Game log instead.

    • ServiceError

      The Service log contains error output from VRisingServer.exe. This log will typically be empty unless the dedicated server crashes while running, but may still be empty as errors from launching the server are generally printed to the Game log or the MonitorError log.

Options

  • -Tail [LINES]: Optional. Return the last LINES number from the log file. Default: Return all lines.

  • -Follow: Optional. Continue to watch the log file for new output and print it as it arrives. Press Ctrl+C to stop.

Examples

Send-VRisingServerMessage

Alias: vrsay

vrsay [ShortNames or Servers] [Message]

Sends Server(s) a system message using mcrcon.

Arguments

  • ShortNames or Servers: Required. The Server(s) to update.

  • Message: Required. The message to send. Type: string.

Examples

Remove-VRisingServer

Alias: vrdelete

vrdelete [ShortNames or Servers] [OPTIONS]

Removes specified Server configuration(s) from the local machine.

Does not remove the InstallDir, DataDir, or LogDir which must be manually deleted if you wish to completely uninstall a server installation.

Arguments

Options

  • -Force: Optional. Forces removal of config file even if the server is currently running or being orchestrated. Use -Force at your own risk! Type: switch. Default: Unset.

Examples

Disable-VRisingServerMonitor

Alias: vrdisable

vrdisable [ShortNames or Servers]

Disables the server Monitor for specified Server(s).

Arguments

Examples

Enable-VRisingServerMonitor

Alias: vrenable

vrenable [ShortNames or Servers]

Enables the server Monitor for specified Server(s).

Arguments

Examples

Get-VRisingServerManagerConfigOption

Alias: vrmget

vrmset [Option]

Retrieves specified VRisingServerManagerConfigOption value from the local machine.

Arguments

Set-VRisingServerManagerConfigOption

Alias: vrmset

vrmset [Option] [Value]

Modifies the value for specified VRisingServerManagerConfigOption.

Arguments

Examples

Technical Details

VRising Server Manager orchestrates a series of process-tiers to monitor and manage each server.

The primary process tier is the interactive powershell process used when running Import-VRisingServerManager. In this process, the user can query and interact with multiple servers at once. Commands issued to servers are ran asynchronously by the secondary tier.

The secondary process tier contains the background processes used to asynchronously carry out commands against each server (known as 'Monitors'). One Monitor is launched per configured server. It polls the server configuration looking for a command to run, and processes the command if found.

The third-tier processes are the dedicated game server process and the update process (steamcmd). These processes are launched and monitored by the second tier.

Orchestrating the server processes involves issuing a command from the first tier, which sets the active command for the second tier. The secondary tier then reads this command, and orchestrates any actions against its resources, including starting or stopping any third tier processes, as needed.

Because the third and second tier processes are launched in the background, the user can safely close the interactive powershell window and the third and second tiers will continue running. New powershell sessions can discover the processes in the second and third tiers by reading the configuration file from disk where the process information is kept.

Configuration for servers is stored in json files in the ProgramData directory, which allows multiple instances of the manager to concurrently query and update server information such as the running process ID.

These configuration files are multi-process thread-safe across the application, with writes protected using named mutexes. This allows the use of automation to run manager commands from multiple sources without worrying about corrupting the state.

Server settings such as Host, Game, and Voip parameters are loaded from disk, converted into PSObjects, and combined with both their default values and any per-server overrides. Writes are then converted back to json on disk.

Development

Build Requirements

Building from source

  1. Build the module

    Invoke-Psake
    
  2. Add the repository root directory to your PSModulePath so that Import-Module VRisingServerManager can resolve successfully.

    Note: This assumes the current working directory is the repository root.

    $env:PSModulePath = "$($(pwd).Path);${env:PSModulePath}"
    

License

see LICENSE.txt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published