Server Host Droplet

The serverhost droplet is one of our first and most important droplets. It is responsible for configuring and managing minecraft servers.

Understanding the serverhost droplet

It's not that hard to understand the serverhost droplet. It is a simple droplet that is responsible for starting and managing minecraft servers. The nice thing about it is that it is very flexible and can be configured to work with any kind of server. It is also very easy to scale and can be installed on multiple machines.

This droplet is an implementation of our serverhost api. You don't have to use this droplet to start and manage servers, but you have to use some kind of implementation of the serverhost api.

Multi-Root installation

The serverhost droplet is designed to be installed on multiple machines. This is called a multi-root installation. This means that you can have multiple serverhost droplets running on different machines, all connected to our controller.

To set up a multi-root installation you need to install our CLI on the machine you want to install the serverhost droplet on.

After you have installed the cli, you can run the following command to install the serverhost droplet:

# Install the serverhost droplet
simplecloud install droplet serverhost

Online server check

The online server checker is a new concept where we check if a server is online or not. This is done by sending a ping request to the Minecraft server and checking if it responds. It's very useful because this makes it possible for the droplet to know if a server is online and should be registered, or if it is offline and should be removed.

Additionally, the online server checker ensures that we don't need a plugin running on the Minecraft server, so you can basically use any kind of server; it just needs to respond to the ping request.

Needed group properties

The serverhost droplet needs some dynamic properties to work. For a group to start, the user has to provide every property that do not have a default value.

IDDescriptionUser providedDefault value
server-urlsets the server URLYesN/A
configuratorsets the configuratorYesN/A
forwarding-secretused in the velocity configuratorNosecure secret set by the controller
max-startup-secondssets the maximum time a server can take to start upYes120
template-idthe template used by the serverYesthe groups name (generated if not present)

Server versions

Server versions in the classic v2 sense don't exist anymore. Servers are now just started using the server URL and a server configurator. Both server URL and server configurator are required, if the needed dynamic group properties are not set in the group configuration, a server of this group will not start.

Server URL

The server URL is nothing more than a simple download link to the wanted minecraft server jar. In fact, it can be any link you want. The serverhost droplet will try to download and execute it using user specified options. You can set the server URL through the server-url dynamic group property.

Configurator

A server Configurator is a YML-file that provides information needed for a minecraft server to work with the cloud. In most cases, it is responsible for setting the maximum players, port, online and forwarding mode of the server. It is executed after the server template was copied to a new server. After it finishes executing, the server is started. When defining a Configurator, you can use placeholders for any controller or dynamic property using this syntax: %property-name%. Configurators are located in the options/configurators directory. If you want, you can create your own or modify existing ones. To assign a configurator to a server, you need to set the dynamic group property configurator to the configurator id. The configurator id is equivalent to the configurator file name without the file extension (e.g. velocity.yml -> velocity)

Configurator Examples

# A list of all configuration files
paths:
      # The path to the configuration file
    - path: "velocity.toml"
      # The type of the configuration file (valid are TXT, PROPERTIES, TOML, YML, JSON)
      type: "TOML"
      # The data object
      data:
        bind: "%ip%:%port%"
        show-max-players: %max-players%
        forwarding-secret-file: "forwarding.secret"
        player-info-forwarding-mode: "MODERN"
      # The path to the configuration file
    - path: "forwarding.secret"
      # The type of the configuration file (valid are TXT, PROPERTIES, TOML, YML, JSON)
      type: "TXT"
      # The data object
      data: "%forwarding-secret%"

Server options

For each server group, a YML-file is created in the options directory. This file provides configuration for the java start command of this group. There are also options to change the directory where started servers are stored in, and you can make the droplet instance ignore the server group.

default.yml

# start arguments
jvm:
    executable: C:\Program Files\Java\jdk-17.0.5\bin\java
    options: [-Xms%MIN_MEMORY%M, -Xmx%MAX_MEMORY%M, -Dcom.mojang.eula.agree=true,
        -jar]
    arguments: [nogui]
# whether the group is ignored by the serverhost droplet
ignore: false
# path to a custom running/temp directory for this group
parentDir: null

You can configure this file freely. The jvm configuration section is then parsed to a shell command and executed.

[executable] [options] [server runtime file] [arguments]

This also means that you can change the executable, arguments and options freely for each server group. You can also use any group property. Property placeholders follow this syntax: %PROPERTY_NAME%

Crash handling

There are two types of crashes that can happen:

  1. The serverhost droplet crashes
  2. A minecraft server crashes

Serverhost droplet crash

If the serverhost droplet crashes, you have to restart it manually. What's really cool is that the managed Minecraft servers will continue to run, even if the serverhost droplet is not running. After a restart, this droplet will automatically detect all running servers and reattach to them.

This also means that you can restart the serverhost droplet without any downtime for the managed Minecraft servers, so you can update the droplet without any problems.

Minecraft server crash

If a minecraft server crashes, the serverhost droplet will automatically inform the controller about the crash and the controller will start a new server, if needed.

Tech-Stack

These are the technologies used by the Serverhost droplet:

Was this page helpful?