diff --git a/README.md b/README.md index fdf7336..2c462a1 100644 --- a/README.md +++ b/README.md @@ -30,12 +30,35 @@ git clone https://ceregatti.org/git/daniel/dayzdockerserver.git cd dayzdockerserver ``` -Create a `.env` file that contains your user id. Usually the `${UID}` shell variable has this: +Create a `.env` file for the web container that contains your user id. Usually the `${UID}` shell variable has this: ```shell echo "export USER_ID=${UID}" | tee .env ``` +Repeat the above for server1, which uses .env1 (and so on): +```shell +echo "export USER_ID=${UID}" | tee .env1 +``` + +But each server must also set its own unique ports and id: +```shell +echo "export SERVER_ID=1" | tee -a .env1 +echo "export SERVER_PORT=2302" | tee -a .env1 +echo "export RCON_PORT=2303" | tee -a .env1 +echo "export STEAM_PORT=27016" | tee -a .env1 +``` + +Repeat the above for each server you want to run, making sure the ports are unique across all servers: +```shell +echo "export USER_ID=${UID}" | tee .env2 +echo "export SERVER_ID=2" | tee -a .env2 +echo "export SERVER_PORT=2312" | tee -a .env2 +echo "export RCON_PORT=2313" | tee -a .env2 +echo "export STEAM_PORT=27116" | tee -a .env2 + + +```shell Build the Docker images: ```shell @@ -76,7 +99,7 @@ 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 server1 dz c ``` 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. @@ -86,18 +109,18 @@ Launch the stack into the background: docker compose up -d ``` -There will be nothing in mpmissions when the server container starts for the first time. A pristine copy of `dayzOffline.chernarusplus` will be copied from the `mpmission` volume to the server container. This will be the default map. To install other maps, see [Maps](#maps). +There will be nothing in mpmissions when a server container starts for the first time. A pristine copy of `dayzOffline.chernarusplus` will be copied from the `mpmission` volume to the server container. This will be the default map. To install other maps, see [Maps](#maps). To see the server log: ```shell -docker compose logs -f server +docker compose logs -f server1 ``` ## Stopping the server To stop the DayZ server: ```shell -docker compose exec server dz stop +docker compose exec server1 dz stop ``` If it exits cleanly, the container will also stop. Otherwise a crash is presumed and the server will restart. Ideally, the server would always exit cleanly, but... it's DayZ. @@ -126,13 +149,13 @@ A terminal-based RCON client is included: https://github.com/indepth666/py3rcon. The dz script manages what's necessary to configure and run it: ```shell -docker compose exec server dz rcon +docker compose exec server1 dz rcon ``` To reset the RCON password in the Battle Eye configuration file, simply delete it, and a random one will be generated on the next server startup: ```shell -docker compose run --rm server rm serverfiles/battleye/baserver_x64_active* +docker compose run --rm server1 rm serverfiles/battleye/baserver_x64_active* ``` Don't expect much from this RCON at this time. @@ -159,13 +182,13 @@ Don't forget to [bring it back up](#run). To stop the server: ```shell -docker compose exec server dz stop +docker compose exec server1 dz stop ``` The above sends the SIGINT signal to the server process. The server sometimes fails to stop with this signal. It may be necessary to force stop it with the SIGKILL: ```shell -docker compose exec server dz force +docker compose exec server1 dz force ``` When the server exits cleanly, i.e. exit code 0, the container also stops. Otherwise, a crash is presumed, and the server will be automatically restarted. @@ -180,8 +203,8 @@ docker compose down Interactive interface for managing mods. ``` -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 +docker compose exec server1 dz activate id | add id1 | deactivate id | list | modupdate | remove id +docker compose exec server1 dz a id | add id1 | d id | l | m | r id ``` Look for mods in the [DayZ Workshop](https://steamcommunity.com/app/221100/workshop/). Browse to one. In its URL will be @@ -232,9 +255,7 @@ This allows access to the server container using exec. You can then start and st ```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 +docker compose exec server1 bash # See what the server status is dz s # Start it diff --git a/docker-compose.yml b/docker-compose.yml index 1fdae5d..5602f90 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,33 @@ volumes: - # For steamcmd files and resource files used by the scripts + # Only in the web container. + # For steamcmd files and resource files used by the scripts. homedir_main: - # For Steam, for now - homedir_server: + # Shared by all containers. + # Mods. + mods: # Where the server files will be installed serverfiles: - # Server profile files - profiles: # Upstream mission files servermpmissions: + # Server-specific volumes + # For Steam, for now + homedir_server1: + homedir_server2: + homedir_server3: # Server mission files - mpmissions: - # Mods - mods: + mpmissions1: + mpmissions2: + mpmissions3: + # Server profile files + profiles1: + profiles2: + profiles3: services: web: + profiles: + - main build: context: web args: @@ -37,21 +48,35 @@ services: env_file: - .env - server: + server-image: + &server-image + profiles: + - build build: context: server args: - USER_ID + image: server-image + pull_policy: never + env_file: + - .env + + server1: + <<: *server-image + profiles: + - main user: ${USER_ID} volumes: - - homedir_server:/home/user + # Common volumes + - ./files:/files + - mods:/mods + - ./server:/server - serverfiles:/serverfiles - servermpmissions:/mpmissions:ro - - mods:/mods - - mpmissions:/serverfiles/mpmissions - - profiles:/profiles - - ./files:/files - - ./server:/server + # Server-specific volumes + - homedir_server1:/home/user + - mpmissions1:/serverfiles/mpmissions + - profiles1:/profiles # To have the server show up in the LAN tab of the DayZ launcher, # it must run under host mode. network_mode: host @@ -77,4 +102,49 @@ services: # soft: -1 # hard: -1 env_file: - - .env + - .env1 + +# # Copy and paste this for every other server you want to run, replacing 2 with 3, and so on. +# server2: # <-- here +# build: +# context: server +# args: +# - USER_ID +# user: ${USER_ID} +# volumes: +# # Common volumes +# - ./files:/files +# - mods:/mods +# - ./server:/server +# - serverfiles:/serverfiles +# - servermpmissions:/mpmissions:ro +# # Server-specific volumes +# - homedir_server2:/home/user # <-- here +# - mpmissions2:/serverfiles/mpmissions # <-- here +# - profiles2:/profiles # <-- here +# network_mode: host +# restart: no +# env_file: +# - .env2 # <-- here +# +# server3: # <-- here +# build: +# context: server +# args: +# - USER_ID +# user: ${USER_ID} +# volumes: +# # Common volumes +# - ./files:/files +# - mods:/mods +# - ./server:/server +# - serverfiles:/serverfiles +# - servermpmissions:/mpmissions:ro +# # Server-specific volumes +# - homedir_server3:/home/user # <-- here +# - mpmissions3:/serverfiles/mpmissions # <-- here +# - profiles3:/profiles # <-- here +# network_mode: host +# restart: no +# env_file: +# - .env3 # <-- here diff --git a/files/mods/3295021220/cfgenvironment.xml b/files/mods/3295021220/cfgenvironment.xml new file mode 100755 index 0000000..aa1eeb4 --- /dev/null +++ b/files/mods/3295021220/cfgenvironment.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/files/mods/3295021220/cfgeventspawns.xml b/files/mods/3295021220/cfgeventspawns.xml new file mode 100755 index 0000000..e8f22d7 --- /dev/null +++ b/files/mods/3295021220/cfgeventspawns.xml @@ -0,0 +1,4 @@ + + + + diff --git a/files/mods/3295021220/events.xml b/files/mods/3295021220/events.xml new file mode 100755 index 0000000..0937dce --- /dev/null +++ b/files/mods/3295021220/events.xml @@ -0,0 +1,24 @@ + + + + 8 + 1 + 4 + 180 + 0 + 200 + 0 + 0 + + fixed + child + 1 + + + + + + + + + diff --git a/files/mods/3295021220/horses_chernarus.xml b/files/mods/3295021220/horses_chernarus.xml new file mode 100755 index 0000000..c04fea5 --- /dev/null +++ b/files/mods/3295021220/horses_chernarus.xml @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/files/mods/3295021220/start.sh b/files/mods/3295021220/start.sh new file mode 100644 index 0000000..8123c60 --- /dev/null +++ b/files/mods/3295021220/start.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# This is run in the directory with the target files + +# Copy the territory file over +cp ${FILES}/mods/${ID}/horses_chernarus.xml env/wild_horse_territories.xml diff --git a/files/mods/3295021220/xml.env b/files/mods/3295021220/xml.env new file mode 100644 index 0000000..3487169 --- /dev/null +++ b/files/mods/3295021220/xml.env @@ -0,0 +1,3 @@ +CFGENVIRONMENT=local +CFGEVENTSPAWNS=local +EVENTS=local diff --git a/files/mods/@DayZHorse b/files/mods/@DayZHorse new file mode 120000 index 0000000..f5c8cc0 --- /dev/null +++ b/files/mods/@DayZHorse @@ -0,0 +1 @@ +3295021220 \ No newline at end of file diff --git a/server/bin/start.sh b/server/bin/start.sh index b3a60fd..e7d097c 100755 --- a/server/bin/start.sh +++ b/server/bin/start.sh @@ -3,7 +3,7 @@ # Set PS1 so we know we're in the container, should we exec into it. cat > .bashrc <