From a142b9101fd06c1f120103fd5f4dfcd3b735878e Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Fri, 21 Jun 2024 22:46:11 -0700 Subject: [PATCH] Update docs. Add TL;DR. --- README.md | 48 +++++++++++++++++++++++++++++++++++++++------- docker-compose.yml | 10 +++++++--- 2 files changed, 48 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 65ee6a8..3a986b7 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,30 @@ The goal is to provide a vanilla DayZ server that can be spun up with as little 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. +* A Debian slim image with `steamcmd` and enough utilities installed to run a DayZ server. +* All server and steamcmd files are persisted in the host user's home directory using a bind mount. +* Everything else is left to the user to run by hand using commands similar to the official documentation. + +## TL;DR + +```shell +git clone https://ceregatti.org/git/daniel/dayzdockerserver.git +cd dayzdockerserver +git checkout simple +echo "export USER_ID=$(id -u)" | tee .env +mkdir dayz +docker compose up -d --build +docker compose exec dayz bash +``` + +```docker +export STEAM_USERNAME='MySteamUserName' +steamcmd +login "${STEAM_USERNAME}" +quit +steamcmd +login "${STEAM_USERNAME}" +force_install_dir /home/user/dayz/serverfiles +app_update 223350 validate +quit +nano /home/user/dayz/serverfiles/serverDZ.cfg +cd /home/user/dayz/serverfiles +./DayZServer -config=serverDZ.cfg +``` ## Configure and Build @@ -111,10 +131,24 @@ cd /home/user/dayz/serverfiles ## Stop -```docker -# Hit control c to stop the server in the shell where it's running in the foreground. -``` +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: ```docker +kill -TERM $(pidof DayZServer) +``` + +It takes time for the server to wrap things up, so always give it at least 30 seconds to fully shut down. + +If the process does not exit, which it some times does, then you have to kill it: + +```docker +kill -KILL $(pidof DayZServer) +``` + +Otherwise just bring the stack down. That will kill the server process as well: + +```shell +docker compose down +``` diff --git a/docker-compose.yml b/docker-compose.yml index 86ab05b..5ae63b1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,12 +5,16 @@ services: args: - USER_ID user: ${USER_ID} + # All container persistence is done using a bind mount that maps to the container's home directory. + # Here the default is a directory named dayz in the host user's home directory. Change this to suit your needs. + # For proper docker permissions, the host directory must exist before the container first starts and be owned by + # the host user. volumes: - ~/dayz:/home/user + # The server must run in host mode if you want it to show up on the LAN network_mode: host - # The above is mutually exclusive with the below. If you don't need - # the server to show up on the LAN, comment out the network_mode above - # and uncomment the port mappings below. + # The network_mode above is mutually exclusive with the ports section below. If you don't need the server to show + # up on the LAN, comment out the network_mode above and uncomment the lines below. # ports: # # Game port # - 2302:2302/udp