dayzdockerserver/README.md
Daniel Ceregatti bef4ca8042 Update docs.
2024-06-21 20:58:07 -07:00

3.5 KiB

DayZDockerServer

A Linux DayZ server in a Docker container.

The goal is to provide a vanilla DayZ server that can be spun up with as little as a machine running Linux with Docker and Docker Compose Plugin installed.

Features

This branch is called simple, because that's the intent: To keep things simple:

  • One container. The server runs in the same container used to manage it.
  • One local bind mount. All files are stored in a directory on the host machine.
  • No root requirement. The container and its files are owned by the host user and kept entirely in that user's home directory.
  • Everything is left to the user to run by hand using commands similar to the official documentation.

Configure and Build

Ensure Docker and Docker compose plugin are installed.

Clone the repo, and change into the newly created directory, and check out the simple branch:

git clone https://ceregatti.org/git/daniel/dayzdockerserver.git
cd dayzdockerserver
git checkout simple

Create a .env file that contains your user id. The output of id -u has it:

echo "export USER_ID=$(id -u)" | tee .env

Create the directory where the server files will be stored:

mkdir dayz

Build the Docker image and bring the container up in the background:

docker compose up -d --build

This will bring up a single container where the server will run.

Usage

Everything is done in a shell inside the running container. All commands are run from this shell. Invoke the shell with:

docker compose exec dayz bash

A custom prompt will indicate when you are in the container. The prompt will look like this:

user@dayzdockerserver:~ $

Steam Integration

Use SteamCMD to login:

steamcmd +login 'MySteamLogin' +force_install_dir /home/user/dayz/serverfiles  +quit

Follow the prompts for the password and Steam Guard code. This process will wait indefinitely until both are entered. Once logged in, this process will not need to be repeated as long as the same username is used for the +login argument and the host directory containing the files is not deleted.

Install

The base server files must be installed before the server can be run:

steamcmd +login 'MySteamLogin' +force_install_dir /home/user/dayz/serverfiles +app_update 223350 validate +quit

This will download about 2.8G of files.

Replace 223350 with 1042420 for experimental.

Setup

Edit the server config file. One way is to do it within the container using the nano editor, the only one installed in the container:

nano /home/user/dayz/serverfiles/serverDZ.cfg

Another option is to edit it directly on the host, as at this point that file is also available there:

${EDITOR} ~/dayzdockerserver/serverfiles/serverDZ.cfg

Set the values of any variables there. See the documentation if you want, but most of the default values are fine. At the very least, change the server name:

hostname = "My Cool Server";   // Server name

Start

Start the server:

cd /home/user/dayz/serverfiles
./DayZServer -config=serverDZ.cfg

Stop

# Hit control c to stop the server in the shell where it's running in the foreground.

Otherwise, open a new shell in the container and kill the process: