Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Deinhamer committed Dec 31, 2017
2 parents b7b1654 + 76204cc commit fb8676c
Show file tree
Hide file tree
Showing 105 changed files with 3,024 additions and 1,029 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ services:
env:
- DOCKER_IMAGE_NAME=dstacademy/dontstarvetogether

before_install:
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update
- sudo apt-get -y install docker-ce bats

script:
- docker build -t $DOCKER_IMAGE_NAME ./build
- ./test/run.sh
- bats tests

notifications:
slack:
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

## [next]

## [0.8.0]

### Added
- Introduce a `MODS` build-variable to support pre-built images with pre-installed mods.
- Add support for the `leveldataoverride.lua` file via the `LEVELDATA_OVERRIDES` env-variable.
- Configure the Docker `HEALTHCHECK` command running `dst-server version --check`.
- Add a `keep-configuration` boot option to define how existing configuration files should be handled.

### Changed
- Update the base-image to `dstacademy/steamcmd:0.3`.
- Overwrite configuration files by default when starting a container.
- Do not expose/configure a default port in the `Dockerfile` anymore.
- Refactor tests to use `bats`.

### Removed
- Remove the `WORLD_OVERRIDES` env-variable and `worldgenoverride.lua` file.
- Remove support for the `WORLD_PRESET` env-variable in favor of `LEVELDATA_OVERRIDES`.

## [0.7.1]

### Added
Expand Down Expand Up @@ -126,7 +144,8 @@
### Added
- Initial release.

