mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 14:21: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:
|
* Some mods are known to crash the server on startup:
|
||||||
* [DayZ Expansion AI](https://steamcommunity.com/sharedfiles/filedetails/?id=2792982069)
|
* [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:
|
* Some mods work, but have bugs:
|
||||||
* [DayZ Expansion Groups](https://steamcommunity.com/sharedfiles/filedetails/?id=2792983364)
|
* [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.
|
* 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).
|
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
|
* Login to Steam
|
||||||
* Install base files
|
* Install base files
|
||||||
* Search for mods
|
* Search for mods
|
||||||
|
* Currently using the Steam Web API, which requires a developer key.
|
||||||
* Add / Remove / Update mods
|
* Add / Remove / Update mods
|
||||||
* Create a server
|
* 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
|
* Start / Stop / Restart server
|
||||||
* Server manager mod with web interface
|
* Server RCON UI
|
||||||
|
* Send commands
|
||||||
|
|
||||||
* Server management
|
* 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
|
# - 2303:2303/udp
|
||||||
# # Steam port
|
# # Steam port
|
||||||
# - 27016:27016/udp
|
# - 27016:27016/udp
|
||||||
# Always restart, unless stopped
|
# The server script execs itself when the server exits, unless told not to by `dz stop`
|
||||||
restart: unless-stopped
|
restart: no
|
||||||
# Allows attaching a debugger from the host
|
# Allows attaching a debugger from the host
|
||||||
# cap_add:
|
# cap_add:
|
||||||
# - SYS_PTRACE
|
# - 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
|
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)
|
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
|
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
|
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
|
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
||||||
|
|
||||||
# Add contrib and backports
|
# Add backports and contrib
|
||||||
RUN sed -i /etc/apt/sources.list -e 's/main/main contrib non-free/'
|
RUN sed -i /etc/apt/sources.list.d/debian.sources -e 's/Components: main/Components: main contrib non-free/g'
|
||||||
|
|
||||||
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main non-free' >> /etc/apt/sources.list
|
|
||||||
|
|
||||||
# Install _only_ the necessary packages
|
# Install _only_ the necessary packages
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
||||||
curl \
|
|
||||||
ca-certificates \
|
|
||||||
git \
|
|
||||||
gwenhywfar-tools \
|
gwenhywfar-tools \
|
||||||
jq \
|
jq \
|
||||||
libsdl2-2.0-0 \
|
libsdl2-2.0-0 \
|
||||||
|
@ -21,13 +19,10 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-reco
|
||||||
locales \
|
locales \
|
||||||
nano \
|
nano \
|
||||||
patch \
|
patch \
|
||||||
python3 \
|
|
||||||
procps \
|
procps \
|
||||||
wget \
|
wget \
|
||||||
xmlstarlet
|
xmlstarlet
|
||||||
|
|
||||||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
|
|
||||||
|
|
||||||
# Set the locale
|
# Set the locale
|
||||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
|
||||||
ENV LANG en_US.UTF-8
|
ENV LANG en_US.UTF-8
|
||||||
|
@ -37,9 +32,6 @@ ENV LC_ALL en_US.UTF-8
|
||||||
# Add our scripts directory to PATH
|
# Add our scripts directory to PATH
|
||||||
ENV PATH /files/bin:/server/bin:${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
|
# Setup a non-privileged user
|
||||||
ARG USER_ID
|
ARG USER_ID
|
||||||
|
|
||||||
|
@ -54,6 +46,6 @@ USER user
|
||||||
# The dayzserver script expects a home directory to itself.
|
# The dayzserver script expects a home directory to itself.
|
||||||
WORKDIR /home/user
|
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"]
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
CMD ["start.sh"]
|
CMD ["start.sh"]
|
||||||
|
|
|
@ -81,7 +81,7 @@ loadconfig(){
|
||||||
fi
|
fi
|
||||||
if [ "${passwd}" == "" ]
|
if [ "${passwd}" == "" ]
|
||||||
then
|
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
|
exit 1
|
||||||
else
|
else
|
||||||
cat > "${BE_SERVER_FILE}" <<EOF
|
cat > "${BE_SERVER_FILE}" <<EOF
|
||||||
|
@ -102,11 +102,6 @@ EOF
|
||||||
passwd=$(grep RConPassword ${FILE} | awk '{print $2}')
|
passwd=$(grep RConPassword ${FILE} | awk '{print $2}')
|
||||||
# printf "[ ${cyan}INFO${default} ] Using existing RCON password: ${yellow}${passwd}${default}\n"
|
# printf "[ ${cyan}INFO${default} ] Using existing RCON password: ${yellow}${passwd}${default}\n"
|
||||||
fi
|
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
|
# 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
|
# 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)"
|
DIR="${SERVER_PROFILE}/logs/$(date +%Y-%m-%d-%H-%M-%S)"
|
||||||
mkdir -p ${DIR}
|
mkdir -p ${DIR}
|
||||||
cd ${SERVER_PROFILE}
|
pushd ${SERVER_PROFILE} > /dev/null
|
||||||
mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null
|
mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null || true
|
||||||
|
popd > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
mergexml(){
|
mergexml(){
|
||||||
|
@ -151,6 +147,17 @@ mergexml(){
|
||||||
-o -name "init.c" \
|
-o -name "init.c" \
|
||||||
\) -exec cp -v {} ${SERVER_FILES}{} \;
|
\) -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
|
echo
|
||||||
|
|
||||||
# Remove previously copied keys and restore the default key
|
# Remove previously copied keys and restore the default key
|
||||||
|
@ -376,6 +383,8 @@ start(){
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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
|
# 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}" ]
|
if [ ! -d "${MPMISSIONS}/${MAP}" ] && [ -d "/mpmissions/${MAP}" ]
|
||||||
then
|
then
|
||||||
|
@ -384,10 +393,6 @@ start(){
|
||||||
echo
|
echo
|
||||||
cp -av /mpmissions/${MAP} ${MPMISSIONS}
|
cp -av /mpmissions/${MAP} ${MPMISSIONS}
|
||||||
fi
|
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
|
get_mods
|
||||||
mergexml
|
mergexml
|
||||||
if [[ ${DONT_START} != "" ]]
|
if [[ ${DONT_START} != "" ]]
|
||||||
|
@ -408,25 +413,28 @@ start(){
|
||||||
echo ${parameters} > /tmp/parameters
|
echo ${parameters} > /tmp/parameters
|
||||||
./DayZServer "${mod_command_line}" ${parameters}
|
./DayZServer "${mod_command_line}" ${parameters}
|
||||||
EXIT_CODE=$?
|
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"
|
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.
|
# Restarts the server by forcing an exit code other than 0, causing docker to restart the container.
|
||||||
restart(){
|
restart(){
|
||||||
touch "${SERVER_FILES}/restart"
|
|
||||||
echo "Restarting DayZ server..."
|
echo "Restarting DayZ server..."
|
||||||
kill -TERM $(pidof DayZServer)
|
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(){
|
stop(){
|
||||||
echo "Stopping DayZ server..."
|
echo "Stopping DayZ server..."
|
||||||
|
touch "${SERVER_FILES}/dont_restart"
|
||||||
kill -TERM $(pidof DayZServer)
|
kill -TERM $(pidof DayZServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,11 +511,6 @@ activate(){
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
|
|
||||||
# Our internal RCON
|
|
||||||
rcon(){
|
|
||||||
exec /usr/local/py3rcon/py3rcon.py --gui ~/py3rcon.config.json
|
|
||||||
}
|
|
||||||
|
|
||||||
# List mods
|
# List mods
|
||||||
activelist(){
|
activelist(){
|
||||||
X=1
|
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
|
# Set debconf to run non-interactively and agree to the SteamCMD EULA
|
||||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections \
|
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 \
|
&& echo steam steam/license note '' | debconf-set-selections \
|
||||||
&& dpkg --add-architecture i386
|
&& dpkg --add-architecture i386
|
||||||
|
|
||||||
# Add contrib and backports
|
# Add backports and contrib
|
||||||
RUN sed -i /etc/apt/sources.list -e 's/main/main contrib non-free/'
|
RUN sed -i /etc/apt/sources.list.d/debian.sources -e 's/Components: main/Components: main contrib non-free/g'
|
||||||
|
|
||||||
RUN echo 'deb http://deb.debian.org/debian bullseye-backports main non-free' >> /etc/apt/sources.list
|
|
||||||
|
|
||||||
# Install _only_ the necessary packages
|
# Install _only_ the necessary packages
|
||||||
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
RUN apt-get update && apt-get -y upgrade && apt-get -y install --no-install-recommends \
|
||||||
curl \
|
|
||||||
ca-certificates \
|
|
||||||
git \
|
|
||||||
gwenhywfar-tools \
|
gwenhywfar-tools \
|
||||||
jq \
|
jq \
|
||||||
libxml2-utils \
|
libxml2-utils \
|
||||||
|
@ -40,11 +38,11 @@ ENV PATH /usr/games:/files/bin:/web/bin:${PATH}
|
||||||
# Install nodejs
|
# Install nodejs
|
||||||
RUN mkdir /usr/local/nvm
|
RUN mkdir /usr/local/nvm
|
||||||
ENV NVM_DIR /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
|
RUN echo $NODE_VERSION
|
||||||
|
|
||||||
# Install nvm with node and npm
|
# 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_DIR/nvm.sh \
|
||||||
&& nvm install $NODE_VERSION \
|
&& nvm install $NODE_VERSION \
|
||||||
&& nvm alias default $NODE_VERSION \
|
&& nvm alias default $NODE_VERSION \
|
||||||
|
@ -64,6 +62,11 @@ RUN groupadd -g ${USER_ID} user && \
|
||||||
# Shut steamcmd up
|
# Shut steamcmd up
|
||||||
RUN cd /usr/lib/i386-linux-gnu && ln -s /web/bin/steamservice.so
|
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
|
# Use our non-privileged user
|
||||||
USER user
|
USER user
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue