Skip to content

Commit

Permalink
Improve dockerfile and documentation (#11)
Browse files Browse the repository at this point in the history
* Optimize Dockerfile commands
* Add Cluster Token generation guide
* Add rollback example images
* Bump version to 0.3.0
  • Loading branch information
mathielo authored Oct 19, 2018
1 parent d22aa44 commit 9dc0c85
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 25 deletions.
11 changes: 1 addition & 10 deletions DSTClusterConfig/cluster_token.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
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:GenerateClusterToken()

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.
YourClusterTokenGoesHere-SeeTheDocs!=~
33 changes: 24 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,39 @@ FROM debian:latest

MAINTAINER Caio Mathielo <[email protected]>

# Install required packages
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get install -y curl lib32gcc1 lib32stdc++6 libcurl4-gnutls-dev:i386 && apt-get clean
LABEL \
description="Don't Starve Together dedicated server" \
source="https://github.com/mathielo/dst-dedicated-server"

# Create specific user to run DST server
RUN useradd -ms /bin/bash/ dst
USER dst
WORKDIR /home/dst

# Install Steam CMD (https://developer.valvesoftware.com/wiki/SteamCMD#Downloading_SteamCMD)
RUN curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
RUN mkdir -p server_dst/mods
# Install required packages
RUN set -x && \
dpkg --add-architecture i386 && \
apt-get update && apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget ca-certificates lib32gcc1 lib32stdc++6 libcurl4-gnutls-dev:i386 && \
# Download Steam CMD (https://developer.valvesoftware.com/wiki/SteamCMD#Downloading_SteamCMD)
wget -q -O - "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf - && \
chown -R dst:dst ./ && \
# Cleanup
apt-get autoremove --purge -y wget && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER dst
RUN mkdir -p .klei/DoNotStarveTogether server_dst/mods

# Install Don't Starve Together
RUN ./steamcmd.sh +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +login anonymous +force_install_dir /home/dst/server_dst +app_update 343050 validate +quit
RUN ./steamcmd.sh \
+@ShutdownOnFailedCommand 1 \
+@NoPromptForPassword 1 \
+login anonymous \
+force_install_dir /home/dst/server_dst \
+app_update 343050 validate \
+quit

VOLUME ["/home/dst/.klei/DoNotStarveTogether", "/home/dst/server_dst/mods"]

COPY ["start-container-server.sh", "/home/dst/"]

ENTRYPOINT ["/home/dst/start-container-server.sh"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ See more info in [Managing the Server](./docs/ManagingTheServer.md).

## Generate `cluster_token.txt`

:warning: The cluster token is stored in the `cluster_token.txt` file and without it **your server won't run**.
:warning: The cluster token is stored in the `DSTClusterConfig/cluster_token.txt` file and without it **your server won't run**.

Check instructions on how to get your token in [`cluster_token.txt`](./DSTClusterConfig/cluster_token.txt). 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.
Check the [detailed instructions to generate a cluster token](./docs/ClusterToken.md). 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:

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3'
services:
dst_caves:
container_name: dst_caves
image: mathielo/dst-dedicated-server:0.2.0
image: mathielo/dst-dedicated-server:0.3.0
ports:
- 10998:10998/udp
networks:
Expand All @@ -17,7 +17,7 @@ services:

dst_master:
container_name: dst_master
image: mathielo/dst-dedicated-server:0.2.0
image: mathielo/dst-dedicated-server:0.3.0
networks:
- dst_cluster
ports:
Expand Down
41 changes: 41 additions & 0 deletions docs/ClusterToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Cluster Token Generation

_The definitive guide on how to generate a cluster token for your Don't Starve Together dedicated server._

There are two main ways a cluster token can be generated. While both ways are in-game (you need to launch the game client), one is done via typing in a console command, while the other is done via GUI.

For this project, the `cluster_token.txt` file is located in `DSTClusterConfig/cluster_token.txt`.

> :closed_lock_with_key: This file **must** be generated based on your Steam account. 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.
## Via console command

Enter the game and press "Play". After you're logged in, bring up the console (by pressing `~`) and type the following command:

TheNet:GenerateClusterToken()

Press enter. The console will go away, and a `cluster_token.txt` was generated in:
- Unix: `~/.klei/DoNotStarveTogether`
- Windows: `C:\Users\<username>\Documents\Klei\DoNotStarveTogether`

Get the generated file and **override** `DSTClusterConfig/cluster_token.txt` with it.

## Via "Account" interface

Open the game and press "Play".

![Play](./img/cluster_token_1.jpg)

On the bottom left of the screen, click "Account". This will bring up information about your Klei Account.

![Account](./img/cluster_token_2.jpg)

You'll see your account information along with a list of all the Cluster Tokens your account ever generated in any way (console command, hosting a local server, etc).

![Account](./img/cluster_token_3.jpg)

Scroll to the bottom and you'll see a "Generate Server Token" button. You can add a "friendly name" for it so you can remember what it was created for.

![Account](./img/cluster_token_4.jpg)

The newly generated token will show up in the list along with the name you gave it. Open `DSTClusterConfig/cluster_token.txt`, **erase** it completely and paste the token in the file. Make sure to not leave any extra spaces or blank lines.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ These are the minimum required steps to have a server running:
* [Install Docker](/../../#install-docker)
* Setup the server
* [Server files](/../../#prepare-the-dedicated-server) (clone this repository)
* [Generate `cluster_token.txt`](/../../#generate-cluster_tokentxt)
* [Generate `cluster_token.txt`](./ClusterToken.md)
* [Manage the server](./ManagingTheServer.md) (how to start, save and stop)
* [Basic settings setup](/../../#the-server) (server name, password, etc.)

Expand All @@ -20,7 +20,7 @@ Enhance your server by customizing it to your liking!
* Customize your server
* [Tweak server settings](/../../#the-server) (game mode, max players, Steam Group, description, etc.)
* [World Settings](/../../#the-world) (World Size, Seasons, Difficulty, etc)
* [Install Mods](/../../DSTClusterConfig/mods)
* [Install Mods](../DSTClusterConfig/mods)
* [Set Admins, Bans and Whitelisted Players](./AdminBanWhitelist.md)
* How to optimize your [DST Server Performance](./ServerPerformance.md)

Binary file added docs/img/cluster_token_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/cluster_token_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/cluster_token_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/cluster_token_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rollback_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rollback_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rollback_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9dc0c85

Please sign in to comment.