Archived

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.

Lucidi0us

6 level server with independent seasons

Recommended Posts

Lucidi0us    1

I wanted to share this since it took me a lot of effort to get it all working.


This is my configuration for an Ubuntu server, running as a service.  It has 1 master with 5 shards.  4 of the shards are stuck on each a different season with the 5th shard being caves used to interconnect them all.

I followed the normal Linux dedicated server guides already available to get the basic "with caves" server going.  Here is what I worked out from there:

Note:  I didn't keep track of where some of the original components came from because I wasn't intending to share when I began.  (systemd script and sh script I modified, various forums I had to dredge to find all the small details, etc).  I did heavily comment in many of these files to help anyone trying to poke around.

So far, this setup has been working pretty well for me.

 

Portals

Master (overworld)

2-way portals = 6x to Caves
1-way portals = 1x to Autumn, 1x to Spring, 1x to Summer, 1x to Winter

Caves (caves *srug*)

2-way portals = 6x to Master, 1x to Autumn, 1x to Spring, 1x to Summer, 1x to Winter

 

Spring (overworld)

2-way portals = 1x to Caves, 2x to Winter, 2x to Summer

1-way portals = 1x to Caves, 1x to Autumn, 1x to Summer, 1x to Winter

 

Summer (overworld) 

2-way portals = 1x to Caves, 2x to Spring, 2x to Autumn

1-way portals = 1x to Caves, 1x to Spring, 1x to Autumn, 1x to Winter

 

Autumn (overworld) 

2-way portals = 1x to Caves, 2x to Winter, 2x to Summer

1-way portals = 1x to Caves, 1x to Spring, 1x to Summer, 1x to Winter

 

Winter (overworld) 

2-way portals = 1x to Caves, 2x to Autumn, 2x to Spring

1-way portals = 1x to Caves, 1x to Spring, 1x to Summer, 1x to Autumn


dedicated_server_mods_setup.lua

--Desynchronize Shards
ServerModSetup("1396615817")

-- Shard Configuration Mod
ServerModSetup("595764362")

I modified this Systemd script I found somewhere

## /etc/systemd/system/dontstarve.service 
[Unit]
Description=Don't Starve Together Dedicated Server
Wants=network-online.target
After=network.target network-online.target

[Service]
ExecStart=/home/steam/run_dontstarve_dedicated.sh
Restart=on-failure
User=dontstarve

[Install]
WantedBy=multi-user.target

# Security and Sandboxing
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
ProtectSystem=strict
ProtectHome=read-only
SystemCallFilter=~@mount
ReadWritePaths=$HOME/dontstarve
ReadWritePaths=$HOME/Steam
ReadWritePaths=$HOME/.steam
ReadWritePaths=$HOME
ReadWritePaths=$HOME/.klei

I modified this 'run_dont_starve_dedicated.sh' file I found somewhere
 

#!/bin/bash

steamcmd_dir="$HOME"                                    # Location of steamcmd binary
install_dir="$HOME/dontstarve"                          # Where you installed dst using force_install_dir in steamcmd
cluster_name="MyClusterName"                                # The name of your cluster's folder in DoNotStarveTogether dir
dontstarve_dir="$HOME/.klei/DoNotStarveTogether"        # Path to Klie/DoNotStarveTogether directory containing cluster data

# Fail on errors

function fail()
{
        echo Error: "$@" >&2
        exit 1
}

# Used to check if important things exists.

function check_for_file()
{
    if [ ! -e "$1" ]; then
            fail "Missing file: $1"
    fi
}

# For each shard, add: check_for_file "/path/to/shard's/server.ini"

check_for_file "$HOME/steamcmd"
check_for_file "$dontstarve_dir/$cluster_name/cluster.ini"
check_for_file "$dontstarve_dir/$cluster_name/cluster_token.txt"
check_for_file "$dontstarve_dir/$cluster_name/Master/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Caves/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Spring/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Summer/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Autumn/server.ini"
check_for_file "$dontstarve_dir/$cluster_name/Winter/server.ini"
check_for_file "$install_dir/bin"

