Skip to content

Commit

Permalink
Merge branch 'release/0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Deinhamer committed Mar 20, 2016
2 parents 9490550 + 1693a85 commit 1e30152
Show file tree
Hide file tree
Showing 29 changed files with 455 additions and 205 deletions.
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,33 @@

## [next]

## [0.5.0]

### Added
- Add the `backup_logs` argument to create a backup of the old logs.
- Implement validation for environment variables.
- Add the environment variable `LAN_ONLY`.
- Add the environment variable `MAX_SNAPSHOTS`.

### Changed
- Adopt the new file structure based on clusters.
- Move the token outside the settings files.
- Set a default of `10888` for `SHARD_MASTER_PORT`.
- Use `boxcutter/ubuntu1510` as the Vagrant base-box.
- Change the Vagrant base-box name to be compatible with more providers.
- Rename environment variable `SERVER_TOKEN` to `TOKEN`.
- Rename environment variable `SERVER_NAME` to `NAME`.
- Rename environment variable `SERVER_DESCRIPTION` to `DESCRIPTION`.
- Rename environment variable `SERVER_NAME_PREFIX` to `NAME_PREFIX`.
- Rename environment variable `SERVER_PASSWORD` to `PASSWORD`.
- Rename environment variable `SERVER_INTENTION` to `INTENTION`.

### Removed
- Remove environment variable `AUTOCOMPILER_ENABLE`.
- Remove environment variable `CONNECTION_TIMEOUT`.
- Remove environment variable `MODS_ENABLE`.
- Remove environment variable `STEAM_CLOUD_DISABLE`.

## [0.4.0]

### Added
Expand Down Expand Up @@ -52,7 +79,8 @@
### Added
- Initial release.

[next]: https://github.com/dst-academy/server/compare/v0.4.0...HEAD
[next]: https://github.com/dst-academy/server/compare/v0.5.0...HEAD
[0.5.0]: https://github.com/dst-academy/server/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/dst-academy/server/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/dst-academy/server/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/dst-academy/server/compare/v0.1.0...v0.2.0
Expand Down
10 changes: 5 additions & 5 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Vagrant.require_version '>= 1.8.0'
Vagrant.configure('2') do |config|

# Base
config.vm.box = 'bento/ubuntu-15.04'
config.vm.box_version = '>= 2.2'
config.vm.box = 'boxcutter/ubuntu1510'
config.vm.box_version = '>= 2.0'
config.vm.hostname = 'dsta-server'

# Ports
Expand All @@ -20,7 +20,7 @@ Vagrant.configure('2') do |config|
# VirtualBox
config.vm.provider :virtualbox do |provider, config|
provider.gui = false
provider.name = 'DST:A Server'
provider.name = 'DSTA-Server'
provider.customize ['modifyvm', :id, '--ostype', 'Ubuntu_64']
provider.customize ['modifyvm', :id, '--memory', 4096]
provider.customize ['modifyvm', :id, '--acpi', 'on']
Expand All @@ -35,7 +35,7 @@ Vagrant.configure('2') do |config|
[:vmware_workstation, :vmware_fusion].each do |provider|
config.vm.provider provider do |provider, config|
provider.gui = false
provider.vmx['displayName'] = 'DST:A Server'
provider.vmx['displayName'] = 'DSTA-Server'
provider.vmx['guestOS'] = 'ubuntu-64'
provider.vmx['numvcpus'] = 2
provider.vmx['memsize'] = 4096
Expand All @@ -45,7 +45,7 @@ Vagrant.configure('2') do |config|
# Parallels
config.vm.provider :parallels do |provider, config|
provider.gui = false
provider.name = 'DST:A Server'
provider.name = 'DSTA-Server'
provider.cpus = 2
provider.memory = 4096
provider.optimize_power_consumption = false
Expand Down
50 changes: 18 additions & 32 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,28 @@ RUN gpg --keyserver pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4
&& rm /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

ENV STEAM_HOME="/opt/steam" \
ENV STEAM_USER="steam" \
STEAM_HOME="/opt/steam" \
DST_HOME="/opt/dst" \
DSTA_HOME="/usr/local/lib/dsta" \
CONFIG_PATH="/var/lib/dsta/config"
DSTA_HOME="/usr/local/share/dsta" \
CLUSTER_PATH="/var/lib/dsta/cluster"

# Add steam user.
RUN adduser --disabled-login --gecos "Steam" --home $STEAM_HOME steam
RUN adduser --disabled-login --gecos "Steam" --home $STEAM_HOME $STEAM_USER

