Image from http://forums.kleientertainment.com/topic/54719-welcome-to-dont-starve-together/
- Create a container service on Azure
- Download DST server Docker file and configure your DST server
- Get your DST server token
- Resize Azure container Service master VM
- Forward Azure container Service master VM port to local
- Start DST server on your Azure container
- Remove the server
With Docker now you can run a Don't Starve Together (DST) server on Azure in minutes!
Step 1: Create a container service on Azure
Click New on the left tool bar in Azure portal, in Search the marketplace box type Azure Container Service.
Click create button, and in Basics tab choose a Master VM root name and remember it, for example, I use dst. Paste your SSH into SSH public key box, select a Subscription, create a new resource group with name you like, I use dst as well. You can use any Resource group name, don't spend too much time in thinking about it. Choose a location near you and your friends, for example, I use East Asia where is Hong Kong. Then click OK.
In Framework configuration tab, select Swarm for orchestrator configuration. Then click OK.
In Azure Container service settings tab, change Agent virtual machine size to Standard A1 (Notice: DO NOT use A0, DST server requests at least 1GB memory, and A0 has only 0.75GB, your server will run out of memory if you use A0). If you cannot find A1, click View all link on the right of Choose a size window. The server requests 1GB memory, and every player requests about 60MB memory, so we can run a 10 players server with A1. Type anything in DNS prefix, but it must be unique in Azure. Then click OK.
After that, Azure will show you a summary, click OK you there's no errors.
Click Purchase button to deploy your container. You won't be charged immediately, you will be charged as much as you use in the feature.
You need wait for a while before your container is deployed.
Step 2: Download DST server Docker file and configure your DST server
Download DST server Docker file from https://github.com/Jamesits/docker-dst-server, you can use git clone if you familiar with git, or just download from https://github.com/Jamesits/docker-dst-server/archive/master.zip with your browser.
Enter plain/config/Cluster_1 folder in that repo, open cluster_token.txt with any text editor, paste your own token. If you do not know where to get your token, see Step 3, or go to Step 4.
Edit cluster.ini, overwrite it with the content below:
[GAMEPLAY] game_mode = endless max_players = 10 pvp = false pause_when_empty = true [NETWORK] cluster_name = My Azure DST Server cluster_description = Welcome! cluster_intention = cooperative cluster_password = mydstserver
Change My Azure DST Server to anything you like and cluster_password from mydstserver to your own password or leave it blank if you do not want to set a password.
If you want to change world settings, such as rabbit numbers, edit worldgenoverride.lua in Master folder.
Step 3: Get your DST server token
Launch DST on your machine, start game, click Acct Info
Image from http://clients.fragnet.net/knowledgebase/186/Configure-Server-Cluster-Token-Required.html
In the open web page click Generate Server Token
Image from http://forums.kleientertainment.com/topic/64212-dedicated-server-quick-setup-guide-windows/
Step 4: Resize Azure container Service master VM
Now your container service should be deployed, and the resource group is pinned in your dashboard. If it's still deploying, just wait for a moment.
In above screenshot, master VM is named swarm-master-1C258..., if you cannot find it in the resource group in your dashboard, click See More link to browser all resources.
The default size of master VM is D2, it costs too much and we don't need it such powerful. Change it to A0 is okay. Your DST server is running on agent VM, but not master VM, do not worried about A0's memory.
Step 5: Forward Azure container Service master VM port to local
Check its ip address in Overview. Click ip address and copy the ip in the open window.
Open a terminal and run
ssh <root-name>@<master-ip> -p 2200 -L 22375:127.0.0.1:2375. Container master VM SSH port is 2200 instead of 22.
Do not close this window.
Step 6: Start DST server on your Azure container
Open a terminal and set environment variable DOCKER_HOST to tcp://127.0.0.1:22375, if you use PowerShell, run
$env:DOCKER_HOST="tcp://127.0.0.1:22375". Then go to plain folder which you download in Step 2.
docker build -t dstserver ., then Docker should begin to build the image.
When the build complete, run
docker images to list all images you have in Azure container service now.
The image named dstserver is we built just now.
docker run -dit --restart=always dstserver to start container with that image, and you will get a container id. Run
docker ps to list all running containers.
If you want to see the container commands output, run
docker attach <container-id>, but don't press Ctrl+C to exit, but just close the terminal window.
After a while, you should see your server in the server list.
Step 7: Remove the server
If you don't want the server to run any longer, just delete the resource group, all resources will be deleted and you won't be charged in the feature.
Enjoy the game with your friends now 🙂