Fixes and enhancements.

- Fixed potential startup and shutdown issues
- Switched to a dedicated version of the server
- Added a default configuration to avoid potential IP address binding issues
- Added the ability to add unit tests in the future
master
Pauli Jokela 2018-01-10 11:42:11 +02:00
parent 8d8747bf02
commit a3afa73b75
7 changed files with 122 additions and 32 deletions

View File

@ -1,32 +1,15 @@
FROM ubuntu:16.04
FROM didstopia/base:nodejs-steamcmd-ubuntu-16.04
MAINTAINER didstopia
MAINTAINER Didstopia <support@didstopia.com>
# Fixes apt-get warnings
ARG DEBIAN_FRONTEND=noninteractive
# Setup the locales
RUN apt-get clean && apt-get update && apt-get install -y apt-utils locales && locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
# Run a quick apt-get update/upgrade
RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get autoremove -y
# Install dependencies, mainly for SteamCMD
RUN apt-get install -y \
ca-certificates \
software-properties-common \
python-software-properties \
lib32gcc1 \
libstdc++6 \
curl \
wget \
libvorbisfile3
# Run as root
USER root
# Install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
net-tools && \
rm -rf /var/lib/apt/lists/*
# Create and set the steamcmd folder as a volume
RUN mkdir -p /steamcmd/starbound
@ -38,6 +21,9 @@ ADD install.txt /install.txt
# Copy the startup script
ADD start_starbound.sh /start.sh
# Copy the default configuration file
ADD starbound_server.default.config /starbound_server.default.config
# Set the current working directory
WORKDIR /

View File

@ -1,8 +1,13 @@
#!/bin/bash
# Build changes (if necessary)
./docker_build.sh
# Run a vanilla server
docker run -p 0.0.0.0:21025:21025/tcp --env-file .env -v $(pwd)/starbound_data:/steamcmd/starbound --name starbound-server -d didstopia/starbound-server:latest
# Run a container
docker run -p 0.0.0.0:21025:21025/tcp --env-file .env -v "$(pwd)/starbound_data:/steamcmd/starbound" --name starbound-server -it --rm didstopia/starbound-server:latest
docker logs -f starbound-server
# Edit unit tests
#dgoss edit -p 0.0.0.0:21025:21025/tcp --env-file .env -v "$(pwd)/starbound_data:/steamcmd/starbound" --name starbound-server -d didstopia/starbound-server:latest
# Run unit tests (production)
#GOSS_WAIT_OPTS="--retry-timeout 300s --sleep 1s > /dev/null" GOSS_SLEEP="15" dgoss run -p 0.0.0.0:21025:21025/tcp --env-file .env -v "$(pwd)/starbound_data:/steamcmd/starbound" --name starbound-server -d didstopia/starbound-server

13
goss.yaml Normal file
View File

@ -0,0 +1,13 @@
command:
ps -eo comm | tee /tmp/what_do_i_see:
title: Starbound Server should be running
exit-status: 0
stdout:
- starbound_serve
port:
tcp:21025:
title: Starbound Server should be accepting TCP connections on port 21025
listening: true
## TODO: Test graceful shutdown

11
goss_wait.yaml Normal file
View File

@ -0,0 +1,11 @@
command:
ps -eo comm | tee /tmp/what_do_i_see:
title: Starbound Server should be running
exit-status: 0
stdout:
- starbound_serve
port:
tcp:21025:
title: Starbound Server should be accepting TCP connections on port 21025
listening: true

View File

@ -2,5 +2,5 @@
login anonymous
force_install_dir /steamcmd/starbound
app_info_update 1
app_update 211820 validate
app_update 533830 validate
quit

View File

@ -0,0 +1,50 @@
{
"allowAdminCommands" : true,
"allowAdminCommandsFromAnyone" : false,
"allowAnonymousConnections" : true,
"allowAssetsMismatch" : true,
"anonymousConnectionsAreAdmin" : false,
"bannedIPs" : [],
"bannedUuids" : [],
"checkAssetsDigest" : false,
"clearPlayerFiles" : false,
"clearUniverseFiles" : false,
"clientIPJoinable" : false,
"clientP2PJoinable" : true,
"configurationVersion" : {
"basic" : 2,
"server" : 4
},
"crafting" : {
"filterHaveMaterials" : false
},
"gameServerBind" : "0.0.0.0",
"gameServerPort" : 21025,
"interactiveHighlight" : true,
"inventory" : {
"pickupToActionBar" : true
},
"maxPlayers" : 8,
"maxTeamSize" : 4,
"monochromeLighting" : false,
"playerBackupFileCount" : 3,
"queryServerBind" : "::",
"queryServerPort" : 21025,
"rconServerBind" : "::",
"rconServerPassword" : "",
"rconServerPort" : 21026,
"rconServerTimeout" : 1000,
"runQueryServer" : false,
"runRconServer" : false,
"safeScripts" : true,
"scriptInstructionLimit" : 10000000,
"scriptInstructionMeasureInterval" : 10000,
"scriptProfilingEnabled" : false,
"scriptRecursionLimit" : 100,
"serverFidelity" : "automatic",
"serverName" : "A Starbound Server",
"serverOverrideAssetsDigest" : null,
"serverUsers" : {
},
"tutorialMessages" : true
}

View File

@ -3,8 +3,16 @@
# Define the exit handler
exit_handler()
{
echo "Shutdown signal received"
echo ""
echo "Waiting for server to shutdown.."
echo ""
kill -SIGINT "$child"
sleep 5
echo ""
echo "Terminating.."
echo ""
exit
}
# Trap specific signals and forward to the exit handler
@ -17,7 +25,9 @@ if [ ! -d "/steamcmd/starbound/linux" ]; then
fi
# Install/update steamcmd
echo ""
echo "Installing/updating steamcmd.."
echo ""
curl -s http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar -v -C /steamcmd -zx
# Check that username and password are both set
@ -34,7 +44,9 @@ if [ ! -f "/steamcmd/starbound/linux/starbound_server" ]; then
exit 1
fi
# Install Starbound from install.txt
echo "Installing/updating Starbound.."
echo ""
echo "Installing Starbound.."
echo ""
bash /steamcmd/steamcmd.sh +runscript /install.txt
else
# Check that username and password are both set, otherwise skip update
@ -47,16 +59,29 @@ else
fi
else
# Install Starbound from install.txt
echo "Installing Starbound.."
echo ""
echo "Updating Starbound.."
echo ""
bash /steamcmd/steamcmd.sh +runscript /install.txt
fi
fi
# Set the working directory
cd /steamcmd/starbound/linux
cd /steamcmd/starbound/linux || exit
# Copy default configuration if necessary
if [ ! -f "/steamcmd/starbound/storage/starbound_server.config" ]; then
echo ""
echo "Copying default configuration.."
echo ""
mkdir -p /steamcmd/starbound/storage
cp -f /starbound_server.default.config /steamcmd/starbound/storage/starbound_server.config
fi
# Run the server
echo ""
echo "Starting Starbound.."
echo ""
./starbound_server 2>&1 &
child=$!