# Launch steam and check for updates
#$HOME/steamcmd +force_install_dir "$install_dir" +login anonymous +app_update 343050 validate +quit

# Setup command to start master / shards
run_shared=($install_dir/bin/dontstarve_dedicated_server_nullrenderer)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)

# Change working directory to prevent errors finding things
cd ${install_dir}/bin

# Start shards using run_shared for each shard

"${run_shared[@]}" -shard Caves | sed 's/^/Caves: /' &
"${run_shared[@]}" -shard Spring  | sed 's/^/Spring:  /' &
"${run_shared[@]}" -shard Summer  | sed 's/^/Summer:  /' &
"${run_shared[@]}" -shard Autumn  | sed 's/^/Autumn:  /' &
"${run_shared[@]}" -shard Winter  | sed 's/^/Winter:  /' &

# Sleep seems to help with errors if the master waits for the shards to get
# rolling when there are several shards

sleep 30

# Start Master
"${run_shared[@]}" -shard Master  | sed 's/^/Master:  /'


Caves/server.ini

[NETWORK]
server_port = 11001


[SHARD]
is_master = false
name = Caves
id = 2


[STEAM]
master_server_port = 27002
authentication_port = 8762


[ACCOUNT]
encode_user_path = true

Master/server.ini

[NETWORK]
server_port = 11000


[SHARD]
is_master = true
id = 1


[STEAM]
master_server_port = 27001
authentication_port = 8761


[ACCOUNT]
encode_user_path = true


Autumn/server.ini

[NETWORK]
server_port = 11012


[SHARD]
is_master = false
name = Autumn
id = 12


[STEAM]
master_server_port = 27012
authentication_port = 8772


[ACCOUNT]
encode_user_path = true

Spring/server.ini 

[NETWORK]
server_port = 11010


[SHARD]
is_master = false
name = Spring
id = 10


[STEAM]
master_server_port = 27010
authentication_port = 8770


[ACCOUNT]
encode_user_path = true

Summer/server.ini 

[NETWORK]
server_port = 11011


[SHARD]
is_master = false
name = Summer
id = 11


[STEAM]
master_server_port = 27011
authentication_port = 8771


[ACCOUNT]
encode_user_path = true

Winter/server.ini 

[NETWORK]
server_port = 11013


[SHARD]
is_master = false
name = Winter
id = 13


[STEAM]
master_server_port = 27013
authentication_port = 8773


[ACCOUNT]
encode_user_path = true

cluster.ini 

[GAMEPLAY]
game_mode = endless
max_players = 16
pvp = false
pause_when_empty = true


[NETWORK]
cluster_description = Description Text
cluster_name = Cluster Name is Server Name in Browser
cluster_intention = social
cluster_password = 
autosaver_enabled = true


[MISC]
console_enabled = true
vote_enabled = false

[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10889
cluster_key = SomethingUnique

modoverrides.lua for shards only

return {
-- Shard Configuration Mod
["workshop-595764362"] = { enabled = true },
-- Desynchronize shards
["workshop-1396615817"] = { enabled = true }
}

modoverrides.lua for master only

return {
-- Desynchronize shards
["workshop-1396615817"] = { enabled = true },
-- Shard Configuration Mod portal setup
["workshop-595764362"] =
        {
                enabled = true,
                configuration_options =
                        {
                        -- 1 = master | 2 = caves | 10 = spring | 11 = summer | 12 = autumn | 13 = winter
                        ["Connections"] =
                                {
                                        ["1"] = { "2", "2", "2", "2", "2", "2" },
                                        ["2"] = { "1", "1",  "1",  "1",  "1", "1", "10", "11",  "12", "13" },
                                        ["10"] = { "2", "13", "13", "11", "11" },
                                        ["11"] = { "2", "10", "10", "12", "12" },
                                        ["12"] = { "2", "11", "11", "13", "13" },
                                        ["13"] = { "2", "12", "12", "10", "10" }
                                },

                        ["OneWayConnections"] =
                                {
                                        ["1"] = { "10", "11", "12", "13" },
                                        ["10"] = { "2", "11", "12", "13" },
                                        ["11"] = { "10", "2", "12", "13" },
                                        ["12"] = { "10", "11", "2", "13" },
                                        ["13"] = { "10", "11", "12", "2" }
                                }
                        }
        }
}


caves worldgenoverride.lua

return {
        override_enabled = true,
        preset = "DST_CAVE",                            -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS"
        overrides = {
                -- MISC
                task_set = "cave_default",              -- "classic", "default", "cave_default"
                start_location = "caves",             -- "caves", "default", "plus", "darkness"
                world_size = "huge",                    -- "small", "medium", "default", "huge"
        },
}

Winter shard worldgenoverride.lua

return {
        override_enabled = true,
        preset = "SURVIVAL_TOGETHER",                   -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS"
        overrides = {
                autumn = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                winter = "verylongseason",              -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                spring = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                summer = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                season_start = "winter",                -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random"
        },
}

 

Spring shard worldgenoverride.lua
 

return {
        override_enabled = true,
        preset = "SURVIVAL_TOGETHER",                   -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS"
        overrides = {
                autumn = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                winter = "noseason",              -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                spring = "verylongseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                summer = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                season_start = "spring",                -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random"
        },
}

Summer shard worldgenoverride.lua

return {
        override_enabled = true,
        preset = "SURVIVAL_TOGETHER",                   -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS"
        overrides = {
                autumn = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                winter = "noseason",              -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                spring = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                summer = "verylongseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                season_start = "summer",                -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random"
        },
}

Autumn shard worldgenoverride.lua

return {
        override_enabled = true,
        preset = "SURVIVAL_TOGETHER",                   -- "SURVIVAL_TOGETHER", "MOD_MISSING", "SURVIVAL_TOGETHER_CLASSIC", "SURVIVAL_DEFAULT_PLUS", "COMPLETE_DARKNESS", "DST_CAVE", "DST_CAVE_PLUS"
        overrides = {
                autumn = "verylongseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                winter = "noseason",              -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                spring = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                summer = "noseason",                    -- "noseason", "veryshortseason", "shortseason", "default", "longseason", "verylongseason", "random"
                season_start = "autumn",                -- "default", "winter", "spring", "summer", "autumnorspring", "winterorsummer", "random"
        },
}

Additional tips

Monitor logs from all shards in cluster with this command from the cluster folder
 

watch "tail ./*/server_log.txt"

When implementing desynchronize shards mod, you may need to enter console commands manually or delete your saves and reload your server to get it working.  I left a discussion item mentioning this on the steam workshop page for the mod since the author didn't explain in any verbosity.

Share this post


Link to post
Share on other sites
Lucidi0us    1

my update script:

/usr/local/bin/dontstarve_update

#!/bin/bash

# Stop DST servers
/bin/systemctl stop dontstarve.service;

# Copy current dedicated_server_mods_setup.lua to backup
/bin/cat /home/steam/dontstarve/mods/dedicated_server_mods_setup.lua > /home/steam/backup_dedicated_server_mods_setup.lua;

# Update DST
/home/steam/steamcmd +force_install_dir "$install_dir" +login anonymous +app_update 343050 validate +quit;

# Restore dedicated_server_mods_setup.lua from backup
/bin/cat /home/steam/backup_dedicated_server_mods_setup.lua > /home/steam/dontstarve/mods/dedicated_server_mods_setup.lua;

# Start DST servers
/bin/systemctl start dontstarve.service;

# Leave happy
exit 0;

crontab entry

0 3 * * 1 /usr/local/bin/dontstarve_update > /dev/null 2>&1 –

 

Share this post


Link to post
Share on other sites