# Install SteamCMD.
RUN curl -fsSL "https://cdn.steamstatic.com/client/installer/steamcmd_linux.tar.gz" | gosu steam tar -xzvC $STEAM_HOME \
&& gosu steam $STEAM_HOME/steamcmd.sh \
RUN curl -fsSL "https://cdn.steamstatic.com/client/installer/steamcmd_linux.tar.gz" | gosu $STEAM_USER tar -xzvC $STEAM_HOME \
&& gosu $STEAM_USER $STEAM_HOME/steamcmd.sh \
+@ShutdownOnFailedCommand 1 \
+quit \
&& rm -rf $STEAM_HOME/Steam/logs $STEAM_HOME/Steam/appcache/httpcache \
&& find $STEAM_HOME/package -type f ! -name "steam_cmd_linux.installed" ! -name "steam_cmd_linux.manifest" -delete

# Install Don't Starve Together Server.
RUN mkdir -p $DST_HOME \
&& chown steam:steam $DST_HOME \
&& chown $STEAM_USER:$STEAM_USER $DST_HOME \
&& sync \
&& gosu steam $STEAM_HOME/steamcmd.sh \
&& gosu $STEAM_USER $STEAM_HOME/steamcmd.sh \
+@ShutdownOnFailedCommand 1 \
+login anonymous \
+force_install_dir $DST_HOME \
Expand All @@ -59,41 +60,26 @@ COPY /docker-entrypoint.sh /entrypoint.sh
# Copy static files.
COPY /static $DSTA_HOME
RUN mkfifo $DSTA_HOME/console \
&& chown -R steam:steam $DSTA_HOME \
&& mkdir -p `dirname $CONFIG_PATH` \
&& chown steam:steam `dirname $CONFIG_PATH`
&& chown -R $STEAM_USER:$STEAM_USER $DSTA_HOME \
&& mkdir -p `dirname $CLUSTER_PATH` \
&& chown $STEAM_USER:$STEAM_USER `dirname $CLUSTER_PATH`

# Set environment variables.
ENV SERVER_DESCRIPTION="Powered by DST Academy." \
SERVER_PORT=10999 \
OFFLINE_ENABLE=false \
ENV DESCRIPTION="Powered by DST Academy." \
SERVER_PORT="10999" \
MAX_PLAYERS=4 \
WHITELIST_SLOTS=0 \
PVP_ENABLE=false \
GAME_MODE=survival \
SERVER_INTENTION=cooperative \
AUTOSAVER_ENABLE=true \
TICK_RATE=15 \
CONNECTION_TIMEOUT=5000 \
VOTE_KICK_ENABLE=true \
PAUSE_WHEN_EMPTY=true \
STEAM_AUTHENTICATION_PORT=8766 \
STEAM_MASTER_SERVER_PORT=27016 \
STEAM_GROUP_ONLY=false \
STEAM_GROUP_ADMINS=false \
CONSOLE_ENABLE=true \
AUTOCOMPILER_ENABLE=false \
MODS_ENABLE=true \
SHARD_ENABLE=false \
SHARD_NAME=shard \
SHARD_IS_MASTER=false \
SHARD_BIND_IP="0.0.0.0" \
STEAM_CLOUD_DISABLE=true
SHARD_BIND_IP="0.0.0.0"

# Expose default server port.
EXPOSE 10999/udp
EXPOSE $SERVER_PORT/udp

# Set up a volume for configuration files.
VOLUME ["$CONFIG_PATH"]
VOLUME ["$CLUSTER_PATH"]

# Set entrypoint and default command.
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
4 changes: 3 additions & 1 deletion build/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ if [ $1 == "dst-server" ]; then
set -e

# Configure the server
chown steam:steam $CONFIG_PATH
mkdir -p $CLUSTER_PATH/$SHARD_NAME
chown -R $STEAM_USER:$STEAM_USER $CLUSTER_PATH

$DSTA_HOME/boot/token.sh
$DSTA_HOME/boot/settings.sh
$DSTA_HOME/boot/lists.sh
$DSTA_HOME/boot/world.sh
Expand Down
18 changes: 9 additions & 9 deletions build/script/dontstarve_dedicated_server_nullrenderer
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash

if [ `whoami` != "steam" ]; then
exec gosu steam $0 "$@"
if [ `whoami` != "$STEAM_USER" ]; then
exec gosu $STEAM_USER $0 "$@"
fi

# TODO here we are going to trap the signals

cd $DST_HOME/bin

# We must have at least one writer
sleep infinity > $DSTA_HOME/console &

