diff --git a/README.md b/README.md index fdf7336..cf8820c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ This project started when the Linux DayZ server was released for DayZ experiment * 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) +* When deleting a docker volume, permissions are reset, which causes this error: `ERROR! Failed to install app '223350' (Missing file permissions)`. To fix: +```shell +docker compose run -u0 --rm web chown user:user /serverfiles/steamapps` +``` This project is a work in progress: See the [roadmap](ROADMAP.md). @@ -50,7 +54,7 @@ docker compose build docker compose run --rm web dz login ``` -Follow the prompts. Hit enter to accept the default, which is to use the `anonymous` user, otherwise use your real username and keep following the prompts to add your password and Steam Guard code. This process will wait indefinitely until the code is entered. +Follow the prompts. Hit enter to accept the default, which is to use the `anonymous` user, otherwise use your real username and keep following the prompts to add your password. If you have Steam Guard (which you _really_ should have), it will wait for the request to be approved on your phone. The process will wait until it's approved. The credentials will be managed by [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD). This will store a session token in the `homedir` docker volume. All subsequent SteamCMD commands will use this. so this process does not need to be repeated unless the session expires or the docker volume is deleted. @@ -63,11 +67,16 @@ The base server files must be installed before the server can be run: docker compose run --rm web dz install ``` -This will download about 2.9G of files. +This will download about 3 Gigabytes of files. ## Run -Edit `files/serverDZ.cfg` and set the values of any variables there. See the [documentation](https://forums.dayz.com/topic/239635-dayz-server-files-documentation/) if you want, but most of the default values are fine. At the very least, change the server name: +Copy `files/serverDZ.cfg.example` to the root of the clone directory, which your shell should already be located, with the name `serverDZ.cfg`: +```shell +cp files/serverDZ.cfg.example ./serverDZ.cfg +``` + +This file will be used by the server within the container. Set the values of any variables there. See the [documentation](https://forums.dayz.com/topic/239635-dayz-server-files-documentation/) if you want, but most of the default values are fine. The Chernarus map is set by default in this file. At the very least, change the server name: ``` hostname = "Something other than Server Name"; // Server name @@ -76,11 +85,14 @@ hostname = "Something other than Server Name"; // Server name Install the server config file: ```shell -docker compose run --rm server dz c +docker compose run --rm server dz config ``` -The maintenance of the config file is a work in progress. The goal is to create a facility for merging changes into the config file and maintain a paper trail of changes. +The maintenance of the config file is a work in progress. The goal is to create a facility for merging changes into the config file and maintain a paper trail of changes. For now, just remember that the working config file is the one that was copied into the root of the project, and that changes to it must be copied into the container using the command above. +This only has to be done initially or when changes are made to `serverDZ.cfg`. + +## Up Launch the stack into the background: ```shell docker compose up -d @@ -112,19 +124,21 @@ To bring the entire stack down: docker compose down ``` +Since all files are maintained within docker volumes, all changes persist when bringing the stack down. + ## Manage ### Maps Installing another map requires installing its mod and mpmissions files. Some maps maintain github repositories or public web sites for their mpmissions, while others do not. This project aims to support DayZ maps whose mpmissions are easily accessible "Out of the box" by maintaining configuration files for them. -The following management commands presume the server has been brought [up](#run). - ### RCON A terminal-based RCON client is included: https://github.com/indepth666/py3rcon. The dz script manages what's necessary to configure and run it: +The following command presumes the server has been brought [up](#up) (otherwise RCON can't connect to anything): + ```shell docker compose exec server dz rcon ``` @@ -153,7 +167,7 @@ docker compose run --rm web dz update This will update the server base files as well as all installed mods. -Don't forget to [bring it back up](#run). +Don't forget to [bring it back up](#up). ### Stop the DayZ server @@ -177,39 +191,49 @@ docker compose down ### Workshop - Add / List / Remove / Update mods -Interactive interface for managing mods. +Interactive interface for managing mods. These commands are run with the stack being [up](#up). ``` -docker compose exec server dz activate id | add id1 | deactivate id | list | modupdate | remove id -docker compose exec server dz a id | add id1 | d id | l | m | r id +# Adding and removing of mods is done in the web container. These commands only download, list, update, or remove mods to/from volumes that are shared by the web and server containers. +docker compose exec web dz (a)dd id | (l)ist | (m)odupdate | (r)emove id +# Once added to the web container, activate any of the installed mods in the running server. Activated mods are also deactivated here. +docker compose exec server dz (a)ctivate id [ id2 [ id3 ]] | (d)eactivate id [ id2 [ id3 ]] | (l)ist | (s)tatus ``` -Look for mods in the [DayZ Workshop](https://steamcommunity.com/app/221100/workshop/). Browse to one. In its URL will be -an `id` parameter. Here is the URL to SimpleAutoRun: https://steamcommunity.com/sharedfiles/filedetails/?id=2264162971. To -add it: +Look for mods in the [DayZ Workshop](https://steamcommunity.com/app/221100/workshop/). Browse to one. In its URL will be an `id` parameter. Here is the URL to Community Framework, a mod that is a dependency of many other mods (but by itself really doesn't do anything): https://steamcommunity.com/sharedfiles/filedetails/?id=1559212036. To add it: -``` -docker compose exec web dz add 2264162971 +```shell +docker compose exec web dz add 1559212036 ``` -Adding and removing mods will add and remove their names from the `-mod=` parameter. +Then activate it in the server container: +```shell +docker compose exec server dz activate 1559212036 +``` -Optionally, to avoid re-downloading large mods, the `activate` and `deactivate` workshop commands will -simply disable the mod but keep its files. Keep in mind that mod updates will also update deactivated +Activating (or deactivating) mods will add (or remove) their names from the `-mod=` parameter in the server command line. + +To avoid re-downloading large mods, the `activate` and `deactivate` server container commands will simply disable the mod but keep its files. Note that mod updates will also update deactivated mods. -The above is a bad example, as SimpleAutorun depends on Community Framework, which must also be installed, as well as made to load first. +The above is a bad example, as Community Framework doesn't really do anything by itself, but is a dependency of pretty much every admin mod. Add [VPPAdminTools](https://steamcommunity.com/sharedfiles/filedetails/?id=1828439124) too: + +```shell +docker compose exec web dz add 1828439124 +docker compose exec shell dz activate 1828439124 +``` + +Read the instructions on the page of the URL above to add yourself as an admin to your server. ### Looking under the hood -All the server files persist in a docker volume that represents the container's unprivileged user's home directory. Open a bash shell in -the running container: +All the server files persist in a docker volume that represents the container's unprivileged user's home directory. Open a bash shell in the running container: ``` docker compose exec web bash ``` -Or open a shell into a new container if the docker stack is not up: +Or open a shell into a new container if the docker stack is not [up](#up): ``` docker compose run --rm web bash ``` @@ -226,15 +250,13 @@ Add the following to the `.env` file: export DEVELOPMENT=1 ``` -Bring the stack down then back up. Now, instead of the server starting when the server container comes up it will simply block, keeping the container up and accessible. +Bring the stack down then back up. Now, instead of the server starting when the server container comes up it will simply block, keeping both the web and server containers up and accessible. This allows access to the server container using exec. You can then start and stop the server manually, using `dz`: ```shell # Go into the server container docker compose exec shell bash -# Because this is now in the environment and keeping the server from starting, it'd still keep the server from starting unless we unset it -unset DEVELOPMENT # See what the server status is dz s # Start it @@ -251,3 +273,4 @@ Caveat: Some times the server doesn't stop with control c. If that's the case, c * It shells out to `dz` (for now) for all the heavy lifting. * Create some way to send messages to players on the server using RCON. * Implement multiple ids for mod commands. (In progress) +* Fix the permissions bug listed in [caveats](#caveats).