Make configuration changes come from changes to the files rather than setting environment variables.

Updated documentation.
This commit is contained in:
Daniel Ceregatti 2022-03-25 23:52:06 -07:00
parent b141d2b0da
commit 6be82b1adc
4 changed files with 17 additions and 15 deletions

View file

@ -1,12 +1,19 @@
# DayZDockerServer
A Linux DayZ server in a Docker container.
A Linux DayZ server in a Docker container. Uses a modified version of https://github.com/thelastnoc/dayz-sa_linuxserver
Edit docker-compose.yml and set the server name:
### Setup
Edit `files/serverDZ.cfg` and set the server name:
```
- SERVERNAME=DayZ on Linux
hostname = "Something other than Server Name"; // Server name
```
Optionally edit `files/beserver_x64.cfg` and set the rcon password:
```
RConPassword h4CKm3
```
### Running
Build the container, run it, tail the logs:
```
docker-compose build

View file

@ -12,9 +12,4 @@ services:
- "27016:27016/udp"
volumes:
- homedir:/home/user
- ./files:/files
environment:
# Don't use double quotes. Escape any forward slashes: SERVERNAME=My thing \/ My other thing
- SERVERNAME=DayZ on Linux for Linux
# Set your own RCON password. Otherwise, a random one will be generated and shown in the log on the first run.
# - RCON_PASSWORD=H4CKM3
- ./files:/files

View file

@ -45,16 +45,16 @@ fn_loadconfig_dayz(){
fi
# Set a random RCON password, unless one's set in the environment
if [ ! -f "${HOME}/serverfiles/battleye/beserver_x64.cfg" ]
if [ -d "${HOME}/serverfiles" ] && [ ! -f "${HOME}/serverfiles/battleye/beserver_x64.cfg" ]
then
echo -n "Creating Battle Eye RCON file "
cp /files/beserver_x64.cfg "${HOME}/serverfiles/battleye/beserver_x64.cfg"
if [[ ${RCON_PASSWORD} != "" ]]
if grep RCON_PASSWORD /files/beserver_x64.cfg
then
echo "using the RCON_PASSWORD in the environment."
else
RCON_PASSWORD=$(< /dev/urandom tr -dc 'A-Za-z0-9' | head -c10)
echo -e "using random RCON password ${yellow}${RCON_PASSWORD}"
else
echo "using the RCON_PASSWORD already set in files/beserver_x64.cfg."
fi
sed -i "${HOME}/serverfiles/battleye/beserver_x64.cfg" -e "s/RCON_PASSWORD/${RCON_PASSWORD}/"
fi
@ -489,7 +489,7 @@ if [ ! -f "${HOME}/steamcmd/steamcmd.sh" ] || [ ! -f "${HOME}/serverfiles/DayZSe
# chmod u+x ${HOME}/dayzserver
fn_install_dayz
if [ -f "${HOME}/steamcmd/steamcmd.sh" ] && [ -f "${HOME}/serverfiles/DayZServer" ]; then
exec fn_start_dayz
fn_start_dayz
fi
echo "Something failed? Shouldn't make it here..."
exit

View file

@ -1,4 +1,4 @@
hostname = "SERVER_NAME"; // Server name
hostname = "Server Name"; // Server name
password = ""; // Password to connect to the server
passwordAdmin = ""; // Password to become a server admin