cd $DST_HOME/bin
exec ./dontstarve_dedicated_server_nullrenderer \
-console \
-persistent_storage_root `dirname $CONFIG_PATH` \
-conf_dir `basename $CONFIG_PATH` \
"$@" < $DSTA_HOME/console
-backup_logs \
-persistent_storage_root `dirname $CLUSTER_PATH` \
-conf_dir "." \
-cluster `basename $CLUSTER_PATH` \
-shard "$SHARD_NAME" \
"$@" < <({ stdbuf -oL cat $DSTA_HOME/console & stdbuf -oL cat & })
4 changes: 2 additions & 2 deletions build/script/steamcmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

if [ `whoami` != "steam" ]; then
exec gosu steam $0 "$@"
if [ `whoami` != "$STEAM_USER" ]; then
exec gosu $STEAM_USER $0 "$@"
fi

$STEAM_HOME/steamcmd.sh "$@"
6 changes: 3 additions & 3 deletions build/static/bin/log.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ usage(){
}

if [ $# -eq 0 ]; then
log=$CONFIG_PATH/log.txt
log=$CLUSTER_PATH/$SHARD_NAME/server_log.txt
elif [ $1 == "--help" ]; then
usage
exit 0
elif [ $# -eq 1 ]; then
case $1 in
--server)
log=$CONFIG_PATH/log.txt
log=$CLUSTER_PATH/$SHARD_NAME/server_log.txt
;;
--chat)
log=$CONFIG_PATH/log_chat.txt
log=$CLUSTER_PATH/$SHARD_NAME/server_log_chat.txt
;;
esac
fi
Expand Down
42 changes: 42 additions & 0 deletions build/static/boot/aux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
warning(){
echo "[WARNING] $1" 1>&2
}

validate_bool(){
local v=${!1}
if [[ -n "$v" ]] && [[ "$v" != "true" ]] && [[ "$v" != "false" ]]; then
warning "$1 must be \"true\" or \"false\"."
return 1
fi
}

validate_int(){
local v=${!1}
if [[ -n "$v" ]] && [[ "$v" -lt "$2" ]] || [[ "$v" -gt "$3" ]]; then
warning "$1 must be between $2 and $3."
return 1
fi
}

validate_port(){
return `validate_int "$1" "1" "65535"`
}

# http://stackoverflow.com/a/8574392/842697
containsElement(){
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}

validate_option(){
local v=${!1}
if [[ -n "$v" ]] && ! containsElement "$v" "${@:2}"; then
warning "$1 must be one of these: ${*:2}."
return 1
fi
}

conf() {
[[ -n "$2" ]] && echo "$1 = $2"
}
10 changes: 4 additions & 6 deletions build/static/boot/lists.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#!/usr/bin/env bash

gosu steam mkdir "$CONFIG_PATH/save"

create_list(){
list=$1
file=$2
if [ -n "$list" ] && [ ! -f $file ]; then
echo $list | tr , '\n' > $file
chown steam:steam $file
chown $STEAM_USER:$STEAM_USER $file
fi
}

# Create the adminlist.txt file.
create_list "$ADMINLIST" "$CONFIG_PATH/save/adminlist.txt"
create_list "$ADMINLIST" "$CLUSTER_PATH/adminlist.txt"

# Create the whitelist.txt file.
create_list "$WHITELIST" "$CONFIG_PATH/save/whitelist.txt"
create_list "$WHITELIST" "$CLUSTER_PATH/whitelist.txt"

# Create the blocklist.txt file.
create_list "$BLOCKLIST" "$CONFIG_PATH/save/blocklist.txt"
create_list "$BLOCKLIST" "$CLUSTER_PATH/blocklist.txt"
6 changes: 3 additions & 3 deletions build/static/boot/mods.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

file_mods_setup="$DST_HOME/mods/dedicated_server_mods_setup.lua"
file_mods_settings="$DST_HOME/mods/modsettings.lua"
file_mods_overrides="$CONFIG_PATH/modoverrides.lua"
file_mods_overrides="$CLUSTER_PATH/$SHARD_NAME/modoverrides.lua"

IFS=","

Expand All @@ -27,7 +27,7 @@ if [ -n "$MODS" ] && [ ! -f $file_mods_overrides ]; then
echo "}" >> $file_mods_overrides
fi

chown steam:steam $file_mods_overrides
chown $STEAM_USER:$STEAM_USER $file_mods_overrides
fi

# Enable mods forcefully for mod development.
Expand All @@ -36,5 +36,5 @@ if [ -n "$MODS_FORCE" ]; then
echo "ForceEnableMod(\"$mod\")" >> $file_mods_settings
done

chown steam:steam $file_mods_settings
chown $STEAM_USER:$STEAM_USER $file_mods_settings
fi
Loading

0 comments on commit 1e30152

Please sign in to comment.