dread3ddie Posted November 22, 2017 Share Posted November 22, 2017 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. The following are the instructions as they were posted on the Steam Guide. The most complete, detailed and up-to-date instructions will be found in the project's repository documentation on GitHub. 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 1. Pick a host machine Spoiler 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 2. Install the required tools Docker - Linux Spoiler 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 Engine CE Docker Compose Make sure to read through and follow the post-installation steps for Linux (quite important!) - Enable your user to manage `docker` without the need of `sudo` - Configure Docker to start on boot Docker - Mac / Windows You only need the Docker desktop standalone as it has everything you need, no extra steps required. Voilà! Git (optional) Spoiler If you want to install git to fetch the server files, it's super easy to install it in any OS. In most Linux distros all you need is: sudo apt-get install git 3. Get the server files Spoiler If you installed Git, clone this repository in your home folder: cd ~ && git clone https://github.com/mathielo/dst-dedicated-server.git Alternatively you may simply download the zipped files from GitHub directly, then upload and extract it to your home folder. 4. Set your Cluster Token Spoiler 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 all the content 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. Updating the game version Spoiler 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 Spoiler 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 Spoiler It's possible to execute game console commands 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-cthe 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 allshards, 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. Quote 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 for more info. Stopping the Server Spoiler 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: Customize your Server and World generation Install and configure Mods Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.