mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-07 06:41:17 +00:00
First working prototype. It "works", but it still segs, which is the problem I was hoping to fix. Bummer.
Add the dayzserver from upstream, but a modified version that doesn't do all the tmux stuff.
This commit is contained in:
parent
02dd72d0bf
commit
8eed898bd4
6 changed files with 190 additions and 52 deletions
40
Dockerfile
40
Dockerfile
|
@ -22,20 +22,46 @@ RUN apt-get update && apt-get -y upgrade && apt-get -y install \
|
||||||
curl \
|
curl \
|
||||||
lib32gcc-s1 \
|
lib32gcc-s1 \
|
||||||
lib32stdc++6 \
|
lib32stdc++6 \
|
||||||
|
locales \
|
||||||
psmisc \
|
psmisc \
|
||||||
wget \
|
wget \
|
||||||
rename
|
rename
|
||||||
|
|
||||||
|
# Set the locale
|
||||||
|
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
|
||||||
|
locale-gen
|
||||||
|
ENV LANG en_US.UTF-8
|
||||||
|
ENV LANGUAGE en_US:en
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
# Setup a non-privileged user
|
# Setup a non-privileged user
|
||||||
RUN groupadd -g 1000 user && \
|
RUN groupadd user && \
|
||||||
useradd -l -u ${USER_ID} -m -g user user
|
useradd -l -m -g user user
|
||||||
|
|
||||||
RUN chown user:user /home/user -R
|
# Add the server script.
|
||||||
|
# From https://steamcommunity.com/sharedfiles/filedetails/?id=1517338673
|
||||||
|
ADD dayzserver /home/user
|
||||||
|
|
||||||
USER ${USER_ID}
|
# Add the serverDZ.cfg from the same URL as above
|
||||||
|
ADD serverDZ.cfg /home/user
|
||||||
|
|
||||||
WORKDIR /work
|
# Add our wrapper too
|
||||||
|
ADD server.sh /home/user
|
||||||
|
|
||||||
COPY . /home/user
|
# Make sure the volumes can be written to by the local user
|
||||||
|
RUN cd /home/user && \
|
||||||
|
mkdir -p serverfiles serverprofile Steam steamcmd
|
||||||
|
|
||||||
CMD ["server.sh"]
|
# Create the files the dayzserver script expects so we can take charge of populating them
|
||||||
|
RUN cd /home/user && touch .steamlogin
|
||||||
|
|
||||||
|
RUN cd /home/user && chown user:user /home/user -R
|
||||||
|
|
||||||
|
# Use our non-privileged user
|
||||||
|
USER user
|
||||||
|
|
||||||
|
# The dayzserver script expects a home directory to itself.
|
||||||
|
WORKDIR /home/user
|
||||||
|
|
||||||
|
# Run the server.
|
||||||
|
CMD ["./server.sh"]
|
||||||
|
|
20
README.md
20
README.md
|
@ -1,3 +1,19 @@
|
||||||
# dayzdockerserver
|
# DayZDockerServer
|
||||||
|
|
||||||
A Linux DayZ server in a Docker container
|
A Linux DayZ server in a Docker container.
|
||||||
|
|
||||||
|
Edit docker-compose.yml and set the variables:
|
||||||
|
|
||||||
|
```
|
||||||
|
- STEAMLOGIN=yourSteamLogin
|
||||||
|
- SERVERNAME="DayZ on Linux for Linux"
|
||||||
|
```
|
||||||
|
The steam login is necessary as the server files require ownership
|
||||||
|
of the game.
|
||||||
|
|
||||||
|
Build the container, run it, tail the logs:
|
||||||
|
```
|
||||||
|
docker-compose build
|
||||||
|
docker-compose up -d
|
||||||
|
docker-compose logs -f dayzserver
|
||||||
|
```
|
56
dayzserver
56
dayzserver
|
@ -35,43 +35,14 @@ fn_checkroot_dayz(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_checktmux(){
|
|
||||||
if [ -n "${TMUX}" ]; then
|
|
||||||
printf "[ ${red}FAIL${default} ] The Script creates a tmux session when starting the server.\n"
|
|
||||||
printf "\tIt is not possible to run a tmux session inside another tmux session\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
fn_checkscreen(){
|
|
||||||
if [ -n "${STY}" ]; then
|
|
||||||
printf "[ ${red}FAIL${default} ] The Script creates a tmux session when starting the server.\n"
|
|
||||||
printf "\tIt is not possible to run a tmux session inside screen session\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
fn_loadconfig_dayz(){
|
fn_loadconfig_dayz(){
|
||||||
# default config
|
# default config
|
||||||
if [ ! -f "${HOME}/.default.cfg" ]; then
|
if [ ! -f "${HOME}/.default.cfg" ]; then
|
||||||
wget -P ${HOME}/ -qN https://raw.githubusercontent.com/thelastnoc/dayz-sa_linuxserver/master/script/.default.cfg
|
wget -P ${HOME}/ -qN https://raw.githubusercontent.com/thelastnoc/dayz-sa_linuxserver/master/script/.default.cfg
|
||||||
fi
|
fi
|
||||||
source ${HOME}/.default.cfg
|
source ${HOME}/.default.cfg
|
||||||
# script config
|
cp serverDZ.cfg "${HOME}/serverfiles/serverDZ.cfg"
|
||||||
if [ ! -f "${HOME}/.dayzserver.cfg" ] || [ "$(grep dayzparameter ${HOME}/.dayzserver.cfg)" == "" ]; then
|
sed -i "${HOME}/serverfiles/serverDZ.cfg" -e "s/EXAMPLE NAME/${SERVERNAME}/"
|
||||||
cp ${HOME}/.default.cfg ${HOME}/.dayzserver.cfg
|
|
||||||
fi
|
|
||||||
source ${HOME}/.dayzserver.cfg
|
|
||||||
# hostname/servername
|
|
||||||
if [ ! -f "${HOME}/serverfiles/serverDZ.cfg" ]; then
|
|
||||||
wget -P ${HOME}/serverfiles/ -q https://raw.githubusercontent.com/thelastnoc/dayz-sa_linuxserver/master/script/serverDZ.cfg
|
|
||||||
fi
|
|
||||||
defaultservername=$(grep -rwi ${HOME}/serverfiles/serverDZ.cfg -e 'EXAMPLE NAME')
|
|
||||||
if [ "${defaultservername}" != "" ]; then
|
|
||||||
printf "[ ${magenta}SERVER${default} ] Servername is set on default! 'EXAMPLE NAME'\n\n"
|
|
||||||
read -p "Enter a new Servername: " servername
|
|
||||||
sed -i "/hostname/ s/EXAMPLE NAME/${servername}/" "${HOME}/serverfiles/serverDZ.cfg"
|
|
||||||
fi
|
|
||||||
# battleye config and rconpassword setup
|
# battleye config and rconpassword setup
|
||||||
if [ ! -f "${HOME}/serverfiles/battleye/beserver_x64.cfg" ]; then
|
if [ ! -f "${HOME}/serverfiles/battleye/beserver_x64.cfg" ]; then
|
||||||
wget -P ${HOME}/serverfiles/battleye/ -qN https://raw.githubusercontent.com/thelastnoc/dayz-sa_linuxserver/master/script/beserver_x64.cfg
|
wget -P ${HOME}/serverfiles/battleye/ -qN https://raw.githubusercontent.com/thelastnoc/dayz-sa_linuxserver/master/script/beserver_x64.cfg
|
||||||
|
@ -100,21 +71,22 @@ fn_status_dayz(){
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_start_dayz(){
|
fn_start_dayz(){
|
||||||
fn_status_dayz
|
# fn_status_dayz
|
||||||
if [ "${dayzstatus}" == "1" ]; then
|
# if [ "${dayzstatus}" == "1" ]; then
|
||||||
printf "[ ${yellow}DayZ${default} ] Server already running.\n"
|
# printf "[ ${yellow}DayZ${default} ] Server already running.\n"
|
||||||
exit 1
|
# exit 1
|
||||||
else
|
# else
|
||||||
printf "[ ${green}DayZ${default} ] Starting server...\n"
|
printf "[ ${green}DayZ${default} ] Starting server...\n"
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
fn_loadconfig_dayz
|
fn_loadconfig_dayz
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
cd ${HOME}/serverfiles
|
cd ${HOME}/serverfiles
|
||||||
tmux new-session -d -x 23 -y 80 -s $(whoami)-tmux ./DayZServer $dayzparameter "$workshop"
|
exec ./DayZServer $dayzparameter "$workshop"
|
||||||
sleep 1
|
# tmux new-session -d -x 23 -y 80 -s $(whoami)-tmux ./DayZServer $dayzparameter "$workshop"
|
||||||
cd ${HOME}
|
# sleep 1
|
||||||
date > ${HOME}/.dayzlockfile
|
# cd ${HOME}
|
||||||
fi
|
# date > ${HOME}/.dayzlockfile
|
||||||
|
# fi
|
||||||
}
|
}
|
||||||
|
|
||||||
fn_stop_dayz(){
|
fn_stop_dayz(){
|
||||||
|
@ -451,8 +423,6 @@ fn_opt_usage(){
|
||||||
|
|
||||||
# start functions
|
# start functions
|
||||||
fn_checkroot_dayz
|
fn_checkroot_dayz
|
||||||
fn_checktmux
|
|
||||||
fn_checkscreen
|
|
||||||
|
|
||||||
getopt=$1
|
getopt=$1
|
||||||
if [ ! -f "${HOME}/steamcmd/steamcmd.sh" ] || [ ! -f "${HOME}/serverfiles/DayZServer" ] && [ "${getopt}" != "cfg" ]; then
|
if [ ! -f "${HOME}/steamcmd/steamcmd.sh" ] || [ ! -f "${HOME}/serverfiles/DayZServer" ] && [ "${getopt}" != "cfg" ]; then
|
||||||
|
|
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
steam:
|
||||||
|
steamcmd:
|
||||||
|
serverfiles:
|
||||||
|
serverprofile:
|
||||||
|
|
||||||
|
services:
|
||||||
|
|
||||||
|
dayzserver:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "2302:2302/udp"
|
||||||
|
- "27016:27016/udp"
|
||||||
|
volumes:
|
||||||
|
- steam:/home/user/Steam
|
||||||
|
- steamcmd:/home/user/steamcmd
|
||||||
|
- serverfiles:/home/user/serverfiles
|
||||||
|
- serverprofile:/home/user/serverprofile
|
||||||
|
environment:
|
||||||
|
- STEAMLOGIN=anonymous
|
||||||
|
# Escape any forwardslashes: SERVERNAME="My thing \/ My other thing"
|
||||||
|
- SERVERNAME=DayZ on Linux for Linux
|
20
server.sh
Executable file
20
server.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Make sure we don't start collecting core files
|
||||||
|
ulimit -c 0
|
||||||
|
|
||||||
|
# This script will take environment variables and put them into the files the script expects.
|
||||||
|
if ! grep STEAMLOGIN .steamlogin
|
||||||
|
then
|
||||||
|
echo "Setting the STEAMLOGIN..."
|
||||||
|
echo "steamlogin=${STEAMLOGIN}" > .steamlogin
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do something with SERVERNAME="DayZ on Linux for Linux"
|
||||||
|
if ! grep SERVERNAME serverDZ.cfg
|
||||||
|
then
|
||||||
|
echo "Setting the SERVERNAME..."
|
||||||
|
sed -i serverDZ.cfg -e "s/SERVERNAME/${SERVERNAME}/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
./dayzserver start || find /home/user -name error.log -exec cat {} \;
|
82
serverDZ.cfg
Normal file
82
serverDZ.cfg
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
hostname = "EXAMPLE NAME"; // Server name
|
||||||
|
password = ""; // Password to connect to the server
|
||||||
|
passwordAdmin = ""; // Password to become a server admin
|
||||||
|
|
||||||
|
maxPlayers = 60; // Maximum amount of players
|
||||||
|
|
||||||
|
verifySignatures = 2; // Verifies .pbos against .bisign files. (only 2 is supported)
|
||||||
|
|
||||||
|
forceSameBuild = 1; // When enabled, the server will allow the connection only to clients with same the .exe revision as the server (value 0-1)
|
||||||
|
|
||||||
|
disableVoN = 0; // Enable/disable voice over network (value 0-1)
|
||||||
|
vonCodecQuality = 20; // Voice over network codec quality, the higher the better (values 0-30)
|
||||||
|
|
||||||
|
disable3rdPerson=0; // Toggles the 3rd person view for players (value 0-1)
|
||||||
|
disableCrosshair=0; // Toggles the cross-hair (value 0-1)
|
||||||
|
|
||||||
|
serverTime="SystemTime"; // Initial in-game time of the server. "SystemTime" means the local time of the machine. Another possibility is to set the time to some value in "YYYY/MM/DD/HH/MM" format, f.e. "2015/4/8/17/23" .
|
||||||
|
serverTimeAcceleration=12; // Accelerated Time (value 0-24)// This is a time multiplier for in-game time. In this case, the time would move 24 times faster than normal, so an entire day would pass in one hour.
|
||||||
|
serverTimePersistent=0; // Persistent Time (value 0-1)// The actual server time is saved to storage, so when active, the next server start will use the saved time value.
|
||||||
|
|
||||||
|
guaranteedUpdates=1; // Communication protocol used with game server (use only number 1)
|
||||||
|
|
||||||
|
loginQueueConcurrentPlayers=5; // The number of players concurrently processed during the login process. Should prevent massive performance drop during connection when a lot of people are connecting at the same time.
|
||||||
|
loginQueueMaxPlayers=500; // The maximum number of players that can wait in login queue
|
||||||
|
|
||||||
|
instanceId = 1; // DayZ server instance id, to identify the number of instances per box and their storage folders with persistence files
|
||||||
|
lootHistory = 1; // How many persistence history files should be kept by instance, number is looped over during save
|
||||||
|
storeHouseStateDisabled = false;// Disable houses/doors persistence (value true/false), usable in case of problems with persistence
|
||||||
|
storageAutoFix = 1; // Checks if the persistence files are corrupted and replaces corrupted ones with empty ones (value 0-1)
|
||||||
|
|
||||||
|
respawnTime = 5; // 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
|
||||||
|
|
||||||
|
motd[] = {"line1","line2"}; // Message of the day displayed in the in-game chat
|
||||||
|
motdInterval = 1; // Time interval (in seconds) between each message
|
||||||
|
|
||||||
|
maxPing= 200; // Max ping value until server kick the user (value in milliseconds)
|
||||||
|
|
||||||
|
timeStampFormat = "Short"; // Format for timestamps in the .rpt file (value Full/Short)
|
||||||
|
logAverageFps = 1; // Logs the average server FPS (value in seconds), needs to have -dologs launch parameter active
|
||||||
|
logMemory = 1; // Logs the server memory usage (value in seconds), needs to have the -dologs launch parameter active
|
||||||
|
logPlayers = 1; // Logs the count of currently connected players (value in seconds), needs to have the -dologs launch parameter active
|
||||||
|
logFile = "server_console.log";// Saves the server console log to a file in the folder with the other server logs
|
||||||
|
|
||||||
|
|
||||||
|
adminLogPlayerHitsOnly = 0; // 1 - log player hits only / 0 - log all hits ( animals/infected )
|
||||||
|
adminLogPlacement = 0; // 1 - log placement action ( traps, tents )
|
||||||
|
adminLogBuildActions = 0; // 1 - log basebuilding actions ( build, dismantle, destroy )
|
||||||
|
adminLogPlayerList = 0; // 1 - log periodic player list with position every 5 minutes
|
||||||
|
|
||||||
|
enableDebugMonitor = 1; // shows info about the character using a debug window in a corner of the screen (value 0-1)
|
||||||
|
|
||||||
|
|
||||||
|
steamQueryPort = 2305; // defines Steam query port, should fix the issue with server not being visible in client server browser
|
||||||
|
|
||||||
|
allowFilePatching = 1; // if set to 1 it will enable connection of clients with "-filePatching" launch parameter enabled
|
||||||
|
|
||||||
|
simulatedPlayersBatch = 20; // Set limit of how much players can be simulated per frame (for server performance gain)
|
||||||
|
|
||||||
|
multithreadedReplication = 1; // enables multi-threaded processing of server's replication system
|
||||||
|
// number of worker threads is derived by settings of jobsystem in dayzSettings.xml by "maxcores" and "reservedcores" parameters (value 0-1)
|
||||||
|
|
||||||
|
networkRangeClose = 20; // network bubble distance for spawn of close objects with items in them (f.i. backpacks), set in meters, default value if not set is 20
|
||||||
|
networkRangeNear = 150; // network bubble distance for spawn (despawn +10%) of near inventory items objects, set in meters, default value if not set is 150
|
||||||
|
networkRangeFar = 1000; // network bubble distance for spawn (despawn +10%) of far objects (other than inventory items), set in meters, default value if not set is 1000
|
||||||
|
networkRangeDistantEffect = 4000; // network bubble distance for spawn of effects (currently only sound effects), set in meters, default value if not set is 4000
|
||||||
|
|
||||||
|
defaultVisibility=1375; // highest terrain render distance on server (if higher than "viewDistance=" in DayZ client profile, clientside parameter applies)
|
||||||
|
defaultObjectViewDistance=1375; // highest object render distance on server (if higher than "preferredObjectViewDistance=" in DayZ client profile, clientside parameter applies)
|
||||||
|
|
||||||
|
lightingConfig = 0; // 0 for brighter night, 1 for darker night
|
||||||
|
disablePersonalLight = 1; // disables personal light for all clients connected to server
|
||||||
|
|
||||||
|
disableBaseDamage = 0; // set to 1 to disable damage/destruction of fence and watchtower
|
||||||
|
disableContainerDamage = 0; // set to 1 to disable damage/destruction of tents, barrels, wooden crate and seachest
|
||||||
|
|
||||||
|
class Missions
|
||||||
|
{
|
||||||
|
class DayZ
|
||||||
|
{
|
||||||
|
template="dayzOffline.chernarusplus"; // Mission to load on server startup. <MissionName>.<TerrainName>
|
||||||
|
};
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue