dstserver
Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
- Puppet >= 4.10.0 < 7.0.0
- , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'qroac-dstserver', '0.1.2'
Learn more about managing modules with a PuppetfileDocumentation
dstserver
A module to manage a set of server instances for Don't Starve Together on your machines.
Important Note
This module was built and tested for my debian and ubuntu machines, but I don't see a reason, why it shouldn't work on redhat/centos as well.
It hasn't been tested there yet, so if you run it on a RPM based machine, for your constructive feedback I'd be very appreciated.
Table of Contents
- Description
- Setup - The basics of getting started with dstserver
- Usage - Configuration options and additional functionality
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Description
This module manages Dont Starve Together servers on your server, generating worldgen-configs, modoverride settings and mod install lists based on each nodes configuration.
However, it is for now limited to a classic setup consisting of one Overworld (master) and (optional) one Cave shard per instance.
For each shard it further installs a SystemD service script to start and stop the server process.
There is also an update script that can be run as root to update the DST installation on your server.
Setup
Setup Requirements
For each instance, you need to obtain a server token during your Klei account at https://accounts.klei.com/account/game/servers?game=DontStarveTogether.
You will need to provide the token in the later configuration.
You don't need to get creative at this point, all settings including the servername will be set by the actual server configuration on your server.
Further this module depends on tamerz-steamcmd for installation of SteamCMD.
Beginning with dstserver
For a quickstart with dstserver, be sure to obtain a token for your server as noted in Setup Requirements.
In your node definition, include the dstserver class passing in your server token for the default server:
class {'dstserver': token => 'Your-Token-Goes-Here' }
Important Note: This is only for quickstart and demo purpose. Passing the token like this will globally override the token for all DST server instances on this node. See usage below to propper configure your DST server.
The example above will perform the following steps on your node:
- Install SteamCMD
- Create a system user
server-dst
and home directory/srv/dst
- Install DST dedicated server at
/srv/dst/app
- Place the install and update script in
/srv/dst/bin
- Configure a default server instance in
/srv/dst/.klei/DoNotStarveTogether/default
- Place SystemD scripts for master and caves, ensuring they are enabled and running
Usage
As shown above, you can include dstserver in your node definition using the class syntax. This enables you to directly pass your custom configuration to the module:
class { 'dstserver':
ensure => present,
user => 'server-dst',
homedir => '/srv/dst',
instances => [
... Array containing hashes of instance configuration, see Configuration section below
],
}
However, you can leave the class attributes to the default values provided or set them using hiera (see data/common.yaml as example).
If your instances are configured this way, you can just include dstserver to your node:
include dstserver
Node Configuration Parameters
To set the parameters with hiera, just prefix them with dstserver::
, e.g. dstserver::instances:
Option | Default | Description |
---|---|---|
ensure | present | present install dstserver on node absent remove dstserver from node, ensure to set all instances to absent in a previous run, to ensure all systemd services are removed |
user | server-dst | Username for the system user running DST |
homedir | /srv/dst | Home directory for the system user holding DST installation and server profiles |
instances | see data/common.yaml | Hash with configuration for multiple DST server instances, see below |
Instance Configuration Parameters
Pass a hash of hashes containing the following fields to the dstserver class statement or set the configuration in your hiera data as shown in data/common.yaml
One hash in the config hash per instance, key is the system name (used for foldername and servicename), values hold the specific configuration.
dstserver::instances:
default:
servername: My DST Server
description: Are you able to survive the first winter?
mode: survival
intention: cooperative
token: your-server-token-from-klei-goes-here
players: 5
the-easy:
servername: My easy Server
description: Again and again ...
mode: endless
intention: social
token: your-server-token-from-klei-goes-here
players: 10
Instance configuration options in alphabetical order, required parameters are bold:
Option | Default | Description |
---|---|---|
autosave | true |
Automatically save the world after midnight |
caves | false |
Create and run an instance of the caves for this server instance |
clusterkey | 'dst' |
Cluster internal key for authenticating the shards inside the cluster |
console | true |
Enable or disable the server console |
description | '' |
Description of your server for the public server list |
ensure | 'present' |
present: create and configure and run the server instance absent: remove the server instance from the node |
intention | 'social' |
Play style intention on your server. Choose from: social, cooperative, competetive, madness |
mode | 'survival' |
Server mode of this instance. Choose from survival, wilderness, endless |
mods | undef |
Configuration of Mods for this instance, see section Mod Config below |
pause | true |
Enable or disable automatic pause when there are no players on the server |
password | '' |
Password to join the server |
players | 5 |
Amount of players that could join simultanously |
pvp | false |
Enable or disable PVP |
servername | $name |
Name of the server in the serverlist. Defaults to the key in the instance list (e.g. default, the-easy) |
startport | 11031 |
First port to use for cluster and shards. Will consume 7 ports in total. E.g. from 11031 to 11037 |
token | Your klei server token for this server instance, see Setup Requirements | |
vote_kick | true |
Enable or disable voting to kick players |
worldgenoverrides | undef |
Overrides for world generation, see section Worldgenoverride Config below |
Mod Config
For each instance you can provide a list of mods.
This will generate a serverwide list of required mod ids to be installed upon restart of an instance. This way it is ensured, that mods get updated everytime an instance is restarted.
To include a mod, list its ID in the mods hash with the desired activation state as value. true
downloads the mod and activates it on this instance, false
downloads the mod but leaves it as disabled in the instances modoverride.lua config.
To provide further custom configuration for a mod, you can use a subhash containing the fields enabled
(true or false, as before) and config (containing a text block with the configuration to write into modoverride.lua).
This example shows both ways. Just including and activatting mods and including one with additional configuration.
mods:
# Minimap HUD
345692228: false
# Combined Status
376333686: true
# Ultimate Starting Item Tuner
1627929571:
enabled: true
# Additional configuration for the mod
config: |
ShouldOverrideMod=false,
ShouldOverrideVanila=false,
Data = {
["AllPlayers"] = {
["respawnnight"] = {
"torch"
},
[""] = {
"backpack"
}
}
}
Worldgenoverride Config
You can set Worldgenoverride settings for Overworld and Cave Shards providing a configuration hash if intended.
worldgenoverrides:
master:
enabled: true
preset: SURVIVAL_TOGETHER
overrides:
world_size: huge
caves:
enabled: true
preset: DST_CAVE_PLUS
Use enabled
to turn the overrides on or off and preset
to choose an official worldgen preset for your new instance.
overrides
is just a hash with key-value pairs to list in the overrides-object of the worldgenoverride file.
For available presets and a list of possible overrides, please refer to the documentation in the dst wiki
Limitations
You cannot deploy fancy setups, e.g. with multiple Overworld-Cave Shards in the same setup. For most server setups it should be sufficient, though.
Further, this module was created on and for debian/ubuntu machines. I don't see a reason why it shouldn't work on Redhad, but lack of a redhat server and time to set it up I didn't verify that yet. So if you use this on redhat/centos and it works (or not), please let me know ;)
Development
This module was created based on the needs for my own private dst server setup.
It is my first puppet module and I code on it in my spare time.
Please use the issue tracker to report bugs with concrete examples how to reproduce the problem.
You could also submit feature requests, but because I do this in my spare time I can not guarantee to implement them.
Furthermore I appreciate Pull Requests for bugfixes and new features including:
- a detailled description on the change
- for bugfixes: what problem is solved (scenario / issue #)
- for features: why / what for the new feature is needed
- corrections and additions in the documentation as needed
Reference
Table of Contents
Classes
Public Classes
dstserver
: Install, configure and run DST server instances
Private Classes
dstserver::setup
: Create the dstserver system user and required directories in its home location. Ensure, SteamCMD is available, place install and update scripts and install DST via SteamCMD. Place required systemd service units in the system folder.
Defined types
Public Defined types
Private Defined types
dstserver::config::modoverride
: Generates modgenoverride configuration for servershards to set mods on enabled or disabled and provide custom mod configuration where defined.dstserver::config::worldgenoverride
: Create a worldgenoverride for a server shard if configureddstserver::entity::caves
: Configure the cave shard of an instance and manage its systemd servicedstserver::entity::cluster
: Configure a DST server cluster that can run several DST server shardsdstserver::entity::master
: Configure the master shard of an instance and manage its systemd servicedstserver::instance
: Configure one cluster instance of DST and manage the sytemd service to ensure it is up and running
Classes
dstserver
Install, configure and run DST server instances
Examples
with configuration data from hiera
include dstserver
with inline configuration
class { 'dstserver':
instances => {
my-dst-server => {
servername => 'My First Server',
token => 'token-from-klei',
},
my-second-server => {
servername => 'My Second Server',
token => 'another-token-from-klei',
},
}
}
Parameters
The following parameters are available in the dstserver
class.
user
Data type: String
Username for the dstserver system user
homedir
Data type: String
Home directory for the system user and install location for all DST related data
instances
Data type: Hash
Instances of DST servers to be configured and started. Each key is used as resourcename for one instance, the values refer to the parameters for dstserver::instance (except path).
ensure
Data type: Enum['present', 'absent']
Ensure DST is installed and running, or removed from the node
Default value: present
token
Data type: Optional[String]
Klei server instance token. Use only for demo purpose with the default demo instance because it overrides the token value for all instances. In production, set the token along with the configuration for each instance.
Defined types
Changelog
All notable changes to this project will be documented in this file.
Release 0.1.2
Bugfixes
- Fix error for instances just configured as absent and having no token
- Fix wrong filename for modoverrides.lua shard config file
- Fix lua syntax errors in modoverrides.lua shard config file
Features
- Restart server shards on change of instance or cluster config files
Release 0.1.1
Bugfixes
- Improve code quality according to Forge Code Quality Score
- Fix parameter table for instance parameters in README
Release 0.1.0
Features
- Install dstserver on your nodes
- Run multiple dstserver instaces with mods and worldgenoverrides
- Runs DST as systemd services
Bugfixes
Known Issues
Dependencies
- tamerz-steamcmd (>= 0.1.2 < 1.0.0)