mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 06:11:18 +00:00
Implement server restarting via messages.xml.
Trim down the container to only what it really needs. Upgrade containers to bookworm. Upgrade web's node to 20. Add bercon to the web container. Remove rcon from the server container. Remove motd text from config. Add roadmap and update docs.
This commit is contained in:
parent
c5b20334e1
commit
088d5d3e51
8 changed files with 90 additions and 60 deletions
|
@ -10,10 +10,12 @@ This project started when the Linux DayZ server was released for DayZ experiment
|
|||
|
||||
* Some mods are known to crash the server on startup:
|
||||
* [DayZ Expansion AI](https://steamcommunity.com/sharedfiles/filedetails/?id=2792982069)
|
||||
* [Red Falcon Flight System Heliz](https://steamcommunity.com/workshop/filedetails/?id=2692979668)
|
||||
* [Red Falcon Flight System Heliz](https://steamcommunity.com/workshop/filedetails/?id=2692979668) - Bug report [here](https://feedback.bistudio.com/T176564)
|
||||
* Some mods work, but have bugs:
|
||||
* [DayZ Expansion Groups](https://steamcommunity.com/sharedfiles/filedetails/?id=2792983364)
|
||||
* The save file becomes corrupted and when the server restarts so the changes do not persist.
|
||||
* There are other bugs:
|
||||
* (Server doesn't stop with SIGTERM)[https://feedback.bistudio.com/T170721]
|
||||
|
||||
This project is a work in progress: See the [roadmap](ROADMAP.md).
|
||||
|
||||
|
|
26
ROADMAP.md
26
ROADMAP.md
|
@ -6,13 +6,29 @@
|
|||
* Login to Steam
|
||||
* Install base files
|
||||
* Search for mods
|
||||
* Currently using the Steam Web API, which requires a developer key.
|
||||
* Add / Remove / Update mods
|
||||
* Create a server
|
||||
* Configure server settings
|
||||
*
|
||||
* Server manager
|
||||
* Activate / Deactivate mods
|
||||
* Change mod settings
|
||||
* Change server settings
|
||||
* Update server files
|
||||
* Start / Stop / Restart server
|
||||
* Start / Stop / Restart server
|
||||
* Server RCON
|
||||
* Server manager mod with web interface
|
||||
* Server RCON UI
|
||||
* Send commands
|
||||
|
||||
* Server management
|
||||
* Docker compose
|
||||
* Spin up a server
|
||||
* Activate / Deactivate mods
|
||||
* Change server settings via a UI
|
||||
* RCON
|
||||
* XML / JSON file manager
|
||||
* Add / remove / update values.
|
||||
* Validate XML / JSON
|
||||
|
||||
|
||||
Unsorted:
|
||||
|
||||
Server status shows storage age, stats
|
|
@ -65,8 +65,8 @@ services:
|
|||
# - 2303:2303/udp
|
||||
# # Steam port
|
||||
# - 27016:27016/udp
|
||||
# Always restart, unless stopped
|
||||
restart: unless-stopped
|
||||
# The server script execs itself when the server exits, unless told not to by `dz stop`
|
||||
restart: no
|
||||
# Allows attaching a debugger from the host
|
||||
# cap_add:
|
||||
# - SYS_PTRACE
|
||||
|
|
14
files/messages.xml
Normal file
14
files/messages.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<messages>
|
||||
<message>
|
||||
<deadline>240</deadline>
|
||||
<shutdown>1</shutdown>
|
||||
<text>The server will restart in #tmin minutes...</text>
|
||||
</message>
|
||||
<message>
|
||||
<delay>1</delay>
|
||||
<repeat>30</repeat>
|
||||
<onconnect>1</onconnect>
|
||||
<text>Welcome to #name!</text>
|
||||
</message>
|
||||
</messages>
|
|
@ -30,7 +30,7 @@ loginQueueMaxPlayers=500; // The maximum number of players that can wait i
|
|||
|
||||
instanceId = 1; // DayZ server instance id, to identify the number of instances per box and their storage folders with persistence files
|
||||
storageAutoFix = 1; // Checks if the persistence files are corrupted and replaces corrupted ones with empty ones (value 0-1)
|
||||
motd[] = {"This line never shows up...", "DayZ on Linux for Linux"}; // Message of the day displayed in the in-game chat
|
||||
motd[] = {"", ""}; // Message of the day displayed in the in-game chat
|
||||
|
||||
respawnTime = 0; // Sets the respawn delay (in seconds) before the player is able to get a new character on the server, when the previous one is dead
|
||||
motdInterval = 300; // Time interval (in seconds) between each message
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
FROM debian:bullseye
|
||||
FROM debian:bookworm
|
||||
|
||||
# Set debconf to run non-interactively and agree to the SteamCMD EULA
|
||||
# Replace shell with bash so we can source files
|
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
|
||||
|
||||
# Set debconf to run non-interactively
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||
|
||||
# Add contrib and backports
|
||||
RUN sed -i /etc/apt/sources.list -e 's/main/main contrib non-free/'
|
||||
|
||||
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main non-free' >> /etc/apt/sources.list
|
||||
# Add backports and contrib
|
||||
RUN sed -i /etc/apt/sources.list.d/debian.sources -e 's/Components: main/Components: main contrib non-free/g'
|
||||
|
||||
# Install _only_ the necessary packages
|
||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
git \
|
||||
gwenhywfar-tools \
|
||||
jq \
|
||||
libsdl2-2.0-0 \
|
||||
|
@ -21,13 +19,10 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-reco
|
|||
locales \
|
||||
nano \
|
||||
patch \
|
||||
python3 \
|
||||
procps \
|
||||
wget \
|
||||
xmlstarlet
|
||||
|
||||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
|
||||
|
||||
# Set the locale
|
||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||
ENV LANG en_US.UTF-8
|
||||
|
@ -37,9 +32,6 @@ ENV LC_ALL en_US.UTF-8
|
|||
# Add our scripts directory to PATH
|
||||
ENV PATH /files/bin:/server/bin:${PATH}
|
||||
|
||||
# Add py3rcon
|
||||
RUN cd /usr/local && git clone https://github.com/indepth666/py3rcon.git
|
||||
|
||||
# Setup a non-privileged user
|
||||
ARG USER_ID
|
||||
|
||||
|
@ -54,6 +46,6 @@ USER user
|
|||
# The dayzserver script expects a home directory to itself.
|
||||
WORKDIR /home/user
|
||||
|
||||
# Run the server.
|
||||
# Run the server. The use of both ENTRYPOINT and CMD is to allow for development mode.
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
CMD ["start.sh"]
|
||||
|
|
|
@ -81,7 +81,7 @@ loadconfig(){
|
|||
fi
|
||||
if [ "${passwd}" == "" ]
|
||||
then
|
||||
printf "[ ${red}FAIL${default} ] Could not generate a passwort for RCON!\nOpen the Battleye config with 'dayzserver rcon'."
|
||||
printf "[ ${red}FAIL${default} ] Could not generate a passwort for RCON!\n"
|
||||
exit 1
|
||||
else
|
||||
cat > "${BE_SERVER_FILE}" <<EOF
|
||||
|
@ -102,11 +102,6 @@ EOF
|
|||
passwd=$(grep RConPassword ${FILE} | awk '{print $2}')
|
||||
# printf "[ ${cyan}INFO${default} ] Using existing RCON password: ${yellow}${passwd}${default}\n"
|
||||
fi
|
||||
cp /usr/local/py3rcon/configexample.json ~/py3rcon.config.json
|
||||
jq --arg port 2303 --arg rcon_password b0fNIBVfkM \
|
||||
'.logfile="py3rcon.log" | .loglevel=0 | .server.port=$port | .server.rcon_password=$rcon_password | del(.repeatMessage)' \
|
||||
/usr/local/py3rcon/configexample.json \
|
||||
> ~/py3rcon.config.json
|
||||
}
|
||||
|
||||
# Make sure to clean up and report on exit, as these files remain in the container's volume
|
||||
|
@ -130,8 +125,9 @@ report() {
|
|||
# Back these files up into a new directory with the current time stamp in the name
|
||||
DIR="${SERVER_PROFILE}/logs/$(date +%Y-%m-%d-%H-%M-%S)"
|
||||
mkdir -p ${DIR}
|
||||
cd ${SERVER_PROFILE}
|
||||
mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null
|
||||
pushd ${SERVER_PROFILE} > /dev/null
|
||||
mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null || true
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
mergexml(){
|
||||
|
@ -151,6 +147,17 @@ mergexml(){
|
|||
-o -name "init.c" \
|
||||
\) -exec cp -v {} ${SERVER_FILES}{} \;
|
||||
|
||||
# Same for any files in the db subdirectory we may modify
|
||||
find /mpmissions/${MAP}/db \( \
|
||||
-name "messages.xml" \
|
||||
\) -exec cp -v {} ${SERVER_FILES}{} \;
|
||||
|
||||
# For now let's just replace the file instead of merging, as the upstream file has nothing in it.
|
||||
if [ -f ${FILES}/messages.xml ]
|
||||
then
|
||||
cp -v ${FILES}/messages.xml ${MPMISSIONS}/${MAP}/db/messages.xml
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
# Remove previously copied keys and restore the default key
|
||||
|
@ -376,6 +383,8 @@ start(){
|
|||
done
|
||||
exit 0
|
||||
fi
|
||||
# Clean up from previous runs
|
||||
rm -f ${SERVER_FILES}/dont_restart
|
||||
# Ensure mpmissions has at least one map. If not, copy it from the local read-only volume that stores pristine mpmissons directories
|
||||
if [ ! -d "${MPMISSIONS}/${MAP}" ] && [ -d "/mpmissions/${MAP}" ]
|
||||
then
|
||||
|
@ -384,10 +393,6 @@ start(){
|
|||
echo
|
||||
cp -av /mpmissions/${MAP} ${MPMISSIONS}
|
||||
fi
|
||||
# Do the report on exit. Set here so that it only happens once we're starting the server, and not for other actions.
|
||||
trap '
|
||||
report
|
||||
' EXIT
|
||||
get_mods
|
||||
mergexml
|
||||
if [[ ${DONT_START} != "" ]]
|
||||
|
@ -408,25 +413,28 @@ start(){
|
|||
echo ${parameters} > /tmp/parameters
|
||||
./DayZServer "${mod_command_line}" ${parameters}
|
||||
EXIT_CODE=$?
|
||||
if [ -f ${SERVER_FILES}/restart ]
|
||||
then
|
||||
rm -f ${SERVER_FILES}/restart
|
||||
EXIT_CODE=42
|
||||
fi
|
||||
printf "\n[ ${yellow}DayZ${default} ] Server exited. Exit code: ${EXIT_CODE}\n"
|
||||
exit ${EXIT_CODE}
|
||||
report
|
||||
if [ -f ${SERVER_FILES}/dont_restart ]
|
||||
then
|
||||
printf "\n[ ${red}DayZ${default} ] Server script exiting, container shutting down...\n"
|
||||
else
|
||||
printf "\n[ ${green}DayZ${default} ] Restarting server\n"
|
||||
exec dz start
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Restarts the server by forcing an exit code other than 0, causing docker to restart the container.
|
||||
restart(){
|
||||
touch "${SERVER_FILES}/restart"
|
||||
echo "Restarting DayZ server..."
|
||||
kill -TERM $(pidof DayZServer)
|
||||
}
|
||||
|
||||
# Stops the server cleanly and exits 0, which will stop the container.
|
||||
# Stops the server but does not restart it.
|
||||
stop(){
|
||||
echo "Stopping DayZ server..."
|
||||
touch "${SERVER_FILES}/dont_restart"
|
||||
kill -TERM $(pidof DayZServer)
|
||||
}
|
||||
|
||||
|
@ -503,11 +511,6 @@ activate(){
|
|||
status
|
||||
}
|
||||
|
||||
# Our internal RCON
|
||||
rcon(){
|
||||
exec /usr/local/py3rcon/py3rcon.py --gui ~/py3rcon.config.json
|
||||
}
|
||||
|
||||
# List mods
|
||||
activelist(){
|
||||
X=1
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
FROM debian:bullseye
|
||||
FROM debian:bookworm
|
||||
|
||||
# Replace shell with bash so we can source files
|
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
|
||||
|
||||
# Set debconf to run non-interactively and agree to the SteamCMD EULA
|
||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
|
||||
|
@ -6,16 +9,11 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
|
|||
&& echo steam steam/license note '' | debconf-set-selections \
|
||||
&& dpkg --add-architecture i386
|
||||
|
||||
# Add contrib and backports
|
||||
RUN sed -i /etc/apt/sources.list -e 's/main/main contrib non-free/'
|
||||
|
||||
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main non-free' >> /etc/apt/sources.list
|
||||
# Add backports and contrib
|
||||
RUN sed -i /etc/apt/sources.list.d/debian.sources -e 's/Components: main/Components: main contrib non-free/g'
|
||||
|
||||
# Install _only_ the necessary packages
|
||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
||||
curl \
|
||||
ca-certificates \
|
||||
git \
|
||||
gwenhywfar-tools \
|
||||
jq \
|
||||
libxml2-utils \
|
||||
|
@ -40,11 +38,11 @@ ENV PATH /usr/games:/files/bin:/web/bin:${PATH}
|
|||
# Install nodejs
|
||||
RUN mkdir /usr/local/nvm
|
||||
ENV NVM_DIR /usr/local/nvm
|
||||
ENV NODE_VERSION 18.18.2
|
||||
ENV NODE_VERSION 20.12.2
|
||||
RUN echo $NODE_VERSION
|
||||
|
||||
# Install nvm with node and npm
|
||||
RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
|
||||
RUN wget -O - https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
|
||||
&& . $NVM_DIR/nvm.sh \
|
||||
&& nvm install $NODE_VERSION \
|
||||
&& nvm alias default $NODE_VERSION \
|
||||
|
@ -64,6 +62,11 @@ RUN groupadd -g ${USER_ID} user && \
|
|||
# Shut steamcmd up
|
||||
RUN cd /usr/lib/i386-linux-gnu && ln -s /web/bin/steamservice.so
|
||||
|
||||
# Add bercon https://github.com/WoozyMasta/bercon
|
||||
RUN wget https://github.com/WoozyMasta/bercon/releases/download/1.0.0/bercon \
|
||||
&& chmod +x bercon \
|
||||
&& mv bercon /usr/bin
|
||||
|
||||
# Use our non-privileged user
|
||||
USER user
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue