Jump to content

Run dedicated server in Docker


Recommended Posts

Detailed install process for newbies

 

(It's better you have some idea for terminal. )

 

1. Install Docker: visit https://docs.docker.com/engine/installation/ and find instructions for your OS.

(I recommend using Linux if you have one, because on Windows and OS X docker use a virtual machine mechanism which will have a slight impact to performance. Still, it works on my OS X. )

 

2. If you are on Linux, ignore this step. 

 

If you are on OS X, open "Terminal.app" and type:

docker-machine start defaulteval "$(docker-machine env default)"

The two lines starts up Docker. 

 

Sorry I haven't tested for Windows. 

 

3. Use docker compose to configure the server

 

`cd` to a specific folder you want your config files to put in. Create a file named `docker-compose.yml`.

 

If you are not familiar to console just do the following instruction:

mkdir ~/dst_servercd ~/dst_servervim docker-compose.yml# then press key `i` on your keyboard

Copy and paste EXACTLY the following content to Terminal window (all indentations must be correct for a yml file)

server:  image: jamesits/don-t-starve-together-dedicated-server:latest  restart: always  ports:  - 10999:10999/udp  volumes:  - ./server_config:/data/DoNotStarveTogether

then press the key sequence one by one: 

<Esc> : w q ! <Enter>

After that, run:

docker-compose up

You should see something like this:

$ docker-compose upPulling server (jamesits/don-t-starve-together-dedicated-server:latest)...latest: Pulling from jamesits/don-t-starve-together-dedicated-servere744cc519944: Pull completea77dbcd61efe: Pull complete88e62007ac7a: Pull complete3d2e0b056f6f: Pull completeb609deef3eef: Pull complete143180431184: Pull complete4df3dcb39bd2: Pull completeDigest: sha256:916ad745451fb5d1e071cfab4cf911b8daef0dea9c0ed9ba79f1d6fab3792ad6Status: Downloaded newer image for jamesits/don-t-starve-together-dedicated-server:latestCreating dst_server_1Attaching to dst_server_1server_1 | Starting Upserver_1 | Version: 158557server_1 | Current time: Tue Dec  8 01:13:43 2015server_1 |server_1 | System Name: Linuxserver_1 | Host Name: d5997941bfb0server_1 | Release(Kernel) Version: 4.1.13-boot2dockerserver_1 | Kernel Build Timestamp: #1 SMP Fri Nov 20 19:05:50 UTC 2015server_1 | Machine Arch: x86_64server_1 | Don't Starve Together: 158557 LINUXserver_1 | NNN Build Date: 2015-12-01_11-18-46server_1 | Parsing command lineserver_1 | Command Line Arguments: -port 10999 -persistent_storage_root /data startserver_1 | THREAD - started 'GAClient' (4136844096)server_1 | HttpClient2::ClientThread::Main()server_1 | ProfileIndex:6.01server_1 | create "/data/DoNotStarveTogether/save"server_1 | create "/data/DoNotStarveTogether/save/mod_config_data"server_1 | create "/data/DoNotStarveTogether/save/server_temp"server_1 | create "/data/DoNotStarveTogether/save/client_temp"server_1 | create "/data/DoNotStarveTogether/save/session"server_1 | [CONNECT] PendingConnection::Reset(true)server_1 | Network tick rate: U=15(2), D=0server_1 | Network tick rate: U=15(2), D=0server_1 | OnLoadPermissionList: /data/DoNotStarveTogether/save/blocklist.txt (Failure)server_1 | OnLoadPermissionList: /data/DoNotStarveTogether/save/adminlist.txt (Failure)server_1 | OnLoadUserIdList: /data/DoNotStarveTogether/save/whitelist.txt (Failure)server_1 | Server token retrieved from: server_token.txtserver_1 | cGame::InitializeOnMainThreadserver_1 | Renderer initialize: Okayserver_1 | AnimManager initialize: Okayserver_1 | Buffers initialize: Okayserver_1 | cDontStarveGame::DoGameSpecificInitialize()server_1 | FMOD Error: An invalid object handle was used.server_1 | GameSpecific initialize: Okayserver_1 | cGame::StartPlayingserver_1 | LOADING LUAserver_1 | DoLuaFile scripts/main.luaserver_1 | DoLuaFile loading buffer scripts/main.luaserver_1 | scripts/main.lua(171,1) running main.luaserver_1 |server_1 | Could not load modindexserver_1 | ModIndex: Beginning normal load sequence for dedicated server.server_1 |server_1 | DownloadMods(0)server_1 | FMOD Error: An invalid object handle was used.server_1 | LOADING LUA SUCCESSserver_1 | PlayerDeaths could not load morgueserver_1 | PlayerHistory could not load player_historyserver_1 | could not load profileserver_1 | loaded profileserver_1 | bloom_enabled	falseserver_1 | Could not load saveindexserver_1 | OnFilesLoaded()server_1 | OnUpdatePurchaseStateCompleteserver_1 | 	Load FEserver_1 | 	Load FE: doneserver_1 | ModIndex: Load sequence finished successfully.server_1 | Reset() returningserver_1 | [200] Account Failed (6): "E_INVALID_TOKEN"server_1 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!server_1 | !!!! Your Server Will Not Start !!!!server_1 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!server_1 | No auth token could be found.server_1 | To generate a server_token you mustserver_1 | open the console from a logged-in gameserver_1 | client with the tilda key (~) and type:server_1 | TheNet:GenerateServerToken()server_1 | This will create 'server_token.txt' inserver_1 | your client settings directory. Copy thisserver_1 | into your server settings directory.server_1 | [CONNECT] PendingConnection::Reset(true)

When you see this, press Control+C to stop server and finish any config in `~/dst_server`. (On OS X, just type `open .` in Terminal.app to access it. )

Link to comment
Share on other sites

I too created a docker image for running DST with caves support

 

You can find the image on dockerhub

 

I wrote up a ton of instructions on my github

 

For the dl;tr:

 

  1. Create a volume to store settings.ini and server_token.txt
  2. sudo docker run -dit --name="dst" -p 10999:10999 -v <host_volume_location>:/home/steam/.klei/DoNotStarveTogether ryshe/dst

 

Cheers!

Link to comment
Share on other sites

I too created a docker image for running DST with caves support

 

You can find the image on dockerhub

 

I wrote up a ton of instructions on my github

 

For the dl;tr:

 

  1. Create a volume to store settings.ini and server_token.txt
  2. sudo docker run -dit --name="dst" -p 10999:10999 -v <host_volume_location>:/home/steam/.klei/DoNotStarveTogether ryshe/dst

 

Cheers!

step 2 should be:

 

sudo docker run -dit --name="dst" -p 10999:10999/udp -v <host_volume_location>:/home/steam/.klei/DoNotStarveTogether ryshe/dst

 

where <host_volume_location> is wherever on the host machine you're persisting your data.

 

I'm pretty sure the mods volume will work, but it is under tested.

Updating is supported by just restarting the server(s):

 

gracefully shutdown the server by first attaching to it:

sudo docker attach dst

 

send the shutdown command:

c_shutdown()

 

at this point the container should have stopped.  now we can just restart it with:

sudo docker restart dst

 

If you're running caves you'll need to do the same on the caves server

Link to comment
Share on other sites

step 2 should be:

 

sudo docker run -dit --name="dst" -p 10999:10999/udp -v <host_volume_location>:/home/steam/.klei/DoNotStarveTogether ryshe/dst

 

where <host_volume_location> is wherever on the host machine you're persisting your data.

 

I'm pretty sure the mods volume will work, but it is under tested.

Updating is supported by just restarting the server(s):

 

gracefully shutdown the server by first attaching to it:

sudo docker attach dst

 

send the shutdown command:

c_shutdown()

 

at this point the container should have stopped.  now we can just restart it with:

sudo docker restart dst

 

If you're running caves you'll need to do the same on the caves server

 

You can use docker-compose to automate this action (and start both servers in one command too). Try my version: https://github.com/Jamesits/Don-t-Starve-Together-Dedicated-Server#install-using-docker-compose

 

Also, it seems that pressing Ctrl+C works the same as c_shutdown?

Link to comment
Share on other sites

You can use docker-compose to automate this action (and start both servers in one command too). Try my version: https://github.com/Jamesits/Don-t-Starve-Together-Dedicated-Server#install-using-docker-compose

 

Also, it seems that pressing Ctrl+C works the same as c_shutdown?

 

@Jamesits I updated my github with a docker-compose.yml.  It's in the the config folder.  I am worried about the reattachment steps working when running from docker-compose.  I couldn't seem to do it when I was testing.  It is a required step so that you can execute the c_regenerateworld().  Otherwise there will not be cave entrances!

 

I also rewrote the readme file.  Lots of new instructions!  They really need to be tested, if anyone feels so compelled.

 

I don't think Ctrl+C is the same as c_shutdown().  Ctrl+C will cause the server to quit, but it's not gracefully shutting down the server.  I could be wrong, but I think c_shutdown() will execute a save before closing out.

Link to comment
Share on other sites

@Jamesits I updated my github with a docker-compose.yml.  It's in the the config folder.  I am worried about the reattachment steps working when running from docker-compose.  I couldn't seem to do it when I was testing.  It is a required step so that you can execute the c_regenerateworld().  Otherwise there will not be cave entrances!

 

I also rewrote the readme file.  Lots of new instructions!  They really need to be tested, if anyone feels so compelled.

 

I don't think Ctrl+C is the same as c_shutdown().  Ctrl+C will cause the server to quit, but it's not gracefully shutting down the server.  I could be wrong, but I think c_shutdown() will execute a save before closing out.

 

When I press Ctrl+C I can see the logs: 

^CGracefully stopping... (press Ctrl+C again to force)Stopping dst_server_1 ... donedst_server_1 exited with code 137

But there are no evidence that server performed a save after Ctrl+C. Maybe we can let entrypoint shell script capture SIGINT and quit server? I haven't tried that but I believe it's possible. 

 

Since caves are still in its beta testing stage, I am not considering supporting it now. 

Link to comment
Share on other sites

@Jamesits I updated my github with a docker-compose.yml.  It's in the the config folder.  I am worried about the reattachment steps working when running from docker-compose.  I couldn't seem to do it when I was testing.  It is a required step so that you can execute the c_regenerateworld().  Otherwise there will not be cave entrances!

 

I also rewrote the readme file.  Lots of new instructions!  They really need to be tested, if anyone feels so compelled.

 

I don't think Ctrl+C is the same as c_shutdown().  Ctrl+C will cause the server to quit, but it's not gracefully shutting down the server.  I could be wrong, but I think c_shutdown() will execute a save before closing out.

 

Hey!

Set "stdin_open: true" and "tty: true" in the docker-compose.yml to make attaching work correctly.

Link to comment
Share on other sites

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.

×
  • Create New...