[next]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.7.1...HEAD
[next]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.8.0...HEAD
[0.8.0]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.7.1...v0.8.0
[0.7.1]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.6.0...v0.7.0
[0.6.0]: https://github.com/dst-academy/docker-dontstarvetogether/compare/v0.5.0...v0.6.0
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ for the online multi-player survival game [*Don't Starve Together*][website].

## Features
- [x] Configuration via **ENV** variables.
- [x] World presets including **caves**.
- [x] Customized **world generation**.
- [x] Customized **world generation** via `leveldataoverride.lua`.
- [x] Mods and custom **mod-configuration**.
- [x] Connected worlds via **sharding**.
- [x] Control the server directly on the **CLI**.
Expand All @@ -28,6 +27,7 @@ for the online multi-player survival game [*Don't Starve Together*][website].
## Documentation
- [Setup][docs-setup]
- [Configuration][docs-configuration]
- [Commands][docs-commands]
- [Usage][docs-usage]
- [Examples][docs-examples]

Expand All @@ -54,6 +54,7 @@ Check out our [contribution guide][contribution-guide].

[docs-setup]: /docs/setup.md
[docs-configuration]: /docs/configuration.md
[docs-commands]: /docs/commands.md
[docs-usage]: /docs/usage.md
[docs-examples]: /docs/examples/
[website]: http://www.dontstarvetogether.com/
Expand Down
39 changes: 26 additions & 13 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
FROM dstacademy/steamcmd:0.2.1
FROM dstacademy/steamcmd:0.3
MAINTAINER DST Academy <[email protected]>

# Install dependencies.
RUN set -x \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
lib32stdc++6 \
libcurl4-gnutls-dev:i386 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Set build arguments.
ARG DST_HOME
ENV DST_HOME ${DST_HOME:-"/opt/dst"}
Expand All @@ -23,16 +33,6 @@ ENV DESCRIPTION="Powered by DST Academy." \
# Add labels.
LABEL academy.dst.config.update="true"

# Install dependencies.
RUN set -x \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
lib32stdc++6 \
libcurl4-gnutls-dev:i386 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Install Don't Starve Together Server.
RUN set -x \
&& mkdir -p $DST_HOME \
Expand All @@ -50,6 +50,19 @@ RUN set -x \
&& 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

ARG MODS
ENV MODS ${MODS}

# Install mods.
RUN set -x \
&& if [ -n "$MODS" ] ; then \
IFS="," \
&& for mod in $MODS; do echo "ServerModSetup(\"$mod\")" >> "$DST_HOME/mods/dedicated_server_mods_setup.lua"; done \
&& cd "$DST_HOME/bin" \
&& gosu $STEAM_USER ./dontstarve_dedicated_server_nullrenderer -only_update_server_mods \
&& rm -r "$STEAM_HOME/.klei" \
; fi

# Copy common scripts.
COPY /script/* /usr/local/bin/

Expand All @@ -66,8 +79,8 @@ RUN set -x \
# Copy entrypoint script.
COPY /docker-entrypoint.sh /

# Expose default server port.
EXPOSE $SERVER_PORT/udp
# Set up healthcheck.
HEALTHCHECK --start-period=15m --interval=5m --timeout=1m --retries=3 CMD dst-server version --check

# Set up a volume for configuration files.
VOLUME ["$CLUSTER_PATH"]
Expand Down
10 changes: 5 additions & 5 deletions build/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
set -e

# Run start command if only options given.
if [ "${1:0:1}" = '-' ]; then
if [[ "${1:0:1}" = '-' ]]; then
set -- dst-server start "$@"
fi

# Run boot scripts before starting the server.
if [ "$1" = 'dst-server' ]; then
if [[ "$1" = 'dst-server' ]]; then

# Prepare the shard directory.
mkdir -p $CLUSTER_PATH/$SHARD_NAME
chown -R $STEAM_USER:$STEAM_USER $CLUSTER_PATH
mkdir -p "$CLUSTER_PATH/$SHARD_NAME"
chown -R "$STEAM_USER":"$STEAM_USER" "$CLUSTER_PATH"

# Run via steam user if the command is `dst-server`.
set -- gosu $STEAM_USER "$@"
set -- gosu "$STEAM_USER" "$@"
fi

# Execute the command.
Expand Down
14 changes: 7 additions & 7 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_USER" ]; then
exec gosu $STEAM_USER $0 "$@"
if [[ "$(whoami)" != "$STEAM_USER" ]]; then
exec gosu "$STEAM_USER" "$0" "$@"
fi

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

cd $DST_HOME/bin
cd "$DST_HOME/bin"

exec ./dontstarve_dedicated_server_nullrenderer \
-persistent_storage_root `dirname $CLUSTER_PATH` \
-persistent_storage_root "$(dirname "$CLUSTER_PATH")" \
-conf_dir "." \
-cluster `basename $CLUSTER_PATH` \
-cluster "$(basename "$CLUSTER_PATH")" \
-shard "$SHARD_NAME" \
-backup_log_count "$BACKUP_LOG_COUNT" \
"$@" < <({ stdbuf -oL cat $DSTA_HOME/console & stdbuf -oL cat & })
"$@" < <({ stdbuf -oL cat "$DSTA_HOME/console" & stdbuf -oL cat & })
15 changes: 8 additions & 7 deletions build/script/dst-server
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#!/usr/bin/env bash

usage(){
cat $DSTA_HOME/doc/dst-server.usage
usage() {
cat "$DSTA_HOME/doc/dst-server.usage"
}

if [ $# -eq 0 ]; then
if [[ $# -eq 0 ]]; then
usage
exit 1
fi

case $@ in
case "$@" in
--help|help)
usage
exit 0
;;
--help\ *|help\ *)
set $2 --help
set "$2" --help
;;
esac

bin="$DSTA_HOME/bin/$1.sh"
if [ -f $bin ]; then

if [[ -f "$bin" ]]; then
shift
exec $bin "$@"
exec "$bin" "$@"
else
usage 1>&2
exit 1
Expand Down
16 changes: 8 additions & 8 deletions build/static/bin/console.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/env bash

usage(){
cat $DSTA_HOME/doc/console.usage
usage() {
cat "$DSTA_HOME/doc/console.usage"
}

if [ "$1" == "--help" ]; then
if [[ "$1" = "--help" ]]; then
usage
exit 0
elif [ $# -eq 0 ]; then
cat < /proc/self/fd/0 > $DSTA_HOME/console
elif [[ $# -eq 0 ]]; then
cat < /proc/self/fd/0 > "$DSTA_HOME/console"
else
for command in "$@"; do
if [ "$command" == "-" ]; then
cat < /proc/self/fd/0 > $DSTA_HOME/console
if [[ "$command" = "-" ]]; then
cat < /proc/self/fd/0 > "$DSTA_HOME/console"
else
echo $command > $DSTA_HOME/console
echo "$command" > "$DSTA_HOME/console"
fi
done
fi
24 changes: 12 additions & 12 deletions build/static/bin/log.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/usr/bin/env bash

usage(){
cat $DSTA_HOME/doc/log.usage
usage() {
cat "$DSTA_HOME/doc/log.usage"
}

if [ $# -eq 0 ]; then
log=$CLUSTER_PATH/$SHARD_NAME/server_log.txt
elif [ $1 == "--help" ]; then
if [[ $# -eq 0 ]]; then
log="$CLUSTER_PATH/$SHARD_NAME/server_log.txt"
elif [[ "$1" = "--help" ]]; then
usage
exit 0
elif [ $# -eq 1 ]; then
case $1 in
elif [[ $# -eq 1 ]]; then
case "$1" in
--server)
log=$CLUSTER_PATH/$SHARD_NAME/server_log.txt
log="$CLUSTER_PATH/$SHARD_NAME/server_log.txt"
;;
--chat)
log=$CLUSTER_PATH/$SHARD_NAME/server_log_chat.txt
log="$CLUSTER_PATH/$SHARD_NAME/server_log_chat.txt"
;;
esac
fi

if [ -n "$log" ]; then
if [ -f $log ]; then
exec cat $log
if [[ -n "$log" ]]; then
if [[ -f "$log" ]]; then
exec cat "$log"
fi
else
usage 1>&2
Expand Down
74 changes: 42 additions & 32 deletions build/static/bin/start.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
#!/usr/bin/env bash

usage(){
cat $DSTA_HOME/doc/start.usage
usage() {
cat "$DSTA_HOME/doc/start.usage"
}

if [ $# -eq 0 ]; then
update=0
elif [ $1 == "--help" ]; then
update=0

if [[ $# -eq 0 ]]; then
true # no-op
elif [[ "$1" = "--help" ]]; then
usage
exit 0
elif [ $# -eq 1 ]; then
case $1 in
--update=all)
update=3
;;
--update=none)
update=0
;;
--update=game)
update=1
;;
--update=mods)
update=2
;;
esac
fi

if [ -z "$update" ]; then
usage 1>&2
exit 1
else
while [[ "$#" -gt 0 ]]
do
key="$1"
case "$key" in
--update=all)
update=3
;;
--update=none)
update=0
;;
--update=game)
update=1
;;
--update=mods)
update=2
;;
--keep-configuration=*)
keep="${key#*=}"
keep="${keep//,/ }"
;;
*)
usage 1>&2
exit 1
;;
esac
shift
done
fi

if (((update & 1) != 0)); then
$DSTA_HOME/dst/update.sh
"$DSTA_HOME/dst/update.sh"
fi

if (((update & 2) == 0)); then
flag="-skip_update_server_mods"
fi

$DSTA_HOME/boot/token.sh
$DSTA_HOME/boot/settings.sh
$DSTA_HOME/boot/lists.sh
$DSTA_HOME/boot/world.sh
$DSTA_HOME/boot/mods.sh
"$DSTA_HOME"/boot/token.sh "$keep"
"$DSTA_HOME"/boot/settings.sh "$keep"
"$DSTA_HOME"/boot/lists.sh "$keep"
"$DSTA_HOME"/boot/world.sh "$keep"
"$DSTA_HOME"/boot/mods.sh "$keep"

exec dontstarve_dedicated_server_nullrenderer $flag
exec dontstarve_dedicated_server_nullrenderer "$flag"
Loading

0 comments on commit fb8676c

Please sign in to comment.