Don't Starve Together

Don't Starve Together

Not enough ratings
DST Dedicated Server Guide for all platforms (Linux, Mac, Windows) with Docker
By dread3ddie
Get a Don't Starve Together Dedicated Server up and running in few easy steps. All you need is to install Docker and do some minimal setup.
   
Award
Favorite
Favorited
Unfavorite
Outdated NOTICE
While this project is constantly being maintained and improved, it's quite tricky to keep the Steam guide up-to-date with the latest improvements for several reasons.

It's strongly recommended to refer to the documentation on the project's GitHub Repository[github.com] as it will always have the latest docs and improvements.
Intro / Motivation
There are several great guides on how to setup dedicated servers for each specific platform, and I’ve used them many times. When I was about to setup a dedicated server for myself from scratch for the 4th time, however, I decided to invest some more time instead and work on a reusable easy setup solution.

The goal was to have a platform-agnostic solution (something that runs in Linux, MacOS or Windows just the same) that would require only a few simple steps to get a proper server up and running. And by “proper” I mean a manageable server with Caves that supports Mods and customization, of course.

The solution was developed using Docker and I’ve been playing on the server for a while quite happy with the result. I hope this project can help other people get started fairly fast and easily, having plenty of time to customize and play!

Please reach me out if come across any troubles while setting this up. Any feedback is deeply appreciated. See the source on GitHub[github.com] with the full docs.

Have fun! :D
Setup Overview
The following are the macro steps that are required to get the dedicated server up and running:
  • Pick a host machine
  • Install the required tools:
    - Docker
    - Git (optional)
  • Get the server files
  • Set your Cluster Token
By completing the above you'll have a fully working server with caves ready to play! However it will obviously be running on default server and world configurations, no mods at all.

You'll probably want to take some extra steps to:
  • Configure the server properties
  • Customize world generation
  • Install and customize mods
Pick a host machine
As mentioned, Docker runs on Windows, Mac OS X and several Linux distributions. Therefore you may pick the platform you like the best and feel comfortable with.

Things to have in mind when selecting your host:
  • Have an exclusive machine to host the server to make sure resources will be promptly available to the server
    - You may of course host and play on the same machine. Just make sure you have the proper resources available!
  • One free CPU core per shard is recommended (2 in total, Master + Caves)
  • At least 1Gb RAM available per shard, + RAM for the running host OS.
    - 2Gb should suffice for a server with only a few players (4 or less).
    - 4Gb is the optimal for over 4 players
  • A "lightweight" Linux distribution is recommended to host for performance gains. Suggested distro: Debian 9

Instructions will be focused on Unix-based systems (Linux / Mac OS X). They should be fairly easy to adapt to Windows.
Install the required tools
Docker - Linux

Follow the official docs to install Docker on Linux. At first glance it might seem complicated, but the instructions are very detailed and thorough:

Docker - Mac / Windows

You only need the Docker desktop standalone[docs.docker.com] as it has everything you need, no extra steps required. Voilà!

Git (optional)

If you want to install git to fetch the server files, it's super easy to install it in any OS[git-scm.com].
In most Linux distros all you need is:
sudo apt-get install git
Get the server files
If you installed Git, clone this repository in your home folder:

Alternatively you may simply download the zipped files from GitHub directly, then upload and extract it to your home folder.

Set your Cluster Token
The cluster token is stored in the cluster_token.txt file and without it your server won't run online. If you intend to run a LAN only server, you don't need this step.

There are a few ways to generate and get a cluster token. You may follow what's in the existing cluster_token.txt file:
This file MUST be generated based on your Steam account. Enter the game and press "Play". After you're logged in, bring up the console (by pressing `~`) and type the following command: TheNet:GenerateServerToken() Press enter. The console will go away, and a `cluster_token.txt` was generated in: - Unix: ~/.klei/DoNotStarveTogether - Windows: C:\Users\<your name>\Documents\Klei\DoNotStarveTogether Get the generated file and OVERRIDE this one with the proper cluster token.
After you get it, make sure to delete everything from this file and leave only your cluster token there, without any spaces or anything else.

You can easily do that replacing `InsertYourTokenHere` in the following command and executing it in your server:

echo 'InsertYourTokenHere' > ~/dst-dedicated-server/DSTClusterConfig/cluster_token.txt

Game Admin
The account that generates the token automatically gains admin access in-game, meaning you can rollback, regenerate the world or use console commands while playing.
Managing your server (start, stop, commands)
For simplicity of the `docker-compose` commands listed below, make sure you'll be running them from within the installation folder:
cd ~/dst-dedicated-server

Full reference can be found in the project's documentation[github.com].

Updating the game version

The developers are constantly updating the game, which is really good. However if your game client version mismatch the server's, you won't be able to see your server listed in Browse Servers.

