Jump to content

Dedicated Server Quick Setup Guide - Linux


Recommended Posts

@Capi Etheriel

  • only UDP is used for gameplay traffic, AFAIK
  • opening just 1 port will not allow for caves to be used
  • what's in you client_log.txt when it fails to connect? Just timeout, or something else?
  • If you can get it to work when everything's open, check the output of lsof -P -i4UDP to see what sockets are being used
  • Wait, cluster.ini? That's not where the gameplay port is configured. The master port is used for communication between shards (forest, caves, etc). Gaemplay port that players use is configured individually for each shard, in server.ini.
Edited by myxal
Link to comment
Share on other sites

Hellow,

I runned a DST dedicated server  on a Google Platform.

It's Works, with my favorites mods and good latency.
The server is configured to pause partie when no players is connected.

But when i leave ssh console and when players is connected or not, it's shutdown after at least 30min without log or explanation.
I must launch it again, an again, an again... or keep console open.

So what's going on ?
It's normal ?
It's a disconnect from Klei server ?

------------- LOGS
steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ ps -ef | grep dont
steam    22504 22478 15 14:26 pts/0    00:03:07 ./dontstarve_dedicated_server_nullrenderer -cluster Cluster_1 -shard Caves
steam    22506 22478 15 14:26 pts/0    00:03:06 ./dontstarve_dedicated_server_nullrenderer -cluster Cluster_1 -shard Master

steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ tail Master/server_log.txt 
[00:00:50]: Validating portal[6] <-> 402724459[6] (disabled)
[00:00:50]: Validating portal[9] <-> 402724459[9] (disabled)
[00:00:50]: Validating portal[7] <-> 402724459[7] (disabled)
[00:00:50]: Validating portal[1] <-> 402724459[1] (active)
[00:00:50]: Validating portal[3] <-> 402724459[3] (disabled)
[00:00:50]: Validating portal[2] <-> 402724459[2] (disabled)
[00:00:50]: Validating portal[4] <-> 402724459[4] (active)
[00:00:50]: Validating portal[8] <-> 402724459[8] (disabled)
[00:00:50]: Validating portal[5] <-> 402724459[5] (disabled)
[00:00:57]: Registering master server in Sing lobby

steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ tail Caves/server_log.txt 
[00:00:50]: Validating portal[4] <-> 1[4] (active)
[00:00:50]: Validating portal[5] <-> 1[5] (active)
[00:00:50]: Validating portal[6] <-> 1[6] (active)
[00:00:50]: Validating portal[9] <-> 1[9] (active)
[00:00:51]: [Shard] secondary shard LUA is now ready!
[00:00:51]: Sim paused
[00:05:48]: Registering secondary shard in Sing lobby
[00:10:48]: Registering secondary shard in Sing lobby
[00:15:48]: Registering secondary shard in Sing lobby
[00:20:48]: Registering secondary shard in Sing lobby
[00:25:48]: Registering secondary shard in Sing lobby


