Updated to newer server, steamcmd fixes + improvements, Steam Guard support
parent
fe474b0305
commit
198d6897d7
35
Dockerfile
35
Dockerfile
|
@ -1,35 +1,44 @@
|
|||
FROM didstopia/base:nodejs-steamcmd-ubuntu-16.04
|
||||
FROM didstopia/base:steamcmd-ubuntu-20.04
|
||||
|
||||
MAINTAINER Didstopia <support@didstopia.com>
|
||||
LABEL maintainer="Didstopia <support@didstopia.com>"
|
||||
|
||||
# Fixes apt-get warnings
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# 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
|
||||
# Create the volume directories
|
||||
RUN mkdir -p /steamcmd/starbound
|
||||
VOLUME ["/steamcmd/starbound"]
|
||||
|
||||
# Add the steamcmd installation script
|
||||
ADD install.txt /install.txt
|
||||
ADD install.txt /app/install.txt
|
||||
|
||||
# Copy the startup script
|
||||
ADD start_starbound.sh /start.sh
|
||||
ADD start.sh /app/start.sh
|
||||
|
||||
# Set the current working directory
|
||||
WORKDIR /
|
||||
|
||||
# Fix permissions
|
||||
RUN chown -R 1000:1000 \
|
||||
/steamcmd \
|
||||
/app
|
||||
|
||||
# Run as a non-root user by default
|
||||
ENV PGID 1000
|
||||
ENV PUID 1000
|
||||
|
||||
# Expose necessary ports
|
||||
EXPOSE 21025/tcp
|
||||
|
||||
# Setup default environment variables for the server
|
||||
ENV STEAM_USERNAME ""
|
||||
ENV STEAM_PASSWORD ""
|
||||
ENV SKIP_STEAMCMD ""
|
||||
|
||||
# Define directories to take ownership of
|
||||
ENV CHOWN_DIRS "/app,/steamcmd"
|
||||
|
||||
# Expose the volumes
|
||||
VOLUME [ "/app.steam", "/steamcmd/starbound" ]
|
||||
|
||||
# Start the server
|
||||
ENTRYPOINT ["./start.sh"]
|
||||
CMD [ "bash", "/app/start.sh"]
|
||||
|
|
15
README.md
15
README.md
|
@ -7,7 +7,10 @@
|
|||
2. Optionally mount ```/steamcmd/starbound``` somewhere on the host or inside another container to keep your data safe
|
||||
3. Enjoy!
|
||||
|
||||
*Be sure to edit `starbound_server.config` to further customize your installation.*
|
||||
Be sure to edit `/steamcmd/starbound/storage/starbound_server.config` to customize your server's settings.
|
||||
Save files can be found under `/steamcmd/starbound/storage/universe` and mods under `/steamcmd/starbound/mods`.
|
||||
|
||||
Note that you can also mount `/app/.steam` to persist logs etc. from `steamcmd`.
|
||||
|
||||
The following environment variables are available:
|
||||
```
|
||||
|
@ -16,6 +19,16 @@ STEAM_PASSWORD (DEFAULT: "" - Required for installing/updating Starbound)
|
|||
SKIP_STEAMCMD (DEFAULT: "" - Optional for skipping updating Starbound)
|
||||
```
|
||||
|
||||
# Steam Guard
|
||||
|
||||
If you have Steam Guard enabled, which let's face it: most of us do, you will need to do a few things differently.
|
||||
|
||||
1. Run the container with both `-i` (`stdin_open: true` in Compose) and `-t` (`tty: true` in Compose) arguments, which effectively allows for direct interaction
|
||||
2. Be ready to attach to the container as soon as you launch it, as you will need to relatively quickly be able to provide the authentication code (eg. `docker attach starbound-server`, enter the auth code and detach by pressing `CTRL-p` followed by `CTRL-q`)
|
||||
3. This should now keep you logged in, at least until the authentication token expires, at which point you can simply do these steps again
|
||||
|
||||
NOTE: At some point we may make a less tedious workaround for this, such as a web interface which can be used to securely manage the Steam session, credentials and Steam Guard authentication codes.
|
||||
|
||||
# Updating the server
|
||||
|
||||
As long as you have both your `STEAM_USERNAME` and `STEAM_PASSWORD` set, simply restarting the container should trigger the update procedure.
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
services:
|
||||
starbound-server:
|
||||
image: didstopia/starbound-server:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
env_file: .env
|
||||
stdin_open: true # docker run -i
|
||||
tty: true # docker run -t
|
||||
ports:
|
||||
- "21025:21025/tcp"
|
||||
volumes:
|
||||
- starbound-data:/steamcmd/starbound:cached
|
||||
- starbound-steam:/app/.steam:cached
|
||||
|
||||
volumes:
|
||||
starbound-data:
|
||||
starbound-steam:
|
|
@ -1,6 +1,6 @@
|
|||
@sSteamCmdForcePlatformType linux
|
||||
login anonymous
|
||||
force_install_dir /steamcmd/starbound
|
||||
login anonymous
|
||||
app_info_update 1
|
||||
app_update 533830 validate
|
||||
app_update 211820 validate
|
||||
quit
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Enable debugging
|
||||
# set -x
|
||||
|
||||
# Setup error handling
|
||||
set -o pipefail # trace ERR through pipes
|
||||
set -o errtrace # trace ERR through 'time command' and other functions
|
||||
set -o nounset # set -u : exit the script if you try to use an uninitialised variable
|
||||
set -o errexit # set -e : exit the script if any statement returns a non-true return value
|
||||
|
||||
# Print the user we're currently running as
|
||||
echo "Running as user: $(whoami)"
|
||||
|
||||
# Define the exit handler
|
||||
exit_handler()
|
||||
{
|
||||
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
|
||||
trap 'exit_handler' SIGHUP SIGINT SIGQUIT SIGTERM
|
||||
|
||||
# Define the install/update function
|
||||
install_or_update()
|
||||
{
|
||||
# Install Starbound from install.txt
|
||||
echo "Installing or updating Starbound.. (this might take a while, be patient)"
|
||||
steamcmd +runscript /app/install.txt
|
||||
|
||||
# Terminate if exit code wasn't zero
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Exiting, steamcmd install or update failed!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check that username and password are both set
|
||||
if [ ! -z "$STEAM_USERNAME" ] && [ ! -z "$STEAM_PASSWORD" ]; then
|
||||
# Setup username/password for Steam
|
||||
sed -i "s/login anonymous/login $STEAM_USERNAME $STEAM_PASSWORD/g" /app/install.txt
|
||||
|
||||
## FIXME: If we do this, then the installation will prompt us again for the Auth Code, not sure why?!
|
||||
# # Attempt to login
|
||||
# steamcmd +login $STEAM_USERNAME $STEAM_PASSWORD +quit
|
||||
else
|
||||
echo "Missing STEAM_USERNAME and/or STEAM_PASSWORD, unable to continue!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the necessary folder structure
|
||||
if [ ! -d "/steamcmd/starbound" ]; then
|
||||
echo "Missing /steamcmd/starbound, creating.."
|
||||
mkdir -p /steamcmd/starbound
|
||||
fi
|
||||
|
||||
# Check that Starbound exists in the first place
|
||||
if [ ! -f "/steamcmd/starbound/linux/starbound_server" ]; then
|
||||
# Install or update Starbound
|
||||
install_or_update
|
||||
else
|
||||
# Check if we should skip updates
|
||||
if [ ! -z "$SKIP_STEAMCMD" ]; then
|
||||
echo "Skip steamcmd set, skipping update checks.."
|
||||
else
|
||||
# Install or update Starbound
|
||||
install_or_update
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the working directory
|
||||
cd /steamcmd/starbound/linux || exit 1
|
||||
|
||||
# Run the server
|
||||
echo ""
|
||||
echo "Starting Starbound.."
|
||||
echo ""
|
||||
/steamcmd/starbound/linux/starbound_server 2>&1 &
|
||||
|
||||
# Get the PID of the server
|
||||
child=$!
|
||||
|
||||
# Wait until the server stops
|
||||
wait "$child"
|
|
@ -1,79 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Define the exit handler
|
||||
exit_handler()
|
||||
{
|
||||
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
|
||||
trap 'exit_handler' SIGHUP SIGINT SIGQUIT SIGTERM
|
||||
|
||||
# Create the necessary folder structure
|
||||
if [ ! -d "/steamcmd/starbound/linux" ]; then
|
||||
echo "Creating folder structure.."
|
||||
mkdir -p /steamcmd/starbound/linux
|
||||
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
|
||||
if [ ! -z "$STEAM_USERNAME" ] || [ ! -z "$STEAM_PASSWORD" ]; then
|
||||
# Setup username/password for Steam
|
||||
sed -i "s/login anonymous/login $STEAM_USERNAME $STEAM_PASSWORD/g" /install.txt
|
||||
fi
|
||||
|
||||
# Check that Starbound exists in the first place
|
||||
if [ ! -f "/steamcmd/starbound/linux/starbound_server" ]; then
|
||||
# Check that username and password are both set, otherwise quit with error
|
||||
if [ -z "$STEAM_USERNAME" ] || [ -z "$STEAM_PASSWORD" ]; then
|
||||
echo "Error: you must set both your Steam username and password to install the server"
|
||||
exit 1
|
||||
fi
|
||||
# Install Starbound from install.txt
|
||||
echo ""
|
||||
echo "Installing Starbound.."
|
||||
echo ""
|
||||
bash /steamcmd/steamcmd.sh +runscript /install.txt
|
||||
else
|
||||
# Check that username and password are both set, otherwise skip update
|
||||
if [ -z "$STEAM_USERNAME" ] || [ -z "$STEAM_PASSWORD" ]; then
|
||||
if [ -z "$SKIP_STEAMCMD" ]; then
|
||||
echo "Steam username or password not set, exiting.."
|
||||
exit 1
|
||||
else
|
||||
echo "Steam username or password not set, skipping update.."
|
||||
fi
|
||||
else
|
||||
# Install Starbound from install.txt
|
||||
echo ""
|
||||
echo "Updating Starbound.."
|
||||
echo ""
|
||||
bash /steamcmd/steamcmd.sh +runscript /install.txt
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set the working directory
|
||||
cd /steamcmd/starbound/linux || exit
|
||||
|
||||
# Run the server
|
||||
echo ""
|
||||
echo "Starting Starbound.."
|
||||
echo ""
|
||||
./starbound_server 2>&1 &
|
||||
|
||||
child=$!
|
||||
wait "$child"
|
Loading…
Reference in New Issue