1
0

Add setup instructions in README

This commit is contained in:
Alex Thomassen 2021-09-10 15:41:37 +02:00
parent ca9c356bcd
commit e32ef91424
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
5 changed files with 114 additions and 10 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
[*.{cfg,md,sh,yml}]
end_of_line = lf
indent_style = space
indent_size = 4
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

View File

@ -1,3 +1,50 @@
# linux-dayz-docker # linux-dayz-docker
TODO For [1.14 experimental, Linux support for servers was finally released](https://forums.dayz.com/topic/251335-experimental-update-114-changelog/?page=4&tab=comments#comment-2472603). This is my half-assed attempt at creating a Docker container for running a (barebones) DayZ server.
## Requirements
- A Steam account with DayZ
- This is required to be able to download the server files via `steamcmd`, which is a tool used by the `download.sh` helper script.
- Also required for DayZ workshop content
- System/server specifications matching the [minimum requirements](https://forums.dayz.com/topic/239635-dayz-server-files-documentation/?tab=comments#comment-2396573)
- During my testing I was running a VM with 6 dedicated threads and 32 GB RAM, on Debian 11 (though OS doesn't matter much).
- By default the `docker-compose.yml` file limits the memory usage to 8 GB (`mem_limit`). Feel free to tweak as-is.
- From my experience: 3 threads/cores + 5 GB RAM available for the DayZ server is the absolute minimum.
- A Linux OS with `bash` installed, as I have no idea if my `download.sh` script is POSIX-compatible.
- I use Debian 11 (Bullseye) as I'm writing, but other major OSes such as Ubuntu/CentOS will likely work just fine.
- Server also needs Docker & [Docker Compose](https://docs.docker.com/compose/) installed
## Things that need to be done manually at the moment
- Mount the `whitelist.txt` / `priority.txt` files in the Docker Compose file
- Remote access via RCON isn't enabled by default. You can configure that [by following the steps on Bohemia's wiki](https://community.bistudio.com/wiki/DayZ:Server_Configuration#BattlEye_Configuration)
- Unless `-bePath` is used, the path for BattlEye should be: `server_files/battleye/beserver_x64.cfg`
- You will also need to **forward** the RCON port in the `docker-compose.yml` file. By default I think it is `2303` (`gamePort + 1 = rconPort`)
## Known issues
- Crashes. Server will often crash and "hang". I haven't been able to look into _why_, nor how to detect it. You'll just have to watch logs and manually restart accordingly (`docker-compose down && docker-compose up -d`).
## Setup
1. Run `./download.sh`, which will prompt you for your Steam username + password (+ two-factor code, if you have that).
- Unless script has been modified to, it will download into the directory: `server_files`
2. Copy `serverDZ.example.cfg` to a new file called `serverDZ.cfg`. Edit the configuration options as you see fit.
- **Optional**: Copy extra configuration options from the `serverDZ_extra.example.cfg` file into the `serverDZ.cfg` file you created.
3. Run `docker-compose up -d` to start up the server
4. **Optional**: Run `docker-compose logs -ft` to watch the console/server logs. Hit CTRL+C to get out of the logs.
Once you're done with the server, run `docker-compose down` to shut the server/container down.
If you wanna boot it back up, just run `docker-compose up -d` again.
## Workshop content
For workshop content, run `./download.sh -w WORKSHOP_ID_HERE`, which will prompt you for your Steam username _and_ a "Workshop mod name".
Once again, it seems that having a Steam account with a copy of DayZ is required.
- The "Workshop mod name" is used to create a folder within `server_files/<Worshop Mod Name Here>`, where mod files are later copied into.
- All workshop content will be downloaded to the `workshop_mods` folder.
I am not entirely sure if this is the _correct_ method. I have literally zero experience with DayZ servers, so you might have to look into proper methods yourself.
## Thanks to
- Corbpie for having a pretty solid blog post on [how to set up a DayZ server on Windows](https://write.corbpie.com/dayz-server-setup-and-install-on-windows-server-2019-with-steamcmd/). While I'm doing it on Linux, it was still useful for command-line flags and whatnot.

View File

@ -5,15 +5,16 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
restart: unless-stopped
ports: ports:
- 2302:2302/udp - 2302:2302/udp
- 27016:27016/udp - 27016:27016/udp
environment:
# Threads/vCores available on the server
CPU_COUNT: 6
volumes: volumes:
- ../linux-dayz-profile-data:/data # Directory used for "profiles"
- ../linux-dayz-server-files:/server - ./profile_data:/data
# Directory used for server/mission files etc.
- ./server_files:/server
# Server config. This is mounted as "read-only" in the container.
- ./serverDZ.cfg:/config.cfg:ro - ./serverDZ.cfg:/config.cfg:ro
command: ./DayZServer -cpuCount=${CPU_COUNT} -dologs -adminlog -netlog -freezecheck -profiles=/data -config=/config.cfg command: ./DayZServer -cpuCount=6 -dologs -adminlog -netlog -freezecheck -profiles=/data -config=/config.cfg
mem_limit: 8g mem_limit: 8g

View File

@ -69,6 +69,7 @@ DATA_VOLUME="${SERVER_FILES}";
STEAMCMD_PARAMS="+app_update ${STEAM_APP_ID} validate"; STEAMCMD_PARAMS="+app_update ${STEAM_APP_ID} validate";
# Modify the command if a workshop ID is specified. # Modify the command if a workshop ID is specified.
# Note: I am not entirely sure if this is the correct method.
if [[ ! -z "${WORKSHOP_ID}" ]]; then if [[ ! -z "${WORKSHOP_ID}" ]]; then
echo "Name of mod (Steam workshop item):"; echo "Name of mod (Steam workshop item):";
read WORKSHOP_MOD_NAME; read WORKSHOP_MOD_NAME;
@ -79,7 +80,7 @@ fi
docker run -it \ docker run -it \
-v "${DATA_VOLUME}":/data \ -v "${DATA_VOLUME}":/data \
-v "${BASE_DIR}/.steamcmd":/root/Steam \ -v "${BASE_DIR}/.steamcmd":/root/.steam \
steamcmd/steamcmd:latest +login "${STEAM_USERNAME}" +force_install_dir /data \ steamcmd/steamcmd:latest +login "${STEAM_USERNAME}" +force_install_dir /data \
$STEAMCMD_PARAMS \ $STEAMCMD_PARAMS \
+quit; +quit;
@ -89,5 +90,8 @@ if [[ ! -z "${WORKSHOP_ID}" && ! -z "${WORKSHOP_MOD_NAME}" ]]; then
MOD_NAME_FOLDER="${SERVER_FILES}/${WORKSHOP_MOD_NAME}"; MOD_NAME_FOLDER="${SERVER_FILES}/${WORKSHOP_MOD_NAME}";
mkdir -p "${MOD_NAME_FOLDER}"; mkdir -p "${MOD_NAME_FOLDER}";
cp -r "${ORIG_MOD_FOLDER}"/* "${MOD_NAME_FOLDER}"; cp -r "${ORIG_MOD_FOLDER}"/* "${MOD_NAME_FOLDER}";
cp -r "${ORIG_MOD_FOLDER}/Keys"/* "${SERVER_FILES}/keys";
echo;
echo "Workshop/mod files copied to: ${MOD_NAME_FOLDER}"; echo "Workshop/mod files copied to: ${MOD_NAME_FOLDER}";
fi fi

View File

@ -0,0 +1,42 @@
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 = 1800; // 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