------------- CONFIGURATION
steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ cat cluster.ini 
[GAMEPLAY]
game_mode = endless
max_players = 20
pvp = false
pause_when_empty = true
[NETWORK]
cluster_description = Serveur de XXXXXXX
cluster_name = PlebeDST
cluster_intention = cooperative
cluster_password = XXXXXXXXXXX
[MISC]
console_enabled = true
[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10889
cluster_key = supersecretkey

steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ cat Master/server.ini 
[ACCOUNT]
encode_user_path = true
[NETWORK]
server_port = 11000
[SHARD]
is_master = true
[STEAM]
master_server_port = 27018
authentication_port = 8768

steam@dst-2:~/.klei/DoNotStarveTogether/Cluster_1$ cat Caves/server.ini 
[NETWORK]
server_port = 11001
[SHARD]
is_master = false
name = Caves
id = 402724459
[STEAM]
master_server_port = 27019
authentication_port = 8769
[ACCOUNT]
encode_user_path = true 

Link to comment
Share on other sites

Hello.
I follow your actions and finally start the script. It tells me there is no token here, but I've downloaded the token from the klei website and uploaded it. Could you tell me the reason for this?
Thank you.

My operating system is CentOS 7.

Snipaste_2020-09-15_13-32-40.png

Snipaste_2020-09-15_13-35-03.png

Snipaste_2020-09-15_20-08-42.png

Link to comment
Share on other sites

@Vksir post the whole log file. Possible things to check:

  • Is the file readable by the user executing the server?
  • Are you executing the server on the correct cluster directory?
  • Did you paste the token in an editor that automatically adds a newline at the end of a file?
Link to comment
Share on other sites

Update: 2020.09.28

Solution found.

Just too little RAM.

One Server needs 500M to run, but my cloud Server only have 800M, so one cannot establish two Server(one for Master, one for Cave).

I use 4G swap part to resolve the problem.

 

 

-------------------------------------------------------------------------------------------------------------------------------

I'm trying to open Server for both Master and Caves in Ubuntu, but failed.

 

./dontstarve_dedicated_server_nullrenderer -console -cluster Cluster_5 -shard Master
./dontstarve_dedicated_server_nullrenderer -console -cluster Cluster_5 -shard Caves

 

If I just open Master Server (just the first line above), no problem and I can play with it.

But if I then try to open Caves Server (second line above) in the same machine, it always stops at:

 

Klump files loaded:    0

    Unload FE

    Unload FE donehttps://forums.kleientertainment.com/applications/core/interface/file/attachment.php?id=284908

    LOAD BE

 

Please read the attached log file. "server_log.txt"

 

(I just found that I've post the problem in the wrong place, sorry:

)

 

Edited by verymerry
Link to comment
Share on other sites

Why aren't the dedicated server settings I make in the client saved? For example, I just turn off winter. But the server starts up with a default setting

Link to comment
Share on other sites

1 hour ago, aresd said:

Why aren't the dedicated server settings I make in the client saved? For example, I just turn off winter. But the server starts up with a default setting

I don't understand this. How do you "make dedicated server settings in the client"?

Link to comment
Share on other sites

2 hours ago, myxal said:

I don't understand this. How do you "make dedicated server settings in the client"?

just create a server directly from the game. I copy the settings to the folder with the dedicated server. But the problem has already been resolved. Server settings are defaulted if I save the modified template. If you do not do this, then the server is created with the necessary settings.

Link to comment
Share on other sites

On 2/16/2016 at 5:52 PM, 255 said:

This guide will help you set up a dedicated server on an Ubuntu machine (32 or 64-bit)

1. Install dependencies: 

  Reveal hidden contents

For a 64-bit machine: sudo apt-get install libstdc++6:i386 libgcc1:i386 libcurl4-gnutls-dev:i386

For a 32-bit machine: sudo apt-get install libstdc++6 libgcc1 libcurl4-gnutls-dev

2. Install steamcmd.

  Reveal hidden contents

Download and install steamcmd by following the instructions here: https://developer.valvesoftware.com/wiki/SteamCMD#Linux . This guide will assume that you have installed steamcmd to ~/steamcmd/ . You can skip the part about creating a new user if you wish.

A shortened version of the necessary commands:

mkdir -p ~/steamcmd/
cd ~/steamcmd/
wget "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz"
tar -xvzf steamcmd_linux.tar.gz

3. Configure and download the server settings

  Reveal hidden contents

3a. Start Don't Starve Together from Steam and click on the "Play!" button.

  Reveal hidden contents

2_title.png

3b. Click on the "Account" button.

  Reveal hidden contents

main_menu_account_button.jpg

3c. On the accounts page, visit the “GAMES” page, then click the “Don’t Starve Together Servers” button.

  Reveal hidden contents

accounts_games_servertoken2.jpg

3d. If you don’t have any server yet, please click the “ADD NEW SERVER” button. If you have a valid server, click the green “CONFIGURE” button. Expired servers are colored in red and should be deleted.

  Reveal hidden contents

add_new_server.jpg

3e. In the “Configure Server” page you will find a form with some options that you can edit to customize your server. Once you are ready, click the “Download Settings” button. Download the Zip archive, extract the content, and place the folder “MyDediServer” inside ~/.klei/DoNotStarveTogether/.

  Reveal hidden contents

configure_server.jpg

4. Create the script that will run the servers.

  Reveal hidden contents

Download this shell script and move it to ~/run_dedicated_servers.sh.

5. Give the script executable permissions

  Reveal hidden contents

In a terminal, run: chmod u+x ~/run_dedicated_servers.sh

6. Run the script to start the dedicated servers:

  Reveal hidden contents

In a terminal, run: ~/run_dedicated_servers.sh

hello, i folowed this tutorial in my EC2 instance on AWS, but no success.

I think it's because of the Script

Please help me to fix.

All tutorial steps has been executed successfully, except when i ran the script.


My terminal output.

ubuntu $ . run_dedicated_servers.sh 

Error: Missing file: /home/ubuntu/dontstarvetogether_dedicated_server/bin

 

My directory structure:

ubtuntu $ ls -la

total 76

drwxr-xr-x 12 ubuntu ubuntu 4096 Oct 26 19:45 .

drwxr-xr-x  3 root   root   4096 Oct 12 17:39 ..

-rw-------  1 ubuntu ubuntu 7396 Oct 26 19:45 .bash_history

-rw-r--r--  1 ubuntu ubuntu  220 Feb 25  2020 .bash_logout

-rw-r--r--  1 ubuntu ubuntu 3771 Feb 25  2020 .bashrc

drwx------  3 ubuntu ubuntu 4096 Oct 15 23:50 .cache

drwx------  4 ubuntu ubuntu 4096 Oct 15 23:44 .config

drwxrwxr-x  3 ubuntu ubuntu 4096 Oct 26 19:00 .klei

drwxrwxr-x  3 ubuntu ubuntu 4096 Oct 12 18:15 .local

drwxrwxr-x  5 ubuntu ubuntu 4096 Oct 25 14:34 .npm

-rw-r--r--  1 ubuntu ubuntu  807 Feb 25  2020 .profile

drwx------  2 ubuntu ubuntu 4096 Oct 12 17:39 .ssh

-rw-r--r--  1 ubuntu ubuntu    0 Oct 12 17:41 .sudo_as_admin_successful

drwxrwxr-x  5 ubuntu ubuntu 4096 Oct 22 15:30 .vscode-server

-rw-rw-r--  1 ubuntu ubuntu  340 Oct 26 19:02 .wget-hsts

drwxrwxr-x  4 ubuntu ubuntu 4096 Oct 15 23:37 dev

-rwxrwxr-x  1 ubuntu ubuntu 1097 Oct 26 19:16 run_dedicated_servers.sh

drwxr-xr-x  3 ubuntu ubuntu 4096 Oct 12 17:57 snap

drwxrwxr-x  3 ubuntu ubuntu 4096 Oct 26 19:12 steamcmd

Link to comment
Share on other sites

@json_gbriel I'm not too familiar with the original guide or AWS EC2 - your ls output suggests the dedicated server app didn't get installed. Wasn't there something else in the script output besides the missing bin directory?

The script references ./steamcmd.sh but there's no such script in your directory. No idea where you're supposed to get this. The command syntax in the script suggests it's the normal steamcmd executable.

Link to comment
Share on other sites

how to use multi core of the cpu like Intel core i7 or use the navidia GPU to make the game run better? I use the top command in linux and find out the dedicate server only use one core of cpu in the same time. That make player feel stutters. How can I deal with it. Is there any extra dependence package can make it better? Thank you for any reply.

Link to comment
Share on other sites

4 hours ago, Fengying said:

how to use multi core of the cpu like Intel core i7 or use the navidia GPU to make the game run better? I use the top command in linux and find out the dedicate server only use one core of cpu in the same time. That make player feel stutters. How can I deal with it. Is there any extra dependence package can make it better? Thank you for any reply.

My first advice to you - before changing anything in the game, try disabling mods. There are plenty of them that cause poor performance. And I don't mean just server mods, even client-side mods and their combinations can overload the server (always-updated minimap + global positions or map sharing, for example). An i7 definitely shouldn't struggle to run the game on defaults. (Unless it's one of those macbook/chromebook "i7"s, which is about as powerful as a decent smartphone).

There's not much you can set or change in the stock game, other than maybe decrease tick rate. Being bound to single core is a limitation of LUA, not much can be done about that. GPU is completely useless to a dedicated server.

Beyond the stock game, there's an unofficial patch that upgrades the built-in LUA engine, producing decent speedup: https://github.com/paintdream/DontStarveLuaJIT Back up your clusters, and use at you own risk.

 

Edited by myxal
Link to comment
Share on other sites

13 hours ago, myxal said:

My first advice to you - before changing anything in the game, try disabling mods. There are plenty of them that cause poor performance. And I don't mean just server mods, even client-side mods and their combinations can overload the server (always-updated minimap + global positions or map sharing, for example). An i7 definitely shouldn't struggle to run the game on defaults. (Unless it's one of those macbook/chromebook "i7"s, which is about as powerful as a decent smartphone).

There's not much you can set or change in the stock game, other than maybe decrease tick rate. Being bound to single core is a limitation of LUA, not much can be done about that. GPU is completely useless to a dedicated server.

Beyond the stock game, there's an unofficial patch that upgrades the built-in LUA engine, producing decent speedup: https://github.com/paintdream/DontStarveLuaJIT Back up your clusters, and use at you own risk.

 

Thank you for your reply. In fact I really use a lot of server mods. And I know that's why the server is slow down. But some of us players love the items of those mods so I can't just shut them down. I tried to rewrite some of them to make the codes easily however it doesn't work as good as I expected. I heard of the luaJIT, but don't know that can do it. Thanks for your advice and hoping klei can add multi core support in some day.

Link to comment
Share on other sites

1 hour ago, Fengying said:

But some of us players love the items of those mods so I can't just shut them down

To elaborate on the mods issue - I don't use many mods that add new items, but I don't think simply adding more in-game items has a significant impact on performance (the more common issue when adding items is running out of graphics memory). Stuttering and lagging can be caused by just 1 or 2 misbehaving mods. For example, the Insight mod recently became popular, so I swapped ShowMe (origin) for that mod, only to find that my server would randomly start stuttering (the mod has since been updated, not sure if the issue persists as I went back to ShowMe before the performance fix landed in Insight).

Unfortunately, I'm not aware of any way to determine what is causing the slowdown other than trial and error. Rollbacks are a thing, backups are pretty easy (I usually just bump max_snapshots to 25, gives me enough time to experiment with the world without losing the most recent "proper gameplay" snapshot).

Link to comment
Share on other sites

On 10/30/2020 at 4:50 PM, myxal said:

To elaborate on the mods issue - I don't use many mods that add new items, but I don't think simply adding more in-game items has a significant impact on performance (the more common issue when adding items is running out of graphics memory). Stuttering and lagging can be caused by just 1 or 2 misbehaving mods. For example, the Insight mod recently became popular, so I swapped ShowMe (origin) for that mod, only to find that my server would randomly start stuttering (the mod has since been updated, not sure if the issue persists as I went back to ShowMe before the performance fix landed in Insight).

Unfortunately, I'm not aware of any way to determine what is causing the slowdown other than trial and error. Rollbacks are a thing, backups are pretty easy (I usually just bump max_snapshots to 25, gives me enough time to experiment with the world without losing the most recent "proper gameplay" snapshot).

Thank you. I have read part of code of the mod which I think slow my server down and find out they use a lot of code like IF ELSE and FOR WHILE and also Eventhandles. Although the eventhandles might run in another thread but as I know all of the DST server thread is working in the same progress. So maybe they still make my server slower. I tried to regenworld  and split the landform from mods to different worlds, and it works well for now .By the way, could you please tell me how to change the max_snapshots? I haven't find any variable look like to mean it in the official code.

Link to comment
Share on other sites

Hello, i've just followed the entire process and it worked perfectly (the world have been showed on my DST multiplayer list and these things), but i decided to quit and restart it just for test if it's all was working well, and after do it and run the command

 ~/run_dedicated_servers.sh

the server doesn't run properly and shuts down by itself, what can i be doing wrong?

 

Terminal log (a few last lines because i don't know how to copy it all, sorry):

Spoiler

Caves:  [00:01:05]: setting     season  autumn
Caves:  [00:01:05]: setting     cavemoonphase   new
Caves:  [00:01:05]: setting     moonphase       new
Caves:  [00:01:05]: [Shard] Secondary shard is waiting for LUA...
Caves:  [00:01:13]: SWITCHING   false
Caves:  [00:01:13]: Reconstructing topology
Caves:  [00:01:13]:     ...Sorting points
Caves:  [00:01:13]:     ...Sorting edges
Caves:  [00:01:13]:     ...Connecting nodes
Caves:  [00:01:13]:     ...Validating connections
Caves:  [00:01:13]:     ...Housekeeping
Caves:  [00:01:13]:     ...Done!
Caves:  [00:01:13]: 1 uploads added to server. From server_temp
Caves:  [00:01:13]: About to start a shard with these settings:
Caves:  [00:01:13]:   ShardName: Caves
Caves:  [00:01:13]:   ShardID: 720493686
Caves:  [00:01:13]:   ShardRole: SECONDARY
Caves:  [00:01:13]:   MasterHost: 127.0.0.1
Caves:  [00:01:13]:   MasterBind: (null)
Caves:  [00:01:13]:   MasterPort: 10889
Caves:  [00:01:13]: [Shard] Connecting to master...
Caves:  [00:01:13]: Telling Client our new session identifier: 2C65E36E2C37254F
Caves:  [00:01:13]: Check for write access: TRUE
Caves:  [00:01:13]: Check for read access: TRUE
Caves:  [00:01:13]: Available disk space for save files:                                                            41850 MB
Caves:  [00:01:13]: ModIndex: Load sequence finished successfully.
Caves:  [00:01:14]: Reset() returning
Caves:  [00:01:14]: Parent process is dead, exiting...
Caves:  Updates 0Seconds elapsed: 73.613 fps:0
Caves:  Saving Dedicated server data...
Caves:  [00:01:14]: Available disk space for save files:                                                            41850 MB
Caves:  [00:01:15]: Serializing world: session/2C65E36E2C37254F/0000000011
Caves:  [00:01:15]: Truncating to snapshot #11...
Caves:  [00:01:15]:  - session/2C65E36E2C37254F/0000000005
Caves:  [00:01:15]:    1 file(s) removed
Caves:  [00:01:15]: [Shard] Stopping shard mode
Caves:  [00:01:16]: Collecting garbage...
Caves:  [00:01:16]: lua_gc took 0.51 seconds
Caves:  [00:01:17]: ~ShardLuaProxy()
Caves:  [00:01:17]: ~cEventLeaderboardProxy()
Caves:  [00:01:17]: ~ItemServerLuaProxy()
Caves:  [00:01:17]: ~InventoryLuaProxy()
Caves:  [00:01:17]: ~NetworkLuaProxy()
Caves:  [00:01:17]: ~SimLuaProxy()
Caves:  [00:01:17]: Cancelling LuaQueryCallback handle [2]
Caves:  [00:01:17]: lua_close took 0.59 seconds
Caves:  [00:01:17]: Could not unload undefined prefab (brokenwall_stone_2)
Caves:  [00:01:17]: Could not unload undefined prefab (brokenwall_ruins_2)
Caves:  [00:01:17]: Orphaned unnamed resource. This resource must have used Add( resource ) to insert itself into the manager.
Caves:  [00:01:17]: CurlRequestManager::ClientThread::Main() complete
Caves:  [00:01:17]: HttpClient2 discarded 0 callbacks.
Caves:  [00:01:17]: Shutting down

 

 

PS.: Sorry if my english isn't so good, it's because i'm not a native speaker xD

Link to comment
Share on other sites

6 hours ago, OLimao said:

Caves:  [00:01:14]: Parent process is dead, exiting...

This is why it's exiting.

You didn't include the full log (you can find each shard's log as server_log.txt in a shard's folder), but I'm guessing at the beginning it says that your commandline  includes that -monitor_parent_process argument or whatever it was. The effect of this switch is that when the launching process exits, both/all shards exit as well, avoiding a problematic situation of not running all shards.

I don't use Klei's script so I'm not even sure how it's supposed to work. As written, the server will monitor the process of the script, which will exit as soon as the shards are launched. Looks broken to me. Drop the switch from the assignment to run_shared and the servers should work. You will need to make sure, when stopping the server, to terminate both shards - the order and minor delays don't matter. killall dontstarve...nullrenderer should do the trick in the trivial case of 1 cluster, but if you're running multiple clusters you'll need to do something more sophisticated.

Link to comment
Share on other sites

Hey.

My OS is Centos 7 64bit. I tried the following commands as a root.

The DST Dedicated server requires libcurl4-gnutls-dev and there isn't a package by that name through yum, there is however a libcurl.i686. I installed libcurl.i686 (the 32-bit one) through yum then executed this command

ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl-gnutls.so.4

But it doesn't seem to work for me, the dedicated server don't start.

And when I use ldd,

ldd Steam/steamapps/common/Don\'t\ Starve\ Together\ Dedicated\ Server/bin/dontstarve_dedicated_server_nullrenderer

I got this

image.thumb.png.0e96ae8b4de5f38c433570b3d61c4ad2.png

Thank you.

 

Link to comment
Share on other sites

@wtx8887

The "version info missing" message is not necessarily breaking the game - what do you get when you actually try to run it?

Also - I don't have centos at hand right now, are you sure the linked library is the 32 bit one? Check the output of readelf -h /lib/libcurl-gnutls.so.4 :

readelf -h /usr/lib/i386-linux-gnu/libcurl-gnutls.so.4
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x9b00
  Start of program headers:          52 (bytes into file)
  Start of section headers:          647768 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         10
  Size of section headers:           40 (bytes)
  Number of section headers:         29
  Section header string table index: 28

 

Link to comment
Share on other sites

Sorry, it was my fault. As you said, "version info missing" message is not necessarily breaking the game.

Actually, I used the wrong script and generated the wrong .../Master/save/shardindex. This caused the terminal to keep repeating the following log instead of starting normally image.thumb.png.c503c84ffa2f4a32731474df011a9fb8.png

I downloaded the official script(Download this shell script) and run it.

So, it worked now. And I did not make any changes to the environment and lib.

Thanks for your answer.

Link to comment
Share on other sites

Hello

I created a EC2 to run a dedicated server, I think it's working, but the server don't appears in the list of server.

I don't know what I need to do to fix this or test.

image.thumb.png.b1946d08cba194616ca28bd4e86f7ce3.pngimage.thumb.png.da62ea310b1641a852df654d805d64f7.png

Edited by Urio
Link to comment
Share on other sites

I do not have a directory called "run_dedicated_servers.sheven after downloading the shell file via wget. Any help with this will be nice.

Fixed: I forgot to extract the dediserver file and I removed the .sh from the file name. Then it worked.

Edited by squidten
i found a fix
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...