To updated the game client, simply stop and start the server again. On every startup the containers updates the game version automatically. Bear in mind this might take a minute or two.

Start the Server

From your installation folder, run docker-compose in detached mode to start the server
docker-compose up -d

Tip: You can follow logs when running in detached mode:
docker-compose logs -f

Executing console commands

It's possible to execute game console commands[dontstarve.wikia.com] from the terminal by attaching to the Master shard:
docker attach dst_master

Caution! Every input will be forwarded to the container when attached. That means if you hit CTRL-c the container will receive SIGINT and will gracefully stop.

It's only possible to attach to the Master shard (dst_master container) as it's the one who manages the slave (Caves shard, dst_caves). i.e. Running c_shutdown() on the Master shard will shutdown all shards, while running it on Caves would shutdown the Caves shard only.

Once attached, you may run any commands to manage the game such as c_save(), c_spanw(), c_regenerateworld(), etc.

To detach from the container, press the CTRL-p CTRL-q sequence. Hitting CTRL-c will stop the running container. Check Docker's attach docs[docs.docker.com] for more info.

Stopping the Server

Saving and shutting down

To save the game right before shutdown, attach to the container and execute c_shutdown():
docker attach dst_master c_shutdown()
The Master shard will manage to save the game and send a shutdown signal to the Caves shard as well.

Alternative: shutdown without saving

If you simply want to shutdown the containers without saving the game:
docker-compose down
Installing Mods + Customizing the server
Please refer to the official docs for detailed information on how to:
Contributing, questions & feedback
All feedback is appreciated! If you have any questions or run into any troubles while setting it up reach me and we'll figure a solution :)

This project is hosted on GitHub[github.com]. Feel free to fork, start a discussion and contribute!
25 Comments
PeachieDude 1 Nov, 2018 @ 3:26am 
Hey @dead3ddie not an specific error.. but it appeared to have an old configuration used for server settings.. not sure.. but when starting it gives some errors that it couldnt find some fiels or so.. like those structures in the end of level config for server cave/overworld file..

sorry if im not precise but i dont remember the problem at all..

Against my will im using the tony one.. i dont like not being able to use docker, which to me is the best way to handle multiple servers than the way he uses.. but im not getting any errors from..

Dont get me wrong, i loved your way to do but his one is better explained and detailed.. the problem with his one is that, again, he doesnt use docker ..
dread3ddie  [author] 1 Nov, 2018 @ 2:01am 
Hey @DkOGameplays sorry for the late reply. It's supposed to work with Forest+Caves right out of the box. Are you getting any specific errors?
PeachieDude 24 Oct, 2018 @ 7:55am 
Hey author.. how to get server+caves running?
ive been reading this for a time and i still not get it using this guide..
This is the best one for me, but, i still dont get it..

Thanks in advance
dread3ddie  [author] 23 Jul, 2018 @ 1:02pm 
@gxziiie no worries. If you create the file directly under "DSTClusterConfig/adminlist.txt" it should be picked up by both shards, Master and Caves. Same goes for DSTClusterConfig/whietlist.txt and DSTClusterConfig/blocklist.txt.
gxziiie 23 Jul, 2018 @ 6:55am 
@dread3ddie sorry to bother you, but I have one more question. where do I add the adminlist.txt? is it even supported. i tried making a save folder in the dstconfig root and adding it. but also in the master and in the cave folder. but none worked
dread3ddie  [author] 17 Jul, 2018 @ 11:37am 
@daddy yiffi The Token can be generated from any game *client*, so you can create it from the computer you'll be playing for instance. You can even generate it from an interface Klei implemented a while ago, without the need to type in the command: https://nodecraft.com/support/games/dont-starve-together/how-to-acquire-a-cluster-token

The important thing to notice is that the token is tied to the *Steam Account* that generated it. So if you create the token, you'll automatically be an admin on your server.
daddy yiffy 16 Jul, 2018 @ 9:21am 
hey, i installed a lite version of raspbian because i thought it might be better, but now im stuck at the part where you have to start the game to create the cluster token, and i dont know how to do that, since i dont have a graphic interface or whats it called
should i start anew without a lite version or do you know a way/alternative?? thanks a lot!
Vân Ca 9 Jul, 2018 @ 12:01am 
@dread3ddie Please update that temporary permission-fix into your guide when you still haven't find a proper fix
gxziiie 1 Jul, 2018 @ 1:57pm 
@dread3ddie Token was also setup. I did a docker-compose pull and after it worked fine. Thank you
dread3ddie  [author] 1 Jul, 2018 @ 1:47pm 
@gxziiie Have you checked the server logs? It could be issues with your cluster token (you’ll see clearly “YOUR SERVER WILL NOT START” in the logs). If it’s not that, maybe your game client got updated so the server needs to fetch the latest game version as well? Try stopping and starting the server again as it fetches latest updates on every start.