Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Deinhamer committed Jan 4, 2016
2 parents d6bee72 + 90e3e4f commit 10eb16b
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 67 deletions.
6 changes: 5 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[*.sh]
[*.{sh,yml}]
indent_style = space
indent_size = 2

[Vagrantfile]
indent_style = space
indent_size = 2
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Development
/Vagrantfile
/.vagrant/
/docker-compose.yml

# Project
/build/docker-compose.yml
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@

## [next]

## [0.2.0]

### Added
- Make the null-renderer `conf_dir` argument configurable.
- Make world generation configurable via the `WORLD_OVERRIDES` variable.
- Make the Steam App-ID configurable via the `STEAM_APP_ID` variable.
- Support volume-mounting.

### Changed
- Improve the `docker-compose.yml` configuration.
- Improve the entrypoint script.

## [0.1.0]

### Added
- Initial release.

[next]: https://github.com/thasmo/vagrant.box/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/thasmo/vagrant.box/compare/da19beb5479033b82dd6dc1200bb0cf6724904c3...v0.1.0
[next]: https://github.com/dst-academy/server/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/dst-academy/server/compare/v0.1.0...v0.2.0
[0.1.0]: https://github.com/dst-academy/server/compare/da19beb5479033b82dd6dc1200bb0cf6724904c3...v0.1.0
106 changes: 88 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# DST-Academy Don't Starve Together Server
> Don't Starve Together Dedicated Server for Docker.
# DST:A Dedicated Server
> Don't Starve Together Academy Dedicated Server for Docker.
This repository provides a `Dockerfile` for building the DST:A Dedicated Server
for the online multi-player survival game [*Don't Starve Together*][website].

If you want to set up your own server, have a look at the [DST:A Suite][suite].

## Features
- [x] Configuration via ENV variables.
- [x] World presets including caves.
- [x] Customized world generation.
- [x] Mods and custom mod-configuration.
- [x] Connected worlds via sharding.
- [x] Control the server directly on the CLI.
- [x] World-persistence on container destruction.
- [ ] Automatic update of the game and mods.
- [ ] Sharing game and mod-files between instances.

## Setup
Setting up the server is pretty easy if you got Docker already running.
Find a quick step-by-step guide how to setup the dedicated DST server below.
Find a quick step-by-step guide how to setup the dedicated server below.

### Overview

1. Install [Docker Engine][engine-setup].
2. Install [Docker Compose][compose-setup]. *(optional but recommended)*
3. Pull the [`dstacademy/server`][image] image.
4. Configure a [`docker-compose.yml`][compose-file] configuration. *(optional but recommended)*
5. [Start a container][engine-run] i.e. [launch the service][compose-up].
3. Configure a [`docker-compose.yml`][compose-file] configuration. *(optional but recommended)*
4. [Start a container][engine-run] i.e. [launch the service][compose-up].

The [DST:A Suite][suite] provides common Docker Compose configurations.

## Usage
Server-lifecycle is controlled via default [Docker Engine][engine-cli] or [Docker Compose][compose-cli]
Expand All @@ -20,27 +37,31 @@ game or installed mods provide updates and will download and install them. Thus
minutes before the server shows up on the server-list.

### Basic Commands
Basic commands to maintain the DST server.
Basic commands to maintain the DST:A Dedicated Server.

**Start the Server**
Starts the server. On boot the game-server checks for updates and performs them.
Docker Engine:
`docker run -d -p 10999:10999/udp --name="dst-server" -e SERVER_TOKEN="server-token" dstacademy/server`
`docker run -itd -p 10999:10999/udp --name="dst-server" -e SERVER_TOKEN="server-token" dstacademy/server`
Docker Compose:
`docker-compose up -d`

**Stop the Server**
Stops the server.
Docker Engine:
`docker stop dst-server`
Docker Compose:
`docker-compose stop`

**Restart the Server**
Restarts the server. On boot the game-server checks for updates and performs them.
Docker Engine:
`docker restart dst-server`
Docker Compose:
`docker-compose restart`

**Remove the Server**
Deletes the server.
Docker Engine:
`docker rm -f dst-server`
Docker Compose:
Expand All @@ -50,33 +71,41 @@ Docker Compose:
More advanced commands to maintain the server-image and other stuff.

**Update the Server-Image**
Updates the `dstacademy/server` image from the Docker Hub if updates are available.
Docker Engine:
`docker pull dstacademy/server`
Docker Compose:
`docker-compose pull`

**List all created servers/containers**
Prints an overview of all available servers.
Docker Engine:
`docker ps -a`
Docker Compose:
`docker-compose ps`

**Attach to the Server**
Attaches the terminal to a running server which enables input of server [commands][reference-commands]
and to observe the server output. To detach without stopping the server press `ctrl+p` followed by `ctrl+q`.
Docker Engine:
`docker attach dst-server`

## Configuration
Configuration of the server happens through environment variables, which can be passed to
the `docker run` call via CLI directly or using a separate file. Optionally it's recommended
to use `docker-compose` instead, which makes it easier to configure all environment variables.

**Example**:
```sh
docker run -d -e SERVER_TOKEN="Token" -e DEFAULT_SERVER_NAME="Name" -e MAX_PLAYERS=10 dstacademy/server
docker run -itd -e SERVER_TOKEN="Token" -e DEFAULT_SERVER_NAME="Name" -e MAX_PLAYERS=10 dstacademy/server
```

You can chain as many variables as you need. If you want to pass lots of them, it's easier and more
convenient to create an `.env` file and pass it's path to the command.

**Examples**:
```sh
docker run -d --env-file=".env" dstacademy/server
docker run -itd --env-file=".env" dstacademy/server
```

An `.env` file's contents must look like this and can hold all needed variables:
Expand All @@ -88,6 +117,19 @@ MAX_PLAYERS=10
```

### Environment Variables
Environment variables can be used to customize certain settings of the server. Most of the
available environment variables correspond to the `settings.ini` variables used by DST.

#### Application
Sets application-specific options.

**STORAGE_ROOT**
Configures the root path of the save directory. Should not be changed under most circumstances.
- *text* *[default: /home/steam/.klei/]*

**CONF_DIR**
Defines an alternative directory-name for writing and reading server configuration and save-games.
- *text* *[default: DoNotStarveTogether]*

#### Account
Sets account-related options.
Expand Down Expand Up @@ -115,11 +157,11 @@ the server's port-number, because the external/public port-number can be configu
- *number* *[default: 10999]*

**SERVER_PASSWORD**
Defines the server's password which is needed for players to connect.
Defines a server password so only players knowing the password can connect.
- *text*

**OFFLINE_SERVER**
Controls if the server should be listed online and accessible publicly.
Controls if the server is listed and accessible publicly.
- true
- false *[default]*

Expand Down Expand Up @@ -180,6 +222,10 @@ Enables/disables pausing of the world when no player is connected.
- true *[default]*
- false

**STEAM_APP_ID**
Sets the ID of the app to be installed. Generally it's not needed to change this.
- *number* *[default: 343050]*

**STEAM_AUTHENTICATION_PORT**
Sets the authentication port-number for Steam. Generally it's not needed to change this.
- *number* *[default: 8766]*
Expand Down Expand Up @@ -280,6 +326,13 @@ Defines some pre-configured world settings for the server.
- COMPLETE_DARKNESS
- DST_CAVE

**WORLD_OVERRIDES**
Sets the overrides-configuration for world generation. Basically it's just the content for the
`worldgenoverride.lua` file. As this value can be pretty large it's recommended to put the
configuration into a separate file and read it into the variable beforehand. When this is set
`WORLD_PRESET` has no effect.
- *string*

#### Mods
Mods-related settings.

Expand All @@ -296,15 +349,26 @@ configuration into a separate file and read it into the variable beforehand.

## Frequently Asked Questions

- **Does Docker automatically restart a running DST server/container when the host-system is rebooted?**
*Yes.*
- **Does Docker automatically restart a running DST:A Dedicated Server when the host-system is rebooted?**
Yes.

- **On which operating systems can I run Docker and the DST:A Dedicated Server?**
Docker runs natively on Linux, but there are official solutions for running Docker on Windows and OSX.
Have a look at Docker's [Kitematic][docker-kitematic] and Docker's [Toolbox][docker-kitematic].

- **Why does Steam take so long to update the game?**
It can happen that Steam takes a really long time to update the game. This is a known problem with
SteamCMD - sort of a bug. One solution is to install a DNS cache on your system, which was reported
to help regarding download speed.

## References and Links
- [Dedicated Server Discussion (Klei Forums)](http://forums.kleientertainment.com/forum/83-dont-starve-together-beta-dedicated-server-discussion/)
- [Shards and Migration Portals (Klei Forums)](http://forums.kleientertainment.com/topic/59174-understanding-shards-and-migration-portals/)
- [Dedicated Server Guide (Wikia)](http://dont-starve-game.wikia.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers)
- [Server Console Commands (Wikia)](http://dont-starve-game.wikia.com/wiki/Console/Don't_Starve_Together_Commands)
- [Dedicated Server Discussion (Klei Forums)][reference-dedicated]
- [Shards and Migration Portals (Klei Forums)][reference-shards]
- [Dedicated Server Guide (Wikia)][reference-guide]
- [Server Console Commands (Wikia)][reference-commands]

[website]: http://www.dontstarvetogether.com/
[suite]: https://github.com/dst-academy/suite
[image]: https://hub.docker.com/r/dstacademy/server/
[engine-setup]: https://docs.docker.com/engine/installation/
[compose-setup]: https://docs.docker.com/compose/install/
Expand All @@ -314,3 +378,9 @@ configuration into a separate file and read it into the variable beforehand.
[engine-run]: https://docs.docker.com/engine/reference/run/
[compose-up]: https://docs.docker.com/compose/reference/up/
[howto-token]: http://dont-starve-game.wikia.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers#Server_Tokens
[docker-kitematic]: https://kitematic.com/
[docker-toolbox]: https://www.docker.com/docker-toolbox
[reference-dedicated]: http://forums.kleientertainment.com/forum/83-dont-starve-together-beta-dedicated-server-discussion/
[reference-shards]: http://forums.kleientertainment.com/topic/59174-understanding-shards-and-migration-portals/
[reference-guide]: http://dont-starve-game.wikia.com/wiki/Guides/Don%E2%80%99t_Starve_Together_Dedicated_Servers
[reference-commands]: http://dont-starve-game.wikia.com/wiki/Console/Don't_Starve_Together_Commands
77 changes: 77 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
$script = <<SCRIPT
export DEBIAN_FRONTEND=noninteractive
# Update Packages
apt-get update
# Install Dependencies
apt-get install -y curl dnsmasq linux-image-extra-$(uname -r)
sleep 1
# Install Docker Engine
curl -sSL https://get.docker.com/ | sh
# Install Docker Compose
curl -sSL https://github.com/docker/compose/releases/download/1.5.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# Add the vagrant-user to the Docker group
usermod -aG docker vagrant
SCRIPT

# Version
Vagrant.require_version '>= 1.8.0'

# Configuration
Vagrant.configure('2') do |config|

# Base
config.vm.box = 'bento/ubuntu-15.04'
config.vm.box_version = '>= 2.2'
config.vm.hostname = 'dst-server'

# Ports
config.vm.network :forwarded_port, guest: 10999, host: 10999, protocol: 'udp'
config.vm.network :forwarded_port, guest: 11000, host: 11000, protocol: 'udp'
config.vm.network :forwarded_port, guest: 11001, host: 11001, protocol: 'udp'

# SSH
config.ssh.forward_agent = true

# VirtualBox
config.vm.provider :virtualbox do |provider, config|
provider.gui = false
provider.name = 'Don\'t Starve Together'
provider.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64']
provider.customize ['modifyvm', :id, '--memory', 4096]
provider.customize ['modifyvm', :id, '--acpi', 'on']
provider.customize ['modifyvm', :id, '--cpus', 2]
provider.customize ['modifyvm', :id, '--cpuexecutioncap', '100']
provider.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
provider.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
provider.customize ['modifyvm', :id, '--ioapic', 'on']
end

# VMware
[:vmware_workstation, :vmware_fusion].each do |provider|
config.vm.provider provider do |provider, config|
provider.gui = false
provider.vmx['displayName'] = 'Don\'t Starve Together'
provider.vmx['guestOS'] = 'ubuntu-64'
provider.vmx['numvcpus'] = 2
provider.vmx['memsize'] = 4096
end
end

# Parallels
config.vm.provider :parallels do |provider, config|
provider.gui = false
provider.name = 'Don\'t Starve Together'
provider.cpus = 2
provider.memory = 4096
provider.optimize_power_consumption = false
end

# Provision
config.vm.provision :shell, inline: $script
end
Loading

0 comments on commit 10eb16b

Please sign in to comment.