Skip to content
/ dst Public
forked from ryansheehan/dst

docker setup for Dont Starve Together

License

Notifications You must be signed in to change notification settings

colakuma/dst

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dst

Docker setup for Dont Starve Together dedicated server including caves!

To play caves please make sure you opt-in to the Don't Starve Together beta via steam

Setup docker on server

These instructions assume a debian based server, please skip to the volume instructions if you already have docker installed on your machine.

For ubuntu installation click here

For anything else

Setup data volume on server

  1. Create a volume directory
    $HOME/
        dstvolumes/
           master/
           slave/
    
  2. Add server token

    Copy server_token.txt into dstvolumes/master and dstvolumes/slave

    $HOME/
        dstvolumes/
           master/
               server_token.txt
           slave/
               server_token.txt
    
  3. Add master settings

    Create settings.ini for dstvolumes/master

    NOTE: settings file is different than the slave's settings.ini

    $HOME/
        dstvolumes/
           master/
               server_token.txt
               settings.ini
           slave/
               server_token.txt
    
  4. Add slave settings

    Create settings.ini for dstvolumes/slave

    NOTE: settings file is different than the master's settings.ini

    $HOME/
        dstvolumes/
           master/
               server_token.txt
               settings.ini
           slave/
               server_token.txt
               settings.ini
    
  5. Configure caves world

    Create worldgenoverride.lua in dstvolumes/slave

    $HOME/
        dstvolumes/
           master/
               server_token.txt
               settings.ini
           slave/
               server_token.txt
               settings.ini
               worldgenoverride.lua
    
  6. Create docker-compose.yml in dstvolumes/ NOTE: only needed if intending to use docker-compose to launch servers

    $HOME/
        dstvolumes/
           docker-compose.yml
           master/
               server_token.txt
               settings.ini
           slave/
               server_token.txt
               settings.ini
               worldgenoverride.lua
    
  7. Launch dst dedicated servers

    with docker-compose

    1. Install docker-compose on your server

    2. Navigate to volumes folder and run docker-compose

      cd $HOME/dstvolumes
      sudo docker-compose up

    with docker-engine

    1. Start the master server

      sudo docker run -it --name="dst" -p 10999:10999/udp -v $HOME/dstvolumes/master:/home/steam/.klei/DoNotStarveTogether ryshe/dst
    2. After the master server is done booting up, detatch from master server by pressing ctrl+p ctrl+q

    3. Start the slave server linked to the master server

      sudo docker run -it --name="dstslave" -p 10998:10998/udp -v $HOME/dstvolumes/slave:/home/steam/.klei/DoNotStarveTogether --link dst:master ryshe/dst
    4. After the slave server is done booting up, detatch from slave server by pressing ctrl+p ctrl+q

  8. Find the container name running the master

    sudo docker ps -a

    It will look something like:

    -if running from docker-compose: dstvolumes_dst_1 -if running from docker-engine: dst

  9. Attach back on to the master server so that we can regenerate the world

    In order to generate cave entrances we need to regenerate the world

    sudo docker attach <container_name_from_last_step>
  10. Invoke the world to regenerate in order to get caves entrances

NOTE: you should be connected to the server and able to see output when you type

c_regenerateworld()
  1. Detatch from your server with ctrl+p ctrl+q
  2. Enjoy your dedicated server! Do not forget to opt into the beta on your DST client in steam, or you wont see your server!

Getting latest updates from steam; just restart the servers

  • with docker-compose

    shell sudo docker-compose restart
  • with docker-engine

    sudo docker restart dst
    sudo docker restart dstslave

Mods support

NOTE: This is experimental

  1. Create a new folder to act as a volume for the mods
    cd $HOME
    mkdir dstmods
    cd dstmods
    touch mods.txt
  2. Edit dstmods/mods.txt
  3. Add the additional volume to the containers
    • with docker-compose
      1. Edit docker-compose.yml
      2. Under both volumes: blocks add $HOME/dstmods:/mods
    • with docker-engine add an additional -v $HOME/dstmods:/mods to both docker run commands

Generate server token

  1. Run the Don't Starve Together client located in your steam library
  2. Press ~ key to open the console in game
  3. Enter TheNet:GenerateServerToken() which will generate a server_token.txt file
    • Linux: located in ~/.klei/DoNotStarveTogether
    • Windows: located in C:\Users<your name>\Documents\Klei\DoNotStarveTogether Go back

Master settings

Use your favorite text editor and create a file "settings.ini". Fill it with the following contents.

Go back

[network]

default_server_name = My DST Server with caves
default_server_description = We have caves!

;must be unique per server in cluster
server_port = 10999

;change this password
server_password = password123
max_players = 4
pvp = false
game_mode = survival
enable_snapshots = false
enable_autosaver = true
tick_rate = 30
connection_timeout = 10000
server_save_slot = 1
pause_when_empty = true
dedicated_lan_server = false
server_intention = cooperative


[shard]

;required true for shard features
shard_enable = true
is_master = true

;required for slave
master_ip = 127.0.0.1

;do not touch
master_port = 10888
bind_ip = 0.0.0.0

;change to whatever, helpful in logs
shard_name = master

;change the cluster key to something unique
cluster_key = secret_cluster_key


[MISC]
CONSOLE_ENABLED = true
autocompiler_enabled = true

Change to your preference:

  1. default_server_name
  2. default_server_description
  3. cluster_key
  4. server_password or remove it for public server
  5. do not change master_port
  6. any other configuration option that you wish

Slave settings

Use your favorite text editor and create a file "settings.ini". Fill it with the following contents.

Go back

[network]

default_server_name = My DST Server with caves
default_server_description = We have caves!

;must be unique per server in cluster
server_port = 10998

;change this password
server_password = password123
max_players = 4
pvp = false
game_mode = survival
enable_snapshots = false
enable_autosaver = true
tick_rate = 30
connection_timeout = 10000
server_save_slot = 1
pause_when_empty = true
dedicated_lan_server = false
server_intention = cooperative


[shard]

;required true for shard features
shard_enable = true
is_master = false

;required for slave will get auto set by scripts
master_ip = 127.0.0.1

;do not touch
master_port = 10888
bind_ip = 0.0.0.0

;change to whatever, helpful in logs
shard_name = slave

;change the cluster key to something unique
cluster_key = secret_cluster_key


[MISC]
CONSOLE_ENABLED = true
autocompiler_enabled = true
  1. cluster_key must match the server's settings.ini cluster_key value
  2. DO NOT CHANGE master_port

Create caves world

save as worldgenoverride.lua

Go back

return {
override_enabled = true,
preset="DST_CAVE",
}

Create docker-compose

Go back

dstslave:
  image: ryshe/dst:latest
  ports:
    - 10998:10998/udp
  restart: always
  links:
    - dst:master
  volumes:
    - ./slave:/home/steam/.klei/DoNotStarveTogether

dst:
  image: ryshe/dst:latest  
  ports:
    - 10999:10999/udp
  restart: always
  volumes:
    - ./master:/home/steam/.klei/DoNotStarveTogether

Build server container from Dockerfile

sudo apt-get install -y git
cd ~
git clone https://github.com/ryansheehan/dst.git
cd dst
sudo docker build -t <container_name_here> .

Additional Help/Links/Sources

About

docker setup for Dont Starve Together

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 95.6%
  • Lua 4.4%