From beebf1e8fa39b787c46e359ab3d6709dd4697257 Mon Sep 17 00:00:00 2001 From: Panromir Date: Thu, 23 May 2024 22:04:50 +0200 Subject: [PATCH 01/25] Rework --- Dockerfile | 99 +++++--- README.md | 120 +++++----- docker-compose.yml | 14 +- .../ServerGameSettings.json.template | 217 ++++++++++++++++++ .../ServerHostSettings.json.template | 29 +++ files/scripts/cleanlogs.sh.template | 4 + files/scripts/entrypoint.sh | 129 +++++++++++ files/scripts/healthcheck.sh | 4 + kubernetes/kustomize/base/configMap.yaml | 30 +++ kubernetes/kustomize/base/deployment.yaml | 59 +++++ kubernetes/kustomize/base/kustomization.yaml | 13 ++ kubernetes/kustomize/base/networkPolicy.yaml | 63 +++++ kubernetes/kustomize/base/nodePort.yaml | 24 ++ kubernetes/kustomize/base/pvc.yaml | 27 +++ kubernetes/kustomize/base/secret.yaml | 7 + .../overlays/exampleorg/configMap.yaml | 30 +++ .../overlays/exampleorg/deployment.yaml | 10 + .../overlays/exampleorg/kustomization.yaml | 17 ++ .../kustomize/overlays/exampleorg/pvc.yaml | 27 +++ .../kustomize/overlays/exampleorg/secret.yaml | 7 + src/debian.sources | 13 ++ 21 files changed, 841 insertions(+), 102 deletions(-) create mode 100755 files/config_templates/ServerGameSettings.json.template create mode 100755 files/config_templates/ServerHostSettings.json.template create mode 100644 files/scripts/cleanlogs.sh.template create mode 100755 files/scripts/entrypoint.sh create mode 100755 files/scripts/healthcheck.sh create mode 100644 kubernetes/kustomize/base/configMap.yaml create mode 100644 kubernetes/kustomize/base/deployment.yaml create mode 100644 kubernetes/kustomize/base/kustomization.yaml create mode 100644 kubernetes/kustomize/base/networkPolicy.yaml create mode 100644 kubernetes/kustomize/base/nodePort.yaml create mode 100644 kubernetes/kustomize/base/pvc.yaml create mode 100644 kubernetes/kustomize/base/secret.yaml create mode 100644 kubernetes/kustomize/overlays/exampleorg/configMap.yaml create mode 100644 kubernetes/kustomize/overlays/exampleorg/deployment.yaml create mode 100644 kubernetes/kustomize/overlays/exampleorg/kustomization.yaml create mode 100644 kubernetes/kustomize/overlays/exampleorg/pvc.yaml create mode 100644 kubernetes/kustomize/overlays/exampleorg/secret.yaml create mode 100644 src/debian.sources diff --git a/Dockerfile b/Dockerfile index 04d238c..0854311 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,68 @@ -FROM ubuntu:22.04 -LABEL maintainer="Tim Chaubet" -VOLUME ["/mnt/vrising/server", "/mnt/vrising/persistentdata"] +FROM cm2network/steamcmd:root-bookworm +LABEL maintainer="Panromir " +#VOLUME ["/home/steam/vrising/server", "/home/steam/vrising/persistentdata"] +EXPOSE 9876/udp +# Expose 9876/tcp if using RCON. See RCON_PORT Env variable +EXPOSE 9876 +EXPOSE 9877/udp -ARG DEBIAN_FRONTEND="noninteractive" -RUN apt update -y && \ - apt-get upgrade -y && \ - apt-get install -y apt-utils && \ - apt-get install -y software-properties-common \ - tzdata && \ - add-apt-repository multiverse && \ +ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ + PERSISTENT_DATA_PATH="/home/steam/vrising/persistentdata" \ + HOST_SETTINGS_NAME="My Docker V-Rising Server" \ + HOST_SETTINGS_DESCRIPTION="V Rising Server hosted by Docker" \ + HOST_SETTINGS_PASSWORD="" \ + HOST_SETTINGS_MAX_CONNECTED_USERS="10" \ + HOST_SETTINGS_MAX_CONNECTED_ADMINS="4" \ + HOST_SETTINGS_SERVER_ADMIN_LIST="" \ + HOST_SETTINGS_SERVER_FPS="30" \ + HOST_SETTINGS_RCON_ENABLE="false" \ + HOST_SETTINGS_RCON_PASSWORD="Ch8ng3m3Pl3@s3!" \ + HOST_SETTINGS_RCON_PORT="9876" \ + HOST_SETTINGS_AUTOSAVE_COUNT="40" \ + HOST_SETTINGS_AUTOSAVE_INTERVAL="120" \ + HOST_SETTINGS_LISTEN_ON_STEAM="true" \ + HOST_SETTINGS_LISTEN_ON_EOS="true" \ + GAME_SETTINGS_PRESET="StandardPvP" \ + GAME_SETTINGS_DIFFICULTY="Normal" \ + LIST_ON_MASTER_SERVER="true" \ + SERVER_IP="127.0.0.1" \ + SAVE_NAME="default_world" \ + GAME_PORT="9876" \ + QUERY_PORT="9877" \ + STEAM_USER_UID="1000" \ + STEAM_USER_GID="1000" \ + DEBUG_ENV="true" \ + LOGDAYS="30" \ + TZ="Europe/Brussels" + +COPY --chown=steam:steam --chmod=744 files /home/steam/files/ +COPY src/debian.sources /etc/apt/sources.list.d/debian.sources + +# hadolint ignore=DL3008 +RUN DEBIAN_FRONTEND=noninteractive \ dpkg --add-architecture i386 && \ - apt update -y && \ - apt-get upgrade -y -RUN useradd -m steam && cd /home/steam && \ - echo steam steam/question select "I AGREE" | debconf-set-selections && \ - echo steam steam/license note '' | debconf-set-selections && \ - apt purge steam steamcmd && \ - apt install -y gdebi-core \ - libgl1-mesa-glx:i386 \ - wget && \ - apt install -y steam \ - steamcmd && \ - ln -s /usr/games/steamcmd /usr/bin/steamcmd -#RUN apt install -y mono-complete -RUN apt install -y wine \ - winbind \ - winetricks -RUN apt install -y xserver-xorg \ - xvfb -RUN rm -rf /var/lib/apt/lists/* && \ - apt clean && \ - apt autoremove -y + apt-get update && \ + apt-get install -y --no-install-recommends \ + cron \ + gettext-base \ + procps \ + wine \ + wine32 \ + wine64 \ + winbind \ + xvfb \ + xauth \ + mingw-w64 \ + screen && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + chmod +x /home/steam/files/scripts/* && \ + echo "0 * * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh > /proc/1/fd/1 2>&1" >> /etc/cron.d/logrotation && \ + crontab -u steam /etc/cron.d/logrotation && \ + chmod u+s /usr/sbin/cron + +USER steam -COPY start.sh /start.sh -RUN chmod +x /start.sh -CMD ["/start.sh"] +CMD ["/home/steam/files/scripts/entrypoint.sh"] +HEALTHCHECK --start-period=180s \ + CMD /bin/bash /home/steam/files/scripts/healthcheck.sh diff --git a/README.md b/README.md index 8539cac..96ea30e 100755 --- a/README.md +++ b/README.md @@ -31,20 +31,40 @@ - The game is working perfectly with a new run of the container (from scratch). I'm on it with several buddies and tested for 3 hours. - When the server is passworded, joining via Steam seems not possible. Use the ingame server list to join. -- Make sure `"ListOnSteam": true,` and `"ListOnEOS": true` are set in the ServerHostSettings.json in \persistentdata, so the server is visible in the serverlist +- Make sure `HOST_SETTINGS_LISTEN_ON_STEAM: "true"` and `HOST_SETTINGS_LISTEN_ON_EOS: "true"` are set in your Environment - Launching the server can take up to 10 minutes, even on a fast system, certainly with an existing save. Below is a screenshot of the end of the docker log of a functioning server, at the time we are able to connect to it. ## Environment variables -| Variable | Key | Description | -| ------------ | ------------------------ | ----------------------------------------------------------------------------------- | -| TZ | Europe/Brussels | timezone for ntpdate | -| SERVERNAME | published servername | mandatory setting that overrules the ServerHostSettings.json entry | -| WORLDNAME | optional worldname | default = world1. No real need to alter this. saves will be in a subdir WORLDNAME | -| GAMEPORT | optional game udp port | to overrule Port in ServerHostSettings.json config | -| QUERYPORT | optional query port | to overrule QueryPort in ServerHostSettings.json config | -| LOGDAYS | optional lifetime of logfiles | overrule default of 30 days | +| Variable | Default V(alue) | Description | Mandatory | +| --------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------- | --------- | +| TZ | Europe/Brussels | timezone for ntpdate | No | +| SERVER_DATA_PATH | /home/steam/vrising/server | Path inside the container to save server files to | No | +| PERSISTENT_DATA_PATH | /home/steam/vrising/persistentdata | Path inside the container to save world/configs/logs/etc. to | No | +| HOST_SETTINGS_NAME | My Docker V-Rising Server | The name of your server as visible in the server list | No | +| HOST_SETTINGS_DESCRIPTION | V Rising Server hosted by Docker | Description of your server | No | +| HOST_SETTINGS_PASSWORD | "" | Optional Server password | No | +| HOST_SETTINGS_MAX_CONNECTED_USERS | 10 | Maximum connected users | No | +| HOST_SETTINGS_MAX_CONNECTED_ADMINS| 4 | Maximum connected admins | No | +| HOST_SETTINGS_SERVER_ADMIN_LIST | "" | Comma separated list of Admin Steam IDs (e.g. "123456789,0987654321") | No | +| HOST_SETTINGS_SERVER_FPS | 30 | Server FPS | No | +| HOST_SETTINGS_RCON_ENABLE | "false" | Whether to enable RCON | No | +| HOST_SETTINGS_RCON_PASSWORD | "Ch8ng3m3Pl3@s3!" | RCON Password [Requires: HOST_SETTINGS_RCON_ENABLE=true] | No | +| HOST_SETTINGS_RCON_PORT | "9876" | RCON TCP Port to listen on | No | +| HOST_SETTINGS_AUTOSAVE_COUNT | 40 | How many autosaves to keep | No | +| HOST_SETTINGS_AUTOSAVE_INTERVAL | 120 | Interval in seconds for the server to autosave | No | +| HOST_SETTINGS_LISTEN_ON_STEAM | "true" | Whether to listen on steam | No | +| HOST_SETTINGS_LISTEN_ON_EOS | "true" | Whether to listen on EOS | No | +| GAME_SETTINGS_PRESET | "StandardPvP" | Game Settings Preset to start the server with | No | +| GAME_SETTINGS_DIFFICULTY | "Normal" | Server default difficulty setting | No | +| LIST_ON_MASTER_SERVER | "true" | Whether to list the Server on Master Servers | No | +| SERVER_IP | "127.0.0.1" | Public facing Server IP - **You might have to experiment with this** | Maybe | +| SAVE_NAME | "default_world" | The name of your map | No | +| GAME_PORT | "9876" | UDP Port for Game connections | No | +| QUERY_PORT | "9877" | UDP Port to query the server on | No | +| DEBUG_ENV | "true" | Return all variables to the stdout on container start | No | +| LOGDAYS | 30 | Numer of days after which logs are deleted after their last modification | No | ## Ports @@ -52,6 +72,7 @@ | Exposed Container port | Type | Default | | ------------------------ | ------ | --------- | | 9876 | UDP | ✔️ | +| 9876 | TCP | ❌ | | 9877 | UDP | ✔️ | ## Volumes @@ -59,8 +80,8 @@ | Volume | Container path | Description | | -------------------- | ----------------------------- | ----------------------------------------- | -| steam install path | /mnt/vrising/server | path to hold the dedicated server files | -| world | /mnt/vrising/persistentdata | path that holds the world files | +| steam install path | /home/steam/vrising/server | path to hold the dedicated server files | +| world | /home/steam/vrising/persistentdata | path that holds the world files | ## Docker cli @@ -69,9 +90,9 @@ docker run -d --name='vrising' \ --net='bridge' \ --restart=unless-stopped \ -e TZ="Europe/Paris" \ --e SERVERNAME="trueosiris-V" \ --v '/path/on/host/server':'/mnt/vrising/server':'rw' \ --v '/path/on/host/persistentdata':'/mnt/vrising/persistentdata':'rw' \ +-e HOST_SETTINGS_NAME="trueosiris-V" \ +-v '/path/on/host/server':'/home/steam/vrising/server':'rw' \ +-v '/path/on/host/persistentdata':'/home/steam/vrising/persistentdata':'rw' \ -p 9876:9876/udp \ -p 9877:9877/udp \ 'trueosiris/vrising' @@ -79,30 +100,17 @@ docker run -d --name='vrising' \ ## docker-compose.yml -```yaml -services: - vrising: - image: trueosiris/vrising - environment: - - TZ=Europe/Paris - - SERVERNAME=vrising-TrueOsiris - volumes: - - type: bind - source: /your/host/vrising/server - target: /mnt/vrising/server - bind: - create_host_path: true - - type: bind - source: /your/host/vrising/persistentdata - target: /mnt/vrising/persistentdata - bind: - create_host_path: true - ports: - - '9876:9876/udp' - - '9877:9877/udp' - restart: unless-stopped - network_mode: bridge -``` +See the example docker-compose.yml in this repository. + +## Kubernetes + +You can use the provided example in `kubernetes/kustomize/overlays/exampleorg` to see the ways the base template could be adjusted to your requirements. +It's important to *at least* change the following: +- secret.yaml - Your RCON Secret, if you need one +- pvc.yaml - Adjust `storageClassname` and requsted storage according to your needs +- deployment.yaml - Set Image path to your registry. This image is not pushed to dockerhub by default + +To update your Pod, just delete it and wait for it to restart. ## Links @@ -112,40 +120,28 @@ services: ## RCON - Optional -To enable RCON edit `ServerHostSettings.json` and paste following lines after `QueryPort`. To communicate using RCON protocal use the [RCON CLI](https://github.com/gorcon/rcon-cli) by gorcon. +To enable RCON set the `HOST_SETTINGS_RCON_ENABLE`, `HOST_SETTINGS_RCON_PASSWORD`, `HOST_SETTINGS_RCON_PORT` variables. To communicate using RCON protocal use the [RCON CLI](https://github.com/gorcon/rcon-cli) by gorcon. -```json -"Rcon": { - "Enabled": true, - "Password": "docker", - "Port": 25575 -}, -``` ## Remarks -- Server config files are in `/path/on/host/persistentdata/Settings`. Files in `/path/on/host/server/` are overwritten on Steam update.
- Priority of settings is - - a. container variables - - b. files in /persistentdata +- Server config files are in `/path/on/host/persistentdata/Settings`. + Files in `/path/on/host/server/` are overwritten on Steam update.
+ Priority of settings is - c. files in /server. (and these are reset to defaults each new patch) + - container variables + - files in /server. (and these are reset to defaults each new patch) - If there are no files in `/path/on/host/persistentdata/Settings` on container start, the default files will be copied there from the /server directory.
- Edit `ServerHostSettings.json` if you want to change the ports, descriptions etc. -- Description can be changed in `/path/on/host/persistentdata/Settings/ServerHostSettings.json`. The server will have to be restarted after changes. + Please note that you cannot edit your config files in `$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json` or `$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json`, these will be overwritten by your ENV every time the container is restarted. In case you want to adjust any setting that isn't covered by the current config options, please create an issue or a PR. - If you use different internal & external ports, you can only use direct connect. For example `-p 12345:6789/udp` container port 6789 as defined in ServerHostSettings.json, and exposed as 12345 will make your server invisible ~~, even if `"ListOnMasterServer=true"`~~ -- Make sure `"ListOnSteam": true,` and `"ListOnEOS": true` are set in the ServerHostSettings.json in \persistentdata, so the server is visible in the serverlist. -- If you want to see the server in the server list and want to use 27015-27016/UDP, you'll need to change the ports in the ServerHostSettings.json file to 27015 and 27016. Then expose these ports (below). Of course, forward these udp ports on your firewall from incoming wan to the ports on the internal ip of your dockerhost. +- If you want to see the server in the server list and want to use 27015-27016/UDP, you'll need to change the ports to 27015 and 27016. Then expose these ports (below). Of course, forward these udp ports on your firewall from incoming wan to the ports on the internal ip of your dockerhost. - Start the container & let the server install. - Stop the container. - - Alter the ports in `/path/on/host/persistentdata/Settings/ServerHostSettings.json` to + - Alter the ports to ``` - "Port": 27015, - "QueryPort": 27016, + GAME_PORT: "27015" + QUERY_PORT: "27016" ``` - On your firewall, port forward incoming wan udp ports 27015 and 27016 to the same udp ports on your dockerhost ip. - Restart the container with these ports: @@ -164,4 +160,4 @@ The log of a functional server in 1.0 should look like this: ## Credits -- All credits go to the awesome designers of [V-Rising](https://playvrising.com/)! +- All credits go to the awesome designers of [V-Rising](https://playvrising.com/)! \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cc32c83..88ee7c0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,24 @@ services: vrising: - image: trueosiris/vrising + build: . environment: - - TZ=Europe/Paris - - SERVERNAME=vrising-TrueOsiris + - HOST_SETTINGS_NAME="My Docker-Compose V-Rising Server" + - HOST_SETTINGS_DESCRIPTION="V Rising Server hosted by Docker" + - HOST_SETTINGS_PASSWORD="supersecret" + - HOST_SETTINGS_MAX_CONNECTED_USERS="20" volumes: - type: bind source: /your/host/vrising/server - target: /mnt/vrising/server + target: /home/steam/vrising/server bind: create_host_path: true - type: bind source: /your/host/vrising/persistentdata - target: /mnt/vrising/persistentdata + target: /home/steam/vrising/persistentdata bind: create_host_path: true ports: - '9876:9876/udp' - '9877:9877/udp' restart: unless-stopped - network_mode: bridge + network_mode: bridge \ No newline at end of file diff --git a/files/config_templates/ServerGameSettings.json.template b/files/config_templates/ServerGameSettings.json.template new file mode 100755 index 0000000..9a8396f --- /dev/null +++ b/files/config_templates/ServerGameSettings.json.template @@ -0,0 +1,217 @@ +{ + "GameDifficulty": "${GAME_SETTINGS_DIFFICULTY}", + "GameModeType": "PvP", + "CastleDamageMode": "Never", + "SiegeWeaponHealth": "Normal", + "PlayerDamageMode": "Always", + "CastleHeartDamageMode": "CanBeDestroyedByPlayers", + "PvPProtectionMode": "Medium", + "DeathContainerPermission": "Anyone", + "RelicSpawnType": "Unique", + "CanLootEnemyContainers": true, + "BloodBoundEquipment": true, + "TeleportBoundItems": true, + "BatBoundItems": false, + "AllowGlobalChat": true, + "AllWaypointsUnlocked": false, + "FreeCastleRaid": false, + "FreeCastleClaim": false, + "FreeCastleDestroy": false, + "InactivityKillEnabled": true, + "InactivityKillTimeMin": 3600, + "InactivityKillTimeMax": 604800, + "InactivityKillSafeTimeAddition": 172800, + "InactivityKillTimerMaxItemLevel": 84, + "StartingProgressionLevel": 0, + "DisableDisconnectedDeadEnabled": true, + "DisableDisconnectedDeadTimer": 60, + "DisconnectedSunImmunityTime": 300.0, + "InventoryStacksModifier": 1.0, + "DropTableModifier_General": 1.0, + "DropTableModifier_Missions": 1.0, + "MaterialYieldModifier_Global": 1.0, + "BloodEssenceYieldModifier": 1.0, + "JournalVBloodSourceUnitMaxDistance": 25.0, + "PvPVampireRespawnModifier": 1.0, + "CastleMinimumDistanceInFloors": 2, + "ClanSize": 4, + "BloodDrainModifier": 1.0, + "DurabilityDrainModifier": 1.0, + "GarlicAreaStrengthModifier": 1.0, + "HolyAreaStrengthModifier": 1.0, + "SilverStrengthModifier": 1.0, + "SunDamageModifier": 1.0, + "CastleDecayRateModifier": 1.0, + "CastleBloodEssenceDrainModifier": 1.0, + "CastleSiegeTimer": 420.0, + "CastleUnderAttackTimer": 60.0, + "CastleRaidTimer": 600.0, + "CastleRaidProtectionTime": 1800.0, + "CastleExposedFreeClaimTimer": 300.0, + "CastleRelocationCooldown": 10800.0, + "CastleRelocationEnabled": true, + "AnnounceSiegeWeaponSpawn": true, + "ShowSiegeWeaponMapIcon": false, + "BuildCostModifier": 1.0, + "RecipeCostModifier": 1.0, + "CraftRateModifier": 1.0, + "ResearchCostModifier": 1.0, + "RefinementCostModifier": 1.0, + "RefinementRateModifier": 1.0, + "ResearchTimeModifier": 1.0, + "DismantleResourceModifier": 1.0, + "ServantConvertRateModifier": 1.0, + "RepairCostModifier": 1.0, + "Death_DurabilityFactorLoss": 0.125, + "Death_DurabilityLossFactorAsResources": 1.0, + "StarterEquipmentId": 0, + "StarterResourcesId": 0, + "VBloodUnitSettings": [], + "UnlockedAchievements": [], + "UnlockedResearchs": [], + "GameTimeModifiers": { + "DayDurationInSeconds": 1080.0, + "DayStartHour": 9, + "DayStartMinute": 0, + "DayEndHour": 17, + "DayEndMinute": 0, + "BloodMoonFrequency_Min": 10, + "BloodMoonFrequency_Max": 18, + "BloodMoonBuff": 0.2 + }, + "VampireStatModifiers": { + "MaxHealthModifier": 1.0, + "PhysicalPowerModifier": 1.0, + "SpellPowerModifier": 1.0, + "ResourcePowerModifier": 1.0, + "SiegePowerModifier": 1.0, + "DamageReceivedModifier": 1.0, + "ReviveCancelDelay": 5.0 + }, + "UnitStatModifiers_Global": { + "MaxHealthModifier": 1.0, + "PowerModifier": 1.0, + "LevelIncrease": 0 + }, + "UnitStatModifiers_VBlood": { + "MaxHealthModifier": 1.0, + "PowerModifier": 1.0, + "LevelIncrease": 0 + }, + "EquipmentStatModifiers_Global": { + "MaxHealthModifier": 1.0, + "ResourceYieldModifier": 1.0, + "PhysicalPowerModifier": 1.0, + "SpellPowerModifier": 1.0, + "SiegePowerModifier": 1.0, + "MovementSpeedModifier": 1.0 + }, + "CastleStatModifiers_Global": { + "TickPeriod": 5.0, + "SafetyBoxLimit": 1, + "EyeStructuresLimit": 1, + "TombLimit": 12, + "VerminNestLimit": 4, + "PrisonCellLimit": 16, + "HeartLimits": { + "Level1": { + "FloorLimit": 50, + "ServantLimit": 4, + "BuildLimits": 2, + "HeightLimit": 3 + }, + "Level2": { + "FloorLimit": 140, + "ServantLimit": 5, + "BuildLimits": 2, + "HeightLimit": 3 + }, + "Level3": { + "FloorLimit": 240, + "ServantLimit": 6, + "BuildLimits": 2, + "HeightLimit": 3 + }, + "Level4": { + "FloorLimit": 360, + "ServantLimit": 7, + "BuildLimits": 2, + "HeightLimit": 3 + }, + "Level5": { + "FloorLimit": 550, + "ServantLimit": 8, + "BuildLimits": 2, + "HeightLimit": 3 + } + }, + "CastleLimit": 2, + "NetherGateLimit": 1, + "ThroneOfDarknessLimit": 1 + }, + "PlayerInteractionSettings": { + "TimeZone": "Local", + "VSPlayerWeekdayTime": { + "StartHour": 20, + "StartMinute": 0, + "EndHour": 22, + "EndMinute": 0 + }, + "VSPlayerWeekendTime": { + "StartHour": 20, + "StartMinute": 0, + "EndHour": 22, + "EndMinute": 0 + }, + "VSCastleWeekdayTime": { + "StartHour": 20, + "StartMinute": 0, + "EndHour": 22, + "EndMinute": 0 + }, + "VSCastleWeekendTime": { + "StartHour": 20, + "StartMinute": 0, + "EndHour": 22, + "EndMinute": 0 + } + }, + "TraderModifiers": { + "StockModifier": 1.0, + "PriceModifier": 1.0, + "RestockTimerModifier": 1.0 + }, + "WarEventGameSettings": { + "Interval": 1, + "MajorDuration": 1, + "MinorDuration": 1, + "WeekdayTime": { + "StartHour": 0, + "StartMinute": 0, + "EndHour": 23, + "EndMinute": 59 + }, + "WeekendTime": { + "StartHour": 0, + "StartMinute": 0, + "EndHour": 23, + "EndMinute": 59 + }, + "ScalingPlayers1": { + "PointsModifier": 1.0, + "DropModifier": 1.0 + }, + "ScalingPlayers2": { + "PointsModifier": 0.5, + "DropModifier": 0.5 + }, + "ScalingPlayers3": { + "PointsModifier": 0.25, + "DropModifier": 0.25 + }, + "ScalingPlayers4": { + "PointsModifier": 0.25, + "DropModifier": 0.25 + } + } +} \ No newline at end of file diff --git a/files/config_templates/ServerHostSettings.json.template b/files/config_templates/ServerHostSettings.json.template new file mode 100755 index 0000000..f7ef909 --- /dev/null +++ b/files/config_templates/ServerHostSettings.json.template @@ -0,0 +1,29 @@ +{ + "Name": "${HOST_SETTINGS_NAME}", + "Description": "${HOST_SETTINGS_DESCRIPTION}", + "Port": ${GAME_PORT}, + "QueryPort": ${QUERY_PORT}, + "MaxConnectedUsers": ${HOST_SETTINGS_MAX_CONNECTED_USERS}, + "MaxConnectedAdmins": ${HOST_SETTINGS_MAX_CONNECTED_ADMINS}, + "ServerFps": ${HOST_SETTINGS_SERVER_FPS}, + "SaveName": "${SAVE_NAME}", + "Password": "${HOST_SETTINGS_PASSWORD}", + "Secure": true, + "ListOnSteam": ${HOST_SETTINGS_LISTEN_ON_STEAM}, + "ListOnEOS": ${HOST_SETTINGS_LISTEN_ON_EOS}, + "AutoSaveCount": ${HOST_SETTINGS_AUTOSAVE_COUNT}, + "AutoSaveInterval": ${HOST_SETTINGS_AUTOSAVE_INTERVAL}, + "CompressSaveFiles": true, + "GameSettingsPreset": "${GAME_SETTINGS_PRESET}", + "GameDifficultyPreset": "", + "AdminOnlyDebugEvents": true, + "DisableDebugEvents": false, + "API": { + "Enabled": false + }, + "Rcon": { + "Enabled": ${HOST_SETTINGS_RCON_ENABLE}, + "Port": ${HOST_SETTINGS_RCON_PORT}, + "Password": "${HOST_SETTINGS_RCON_PASSWORD}" + } +} \ No newline at end of file diff --git a/files/scripts/cleanlogs.sh.template b/files/scripts/cleanlogs.sh.template new file mode 100644 index 0000000..9590f8c --- /dev/null +++ b/files/scripts/cleanlogs.sh.template @@ -0,0 +1,4 @@ +#!/bin/bash +echo "$(date) === Cleaning up logs older than ${LOGDAYS} days" +find "${PERSISTENT_DATA_PATH}" -name "*.log" -type f -mtime +"${LOGDAYS}" -exec rm {} \; +echo "$(date) === Cleaned up Logfiles" | tee -a "$(cat /home/steam/currentlog_path.txt)" \ No newline at end of file diff --git a/files/scripts/entrypoint.sh b/files/scripts/entrypoint.sh new file mode 100755 index 0000000..c314a6d --- /dev/null +++ b/files/scripts/entrypoint.sh @@ -0,0 +1,129 @@ +#!/bin/bash +set -eu + +echo " " +echo " ================================================================ " +echo " Welcome to V Rising Docker " +echo " This Server is running a Wine Session " +echo " Please refer to the documentation to see config options " +echo " ================================================================ " +echo " " + +# Print Environment when debugging +if [[ "$DEBUG_ENV" == "true" ]]; then + echo " " + echo " ================================================================ " + echo " Showing Environment Variables " + echo " ================================================================ " + echo " " + env +fi + +term_handler() { + echo " " + echo " ================================================================ " + echo " Shutting Down Server due to Termination Signal " + echo " ================================================================ " + echo " " + + if ! ps -q "$(cat /home/steam/server.pid)" -o state --no-headers | grep -q -v "D|R|S"; then + echo "Could not find VRisingServer.exe pid. Assuming server is dead..." + else + echo "Shutting server down gracefully..." + kill -n 15 "$(cat /home/steam/server.pid)" + wait "$(cat /home/steam/server.pid)" + fi + wineserver -k + sleep 1 + exit +} + +trap 'term_handler' SIGTERM SIGINT + +echo " " +echo " ================================================================ " +echo " Creating folders and installing Gameserver " +echo " ================================================================ " +echo " " + +mkdir -v -p "$SERVER_DATA_PATH" +mkdir -v -p "$PERSISTENT_DATA_PATH" +/home/steam/steamcmd/steamcmd.sh +@sSteamCmdForcePlatformType windows +force_install_dir "$SERVER_DATA_PATH" +login anonymous +app_update 1829350 validate +quit + +echo "steam_appid: $(cat "${SERVER_DATA_PATH}"/steam_appid.txt)" + +echo " " +echo " ================================================================ " +echo " Checking AVX CPU Support " +echo " ================================================================ " +echo " " + +if grep -q -o 'avx[^ ]*' /proc/cpuinfo; then + unsupported_file="VRisingServer_Data/Plugins/x86_64/lib_burst_generated.dll" + echo "AVX or AVX2 not supported; Check if unsupported ${unsupported_file} exists" + if [ -f "$SERVER_DATA_PATH/${unsupported_file}" ]; then + echo "Changing ${unsupported_file} as attempt to fix issues..." + mv "$SERVER_DATA_PATH/${unsupported_file}" "$SERVER_DATA_PATH/${unsupported_file}.bak" + fi +else + echo "CPU supporting AVX, continuing..." +fi + +echo " " +echo " ================================================================ " +echo " Creating Config Files " +echo " ================================================================ " +echo " " + +mkdir -p "$PERSISTENT_DATA_PATH/Settings" + +envsubst < /home/steam/files/config_templates/ServerGameSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json" +envsubst < /home/steam/files/config_templates/ServerHostSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json" + +echo " " +echo " ================================================================ " +echo " Creating Cron Files " +echo " ================================================================ " +echo " " + +envsubst < /home/steam/files/scripts/cleanlogs.sh.template > /home/steam/files/scripts/cleanlogs.sh +chmod +x /home/steam/files/scripts/cleanlogs.sh + +# Checks if log file exists, if not creates it +echo " " +echo " ================================================================ " +echo " Creating Log File " +echo " ================================================================ " +echo " " + +current_date=$(date +"%Y%m%d-%H%M") +logfile="$current_date-VRisingServer.log" +if ! [ -f "$PERSISTENT_DATA_PATH/$logfile" ]; then + echo "Creating $PERSISTENT_DATA_PATH/$logfile" + touch "$PERSISTENT_DATA_PATH"/"$logfile" + echo "$PERSISTENT_DATA_PATH/$logfile" > /home/steam/currentlog_path.txt +fi + +cd "$SERVER_DATA_PATH" + +echo " " +echo " ================================================================ " +echo " Starting Server via Wine " +echo " ================================================================ " +echo " " + +v() { + xvfb-run \ + --auto-servernum \ + --server-args='-screen 0 640x480x24:32' \ + wine "$SERVER_DATA_PATH"/VRisingServer.exe -persistentDataPath "$PERSISTENT_DATA_PATH" -serverName "$HOST_SETTINGS_NAME" -saveName "$SAVE_NAME" -logFile "$PERSISTENT_DATA_PATH"/"$logfile" "$GAME_PORT" "$QUERY_PORT" 2>&1 & +} +v +# Gets the PID of the last command +ServerPID=$! +echo "Server PID is $ServerPID" +echo "$ServerPID" > /home/steam/server.pid + +# Tail log file and waits for Server PID to exit +/usr/bin/tail -n 0 -f "$PERSISTENT_DATA_PATH"/"$logfile" & +wait $ServerPID diff --git a/files/scripts/healthcheck.sh b/files/scripts/healthcheck.sh new file mode 100755 index 0000000..438bc6b --- /dev/null +++ b/files/scripts/healthcheck.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -eu + +ps -q "$(cat /home/steam/server.pid)" -o state --no-headers | grep -q -v "D|R|S" \ No newline at end of file diff --git a/kubernetes/kustomize/base/configMap.yaml b/kubernetes/kustomize/base/configMap.yaml new file mode 100644 index 0000000..7381376 --- /dev/null +++ b/kubernetes/kustomize/base/configMap.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: vrisingcm +data: + SERVER_DATA_PATH: "/home/steam/vrising/server" + PERSISTENT_DATA_PATH: "/home/steam/vrising/persistentdata" + HOST_SETTINGS_NAME: "My Kubernetes V-Rising Server" + HOST_SETTINGS_DESCRIPTION: "V Rising Server hosted by Kubernetes" + HOST_SETTINGS_PASSWORD: "" + HOST_SETTINGS_MAX_CONNECTED_USERS: "10" + HOST_SETTINGS_MAX_CONNECTED_ADMINS: "4" + HOST_SETTINGS_SERVER_ADMIN_LIST: "" + HOST_SETTINGS_SERVER_FPS: "30" + HOST_SETTINGS_RCON_ENABLE: "true" + HOST_SETTINGS_RCON_PORT: "9876" + HOST_SETTINGS_AUTOSAVE_COUNT: "40" + HOST_SETTINGS_AUTOSAVE_INTERVAL: "120" + HOST_SETTINGS_LISTEN_ON_STEAM: "false" + HOST_SETTINGS_LISTEN_ON_EOS: "false" + GAME_SETTINGS_PRESET: "StandardPvP" + GAME_SETTINGS_DIFFICULTY: "Normal" + LIST_ON_MASTER_SERVER: "true" + SERVER_IP: "127.0.0.1" + SAVE_NAME: "default_world" + GAME_PORT: "9876" + QUERY_PORT: "9877" + STEAM_USER_UID: "1000" + STEAM_USER_GID: "1000" + DEBUG_ENV: "true" diff --git a/kubernetes/kustomize/base/deployment.yaml b/kubernetes/kustomize/base/deployment.yaml new file mode 100644 index 0000000..328973d --- /dev/null +++ b/kubernetes/kustomize/base/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vrisingserverdeployment +spec: + selector: + matchLabels: + app: vRisingServer + template: + metadata: + labels: + app: vRisingServer + spec: + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + fsGroup: 1000 + volumes: + - name: persistentdata + persistentVolumeClaim: + claimName: vrisingpersistentdata + - name: serverdata + persistentVolumeClaim: + claimName: vrisingserverdata + containers: + - name: vrisingservercontainer + image: example.com/path/to/image:tag + volumeMounts: + - name: persistentdata + mountPath: /home/steam/vrising/persistentdata + - name: serverdata + mountPath: /home/steam/vrising/server + envFrom: + - configMapRef: + name: vrisingcm + - secretRef: + name: vrisingsecret + resources: + limits: + memory: "4Gi" + cpu: "4" + requests: + memory: "4Gi" + cpu: "1" + livenessProbe: + exec: + command: + - /bin/bash + - -c + - /home/steam/files/scripts/healthcheck.sh + initialDelaySeconds: 360 + periodSeconds: 20 + ports: + - protocol: UDP + containerPort: 9876 + - protocol: TCP + containerPort: 9876 + - protocol: UDP + containerPort: 9877 diff --git a/kubernetes/kustomize/base/kustomization.yaml b/kubernetes/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..afd6094 --- /dev/null +++ b/kubernetes/kustomize/base/kustomization.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: vrising +commonLabels: + app: vRisingServer +resources: + - configMap.yaml + - deployment.yaml + - secret.yaml + - nodePort.yaml + - networkPolicy.yaml + - pvc.yaml \ No newline at end of file diff --git a/kubernetes/kustomize/base/networkPolicy.yaml b/kubernetes/kustomize/base/networkPolicy.yaml new file mode 100644 index 0000000..37a6fee --- /dev/null +++ b/kubernetes/kustomize/base/networkPolicy.yaml @@ -0,0 +1,63 @@ +--- +kind: NetworkPolicy +apiVersion: networking.k8s.io/v1 +metadata: + name: vrisingdenyall +spec: + podSelector: + matchLabels: + app: vRisingServer + policyTypes: + - Ingress + - Egress + +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: vrisinginternetegress +spec: + podSelector: + matchLabels: + app: vRisingServer + policyTypes: + - Egress + egress: + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + - podSelector: + matchLabels: + k8s-app: kube-dns + ports: + - protocol: UDP + port: 53 + + - to: + - ipBlock: + cidr: 0.0.0.0/0 + except: + - 10.0.0.0/8 + - 192.168.0.0/16 + - 172.16.0.0/12 + +--- +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: vrisinginternetingress +spec: + podSelector: + matchLabels: + app: vRisingServer + policyTypes: + - Ingress + ingress: + - ports: + - port: 9876 + protocol: UDP + - port: 9876 + - port: 9877 + protocol: UDP + diff --git a/kubernetes/kustomize/base/nodePort.yaml b/kubernetes/kustomize/base/nodePort.yaml new file mode 100644 index 0000000..52ba3da --- /dev/null +++ b/kubernetes/kustomize/base/nodePort.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: Service +metadata: + name: vrisingnodeport +spec: + type: NodePort + selector: + app: vRisingServer + ports: + - name: gameport + port: 9876 + protocol: UDP + nodePort: 30876 + targetPort: 9876 + - name: rconport + port: 9876 + protocol: TCP + nodePort: 30876 + targetPort: 9876 + - name: queryport + port: 9877 + protocol: UDP + nodePort: 30877 + targetPort: 9877 \ No newline at end of file diff --git a/kubernetes/kustomize/base/pvc.yaml b/kubernetes/kustomize/base/pvc.yaml new file mode 100644 index 0000000..85bd8b5 --- /dev/null +++ b/kubernetes/kustomize/base/pvc.yaml @@ -0,0 +1,27 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: vrisingpersistentdata +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + storageClassName: my-storage-class + accessModes: + - ReadWriteOnce + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: vrisingserverdata +spec: + resources: + requests: + storage: 10Gi + volumeMode: Filesystem + storageClassName: my-storage-class + accessModes: + - ReadWriteOnce \ No newline at end of file diff --git a/kubernetes/kustomize/base/secret.yaml b/kubernetes/kustomize/base/secret.yaml new file mode 100644 index 0000000..9a9d483 --- /dev/null +++ b/kubernetes/kustomize/base/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: vrisingsecret +type: Opaque +data: + HOST_SETTINGS_RCON_PASSWORD: Q2g4bmczbTNQbDNAczMh diff --git a/kubernetes/kustomize/overlays/exampleorg/configMap.yaml b/kubernetes/kustomize/overlays/exampleorg/configMap.yaml new file mode 100644 index 0000000..278dde6 --- /dev/null +++ b/kubernetes/kustomize/overlays/exampleorg/configMap.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: vrisingcm +data: + SERVER_DATA_PATH: "/home/steam/vrising/server" + PERSISTENT_DATA_PATH: "/home/steam/vrising/persistentdata" + HOST_SETTINGS_NAME: "My Kubernetes V-Rising Server" + HOST_SETTINGS_DESCRIPTION: "V Rising Server hosted by Kubernetes" + HOST_SETTINGS_PASSWORD: "start123" + HOST_SETTINGS_MAX_CONNECTED_USERS: "10" + HOST_SETTINGS_MAX_CONNECTED_ADMINS: "4" + HOST_SETTINGS_SERVER_ADMIN_LIST: "" + HOST_SETTINGS_SERVER_FPS: "30" + HOST_SETTINGS_RCON_ENABLE: "true" + HOST_SETTINGS_RCON_PORT: "9876" + HOST_SETTINGS_AUTOSAVE_COUNT: "40" + HOST_SETTINGS_AUTOSAVE_INTERVAL: "120" + HOST_SETTINGS_LISTEN_ON_STEAM: "false" + HOST_SETTINGS_LISTEN_ON_EOS: "false" + GAME_SETTINGS_PRESET: "StandardPvP" + GAME_SETTINGS_DIFFICULTY: "Normal" + LIST_ON_MASTER_SERVER: "true" + SERVER_IP: "127.0.0.1" + SAVE_NAME: "default_world" + GAME_PORT: "9876" + QUERY_PORT: "9877" + STEAM_USER_UID: "1000" + STEAM_USER_GID: "1000" + DEBUG_ENV: "true" \ No newline at end of file diff --git a/kubernetes/kustomize/overlays/exampleorg/deployment.yaml b/kubernetes/kustomize/overlays/exampleorg/deployment.yaml new file mode 100644 index 0000000..fad1ed3 --- /dev/null +++ b/kubernetes/kustomize/overlays/exampleorg/deployment.yaml @@ -0,0 +1,10 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: vrisingserverdeployment +spec: + template: + spec: + containers: + - name: vrisingservercontainer + image: example.org/path/to/image:tag diff --git a/kubernetes/kustomize/overlays/exampleorg/kustomization.yaml b/kubernetes/kustomize/overlays/exampleorg/kustomization.yaml new file mode 100644 index 0000000..78024ab --- /dev/null +++ b/kubernetes/kustomize/overlays/exampleorg/kustomization.yaml @@ -0,0 +1,17 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: vRisingServerExampleOrg +commonLabels: + variant: exampleorg + app: vRisingServer +resources: + - ../../base +patches: + - path: configMap.yaml + - path: secret.yaml + - path: deployment.yaml +patchesStrategicMerge: # This might be deprecated, but there is no actual fix for multi-part yaml files like the pvc.yml https://github.com/kubernetes-sigs/kustomize/issues/5052 + - pvc.yaml # I don't want to split this into two files... + # Kustomize should support this in the future: https://github.com/kubernetes-sigs/kustomize/issues/5049 + # This can then be moved back to patches: - path: pvc.yaml diff --git a/kubernetes/kustomize/overlays/exampleorg/pvc.yaml b/kubernetes/kustomize/overlays/exampleorg/pvc.yaml new file mode 100644 index 0000000..029b2a2 --- /dev/null +++ b/kubernetes/kustomize/overlays/exampleorg/pvc.yaml @@ -0,0 +1,27 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: vrisingpersistentdata +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + storageClassName: my-longhorn-storage-class + accessModes: + - ReadWriteOnce + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: vrisingserverdata +spec: + resources: + requests: + storage: 15Gi + volumeMode: Filesystem + storageClassName: my-longhorn-storage-class + accessModes: + - ReadWriteOnce diff --git a/kubernetes/kustomize/overlays/exampleorg/secret.yaml b/kubernetes/kustomize/overlays/exampleorg/secret.yaml new file mode 100644 index 0000000..9db500f --- /dev/null +++ b/kubernetes/kustomize/overlays/exampleorg/secret.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: vrisingsecret +type: Opaque +data: + HOST_SETTINGS_RCON_PASSWORD: U2VyaW91c2x5Q2hhbmdlVGhpcz8= diff --git a/src/debian.sources b/src/debian.sources new file mode 100644 index 0000000..353adfa --- /dev/null +++ b/src/debian.sources @@ -0,0 +1,13 @@ +Types: deb +# http://snapshot.debian.org/archive/debian/20240513T000000Z +URIs: http://deb.debian.org/debian +Suites: bookworm bookworm-updates +Components: main contrib non-free non-free-firmware +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg + +Types: deb +# http://snapshot.debian.org/archive/debian-security/20240513T000000Z +URIs: http://deb.debian.org/debian-security +Suites: bookworm-security +Components: main contrib non-free non-free-firmware +Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg From 8117bc64a364698a004c028cc0ae8757f68642de Mon Sep 17 00:00:00 2001 From: Panromir Date: Thu, 23 May 2024 22:13:35 +0200 Subject: [PATCH 02/25] remove start.sh --- start.sh | 113 ------------------------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 start.sh diff --git a/start.sh b/start.sh deleted file mode 100644 index 350a8f5..0000000 --- a/start.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -s=/mnt/vrising/server -p=/mnt/vrising/persistentdata - -term_handler() { - echo "Shutting down Server" - - PID=$(pgrep -f "^${s}/VRisingServer.exe") - if [[ -z $PID ]]; then - echo "Could not find VRisingServer.exe pid. Assuming server is dead..." - else - kill -n 15 "$PID" - wait "$PID" - fi - wineserver -k - sleep 1 - exit -} - -cleanup_logs() { - echo "Cleaning up logs older than $LOGDAYS days" - find "$p" -name "*.log" -type f -mtime +$LOGDAYS -exec rm {} \; -} - -trap 'term_handler' SIGTERM - -if [ -z "$LOGDAYS" ]; then - LOGDAYS=30 -fi -if [[ -n $UID ]]; then - usermod -u "$UID" docker 2>&1 -fi -if [[ -n $GID ]]; then - groupmod -g "$GID" docker 2>&1 -fi -if [ -z "$SERVERNAME" ]; then - SERVERNAME="trueosiris-V" -fi -override_savename="" -if [[ -n "$WORLDNAME" ]]; then - override_savename="-saveName $WORLDNAME" -fi -game_port="" -if [[ -n $GAMEPORT ]]; then - game_port=" -gamePort $GAMEPORT" -fi -query_port="" -if [[ -n $QUERYPORT ]]; then - query_port=" -queryPort $QUERYPORT" -fi - -cleanup_logs - -mkdir -p /root/.steam 2>/dev/null -chmod -R 777 /root/.steam 2>/dev/null -echo " " -echo "Updating V-Rising Dedicated Server files..." -echo " " -/usr/bin/steamcmd +@sSteamCmdForcePlatformType windows +force_install_dir "$s" +login anonymous +app_update 1829350 validate +quit -printf "steam_appid: " -cat "$s/steam_appid.txt" - -echo " " -if ! grep -q -o 'avx[^ ]*' /proc/cpuinfo; then - unsupported_file="VRisingServer_Data/Plugins/x86_64/lib_burst_generated.dll" - echo "AVX or AVX2 not supported; Check if unsupported ${unsupported_file} exists" - if [ -f "${s}/${unsupported_file}" ]; then - echo "Changing ${unsupported_file} as attempt to fix issues..." - mv "${s}/${unsupported_file}" "${s}/${unsupported_file}.bak" - fi -fi - -echo " " -mkdir "$p/Settings" 2>/dev/null -if [ ! -f "$p/Settings/ServerGameSettings.json" ]; then - echo "$p/Settings/ServerGameSettings.json not found. Copying default file." - cp "$s/VRisingServer_Data/StreamingAssets/Settings/ServerGameSettings.json" "$p/Settings/" 2>&1 -fi -if [ ! -f "$p/Settings/ServerHostSettings.json" ]; then - echo "$p/Settings/ServerHostSettings.json not found. Copying default file." - cp "$s/VRisingServer_Data/StreamingAssets/Settings/ServerHostSettings.json" "$p/Settings/" 2>&1 -fi - -# Checks if log file exists, if not creates it -current_date=$(date +"%Y%m%d-%H%M") -logfile="$current_date-VRisingServer.log" -if ! [ -f "${p}/$logfile" ]; then - echo "Creating ${p}/$logfile" - touch "$p/$logfile" -fi - -cd "$s" || { - echo "Failed to cd to $s" - exit 1 -} -echo "Starting V Rising Dedicated Server with name $SERVERNAME" -echo "Trying to remove /tmp/.X0-lock" -rm /tmp/.X0-lock 2>&1 -echo " " -echo "Starting Xvfb" -Xvfb :0 -screen 0 1024x768x16 & -echo "Launching wine64 V Rising" -echo " " -v() { - DISPLAY=:0.0 wine64 /mnt/vrising/server/VRisingServer.exe -persistentDataPath $p -serverName "$SERVERNAME" "$override_savename" -logFile "$p/$logfile" "$game_port" "$query_port" 2>&1 & -} -v -# Gets the PID of the last command -ServerPID=$! - -# Tail log file and waits for Server PID to exit -/usr/bin/tail -n 0 -f "$p/$logfile" & -wait $ServerPID From fc5d673cecc152519ab6afd17b1f9b4d377d3eca Mon Sep 17 00:00:00 2001 From: Panromir Date: Thu, 23 May 2024 22:21:03 +0200 Subject: [PATCH 03/25] fix base distro type --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96ea30e..f432e12 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Iroh -

Dockerized V Rising dedicated server in an Ubuntu 22.04 container with Wine.

+

Dockerized V Rising dedicated server in an Debian 12 container with Wine.

[![Docker Pulls](https://badgen.net/docker/pulls/trueosiris/vrising?icon=docker&label=pulls)](https://hub.docker.com/r/trueosiris/vrising/) From f6430f61aebcd40c3c0754b46910bf3d2326e716 Mon Sep 17 00:00:00 2001 From: Panromir Date: Thu, 23 May 2024 22:32:35 +0200 Subject: [PATCH 04/25] add dockerignore, reset maintainer --- .dockerignore | 4 ++++ Dockerfile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..86533e6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +assets/ +kubernetes/ +.gitignore +docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 0854311..f2a812f 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM cm2network/steamcmd:root-bookworm -LABEL maintainer="Panromir " +LABEL maintainer="Tim Chaubet" #VOLUME ["/home/steam/vrising/server", "/home/steam/vrising/persistentdata"] EXPOSE 9876/udp # Expose 9876/tcp if using RCON. See RCON_PORT Env variable From 6470b8e5b69c34fe78aea3b1360ea6b1214906cf Mon Sep 17 00:00:00 2001 From: Panromir Date: Fri, 24 May 2024 09:15:11 +0200 Subject: [PATCH 05/25] Remove STEAM_USER_UID, remove docker-compose env quotes --- Dockerfile | 2 -- README.md | 3 ++- docker-compose.yml | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2a812f..3192cd8 100755 --- a/Dockerfile +++ b/Dockerfile @@ -29,8 +29,6 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ SAVE_NAME="default_world" \ GAME_PORT="9876" \ QUERY_PORT="9877" \ - STEAM_USER_UID="1000" \ - STEAM_USER_GID="1000" \ DEBUG_ENV="true" \ LOGDAYS="30" \ TZ="Europe/Brussels" diff --git a/README.md b/README.md index f432e12..07dcc93 100755 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ docker run -d --name='vrising' \ ## docker-compose.yml See the example docker-compose.yml in this repository. +Do not put any of your env variables in the "environment:" section in quotes. ## Kubernetes @@ -160,4 +161,4 @@ The log of a functional server in 1.0 should look like this: ## Credits -- All credits go to the awesome designers of [V-Rising](https://playvrising.com/)! \ No newline at end of file +- All credits go to the awesome designers of [V-Rising](https://playvrising.com/)! diff --git a/docker-compose.yml b/docker-compose.yml index 88ee7c0..9e95538 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,10 +2,10 @@ services: vrising: build: . environment: - - HOST_SETTINGS_NAME="My Docker-Compose V-Rising Server" - - HOST_SETTINGS_DESCRIPTION="V Rising Server hosted by Docker" - - HOST_SETTINGS_PASSWORD="supersecret" - - HOST_SETTINGS_MAX_CONNECTED_USERS="20" + - HOST_SETTINGS_NAME=My Docker-Compose V-Rising Server + - HOST_SETTINGS_DESCRIPTION=V Rising Server hosted by Docker + - HOST_SETTINGS_PASSWORD=supersecret + - HOST_SETTINGS_MAX_CONNECTED_USERS=20 volumes: - type: bind source: /your/host/vrising/server @@ -21,4 +21,4 @@ services: - '9876:9876/udp' - '9877:9877/udp' restart: unless-stopped - network_mode: bridge \ No newline at end of file + network_mode: bridge From e831db96a0b7bfbe81c492c8251b1d428b0b7cf0 Mon Sep 17 00:00:00 2001 From: Panromir Date: Fri, 24 May 2024 09:23:02 +0200 Subject: [PATCH 06/25] Add docker-compose information to README --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 07dcc93..467bca8 100755 --- a/README.md +++ b/README.md @@ -103,6 +103,12 @@ docker run -d --name='vrising' \ See the example docker-compose.yml in this repository. Do not put any of your env variables in the "environment:" section in quotes. +**IMPORTANT**: The compose file will create the path you define in `source` if it does not exist. Ensure you're either running with UID/GID 1000 (the steam user in the container) or change owners of these folders accordingly. Otherwise you will get the following error: + +``` +mkdir: cannot create directory '/home/steam/vrising/persistentdata/Settings': Permission denied +``` + ## Kubernetes You can use the provided example in `kubernetes/kustomize/overlays/exampleorg` to see the ways the base template could be adjusted to your requirements. From 6837b0d71d2530aeddf014d2a90e3153f130704c Mon Sep 17 00:00:00 2001 From: Panromir Date: Fri, 24 May 2024 09:43:11 +0200 Subject: [PATCH 07/25] add config replacement override --- Dockerfile | 1 + README.md | 4 +++- files/scripts/entrypoint.sh | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3192cd8..79ec032 100755 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ QUERY_PORT="9877" \ DEBUG_ENV="true" \ LOGDAYS="30" \ + OVERRIDE_CONFIG="true" \ TZ="Europe/Brussels" COPY --chown=steam:steam --chmod=744 files /home/steam/files/ diff --git a/README.md b/README.md index 467bca8..9568366 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ | QUERY_PORT | "9877" | UDP Port to query the server on | No | | DEBUG_ENV | "true" | Return all variables to the stdout on container start | No | | LOGDAYS | 30 | Numer of days after which logs are deleted after their last modification | No | +| OVERRIDE_CONFIG | true | Whether to generate new configs at the start of the container. | No | ## Ports @@ -139,7 +140,8 @@ To enable RCON set the `HOST_SETTINGS_RCON_ENABLE`, `HOST_SETTINGS_RCON_PASSWORD - container variables - files in /server. (and these are reset to defaults each new patch) - Please note that you cannot edit your config files in `$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json` or `$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json`, these will be overwritten by your ENV every time the container is restarted. In case you want to adjust any setting that isn't covered by the current config options, please create an issue or a PR. + Please note that you cannot edit your config files in `$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json` or `$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json`, these will be overwritten by your ENV every time the container is restarted by default. In case you want to adjust any setting that isn't covered by the current config options, please create an issue or a PR. + If you want to manually adjust your configs and keep your changes, move your config files (with proper access rights) to your mounted folder and set `OVERRIDE_CONFIG="false"` - If you use different internal & external ports, you can only use direct connect. For example `-p 12345:6789/udp` container port 6789 as defined in ServerHostSettings.json, and exposed as 12345 will make your server invisible ~~, even if `"ListOnMasterServer=true"`~~ - If you want to see the server in the server list and want to use 27015-27016/UDP, you'll need to change the ports to 27015 and 27016. Then expose these ports (below). Of course, forward these udp ports on your firewall from incoming wan to the ports on the internal ip of your dockerhost. diff --git a/files/scripts/entrypoint.sh b/files/scripts/entrypoint.sh index c314a6d..0c79b5b 100755 --- a/files/scripts/entrypoint.sh +++ b/files/scripts/entrypoint.sh @@ -77,8 +77,20 @@ echo " " mkdir -p "$PERSISTENT_DATA_PATH/Settings" -envsubst < /home/steam/files/config_templates/ServerGameSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json" -envsubst < /home/steam/files/config_templates/ServerHostSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json" +if [[ "${OVERRIDE_CONFIG}" == "true" ]]; then + echo "Replacing config files. If you want to change this behaviour, set OVERRIDE_CONFIG to false" + envsubst < /home/steam/files/config_templates/ServerGameSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json" + envsubst < /home/steam/files/config_templates/ServerHostSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json" +elif [[ "${OVERRIDE_CONFIG}" == "false" ]]; then + if [[ ! -f "$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json" ]]; then + echo "Couldn't find $PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json, creating..." + envsubst < /home/steam/files/config_templates/ServerGameSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerGameSettings.json" + fi + if [[ ! -f "$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json" ]]; then + echo "Couldn't find $PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json, creating..." + envsubst < /home/steam/files/config_templates/ServerHostSettings.json.template > "$PERSISTENT_DATA_PATH/Settings/ServerHostSettings.json" + fi +fi echo " " echo " ================================================================ " From 79aafa1cfaf2c9ba5ac1cfd8c72fae6c8f3d5230 Mon Sep 17 00:00:00 2001 From: Panromir Date: Fri, 24 May 2024 11:47:57 +0200 Subject: [PATCH 08/25] add daily log rotation --- Dockerfile | 2 +- files/scripts/cleanlogs.sh.template | 2 ++ files/scripts/entrypoint.sh | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 79ec032..2b9c28d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -56,7 +56,7 @@ RUN DEBIAN_FRONTEND=noninteractive \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ chmod +x /home/steam/files/scripts/* && \ - echo "0 * * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh > /proc/1/fd/1 2>&1" >> /etc/cron.d/logrotation && \ + echo "00 00 * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh > /proc/1/fd/1 2>&1" >> /etc/cron.d/logrotation && \ crontab -u steam /etc/cron.d/logrotation && \ chmod u+s /usr/sbin/cron diff --git a/files/scripts/cleanlogs.sh.template b/files/scripts/cleanlogs.sh.template index 9590f8c..da34f92 100644 --- a/files/scripts/cleanlogs.sh.template +++ b/files/scripts/cleanlogs.sh.template @@ -1,4 +1,6 @@ #!/bin/bash +echo "$(date) === Rotating logs" +mv "$(cat /home/steam/currentlog_path.txt)" "$PERSISTENT_DATA_PATH/$(date +%d-%m-%y)-VRisingServer.log" echo "$(date) === Cleaning up logs older than ${LOGDAYS} days" find "${PERSISTENT_DATA_PATH}" -name "*.log" -type f -mtime +"${LOGDAYS}" -exec rm {} \; echo "$(date) === Cleaned up Logfiles" | tee -a "$(cat /home/steam/currentlog_path.txt)" \ No newline at end of file diff --git a/files/scripts/entrypoint.sh b/files/scripts/entrypoint.sh index 0c79b5b..9b36c4e 100755 --- a/files/scripts/entrypoint.sh +++ b/files/scripts/entrypoint.sh @@ -108,8 +108,7 @@ echo " Creating Log File " echo " ================================================================ " echo " " -current_date=$(date +"%Y%m%d-%H%M") -logfile="$current_date-VRisingServer.log" +logfile="VRisingServer.log" if ! [ -f "$PERSISTENT_DATA_PATH/$logfile" ]; then echo "Creating $PERSISTENT_DATA_PATH/$logfile" touch "$PERSISTENT_DATA_PATH"/"$logfile" From d7f52e5aa730339325011936cfe6b9dccf4a49e9 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Fri, 24 May 2024 08:48:40 -0400 Subject: [PATCH 09/25] Update Dockerfile Add arg for changing user and group id --- Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2b9c28d..75d9c81 100755 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,10 @@ EXPOSE 9876/udp EXPOSE 9876 EXPOSE 9877/udp +# Let the user change the user and group ID +ARG STEAM_USER_UID="1000" \ + STEAM_USER_GID="1000" + ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ PERSISTENT_DATA_PATH="/home/steam/vrising/persistentdata" \ HOST_SETTINGS_NAME="My Docker V-Rising Server" \ @@ -34,6 +38,9 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ OVERRIDE_CONFIG="true" \ TZ="Europe/Brussels" +# Set the user and group ID +RUN usermod -u $STEAM_USER_UID steam && groupmod -g $STEAM_USER_GID steam + COPY --chown=steam:steam --chmod=744 files /home/steam/files/ COPY src/debian.sources /etc/apt/sources.list.d/debian.sources From e791364b5b21c8d6199bc469dbcd6cb38f5560d7 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Fri, 24 May 2024 08:50:25 -0400 Subject: [PATCH 10/25] Update docker-compose.yml Added example for new args --- docker-compose.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9e95538..f5e33dc 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,11 @@ services: vrising: - build: . + build: + context: . + args: + STEAM_USER_UID: 1006 + STEAM_USER_GID: 1006 + environment: - HOST_SETTINGS_NAME=My Docker-Compose V-Rising Server - HOST_SETTINGS_DESCRIPTION=V Rising Server hosted by Docker From d17f45267f981d1f1657feaaa958f5ef9677d93e Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Fri, 24 May 2024 08:56:43 -0400 Subject: [PATCH 11/25] Update README.md --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9568366..a14fbf5 100755 --- a/README.md +++ b/README.md @@ -67,6 +67,14 @@ | LOGDAYS | 30 | Numer of days after which logs are deleted after their last modification | No | | OVERRIDE_CONFIG | true | Whether to generate new configs at the start of the container. | No | +## Argument variables + + +| Variable | Default V(alue) | Description | Mandatory | +| --------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------- | --------- | +| STEAM_USER_UID | 1000 | The user ID the server will run on | No | +| STEAM_USER_GID | 1000 | The group ID the server will run on | No | + ## Ports @@ -96,6 +104,8 @@ docker run -d --name='vrising' \ -v '/path/on/host/persistentdata':'/home/steam/vrising/persistentdata':'rw' \ -p 9876:9876/udp \ -p 9877:9877/udp \ +--build-arg STEAM_USER_UID=1000 \ +--build-arg STEAM_USER_GID=1000 \ 'trueosiris/vrising' ``` @@ -104,7 +114,7 @@ docker run -d --name='vrising' \ See the example docker-compose.yml in this repository. Do not put any of your env variables in the "environment:" section in quotes. -**IMPORTANT**: The compose file will create the path you define in `source` if it does not exist. Ensure you're either running with UID/GID 1000 (the steam user in the container) or change owners of these folders accordingly. Otherwise you will get the following error: +**IMPORTANT**: The compose file will create the path you define in `source` if it does not exist. Ensure you're either running with UID/GID 1000 (the steam user in the container), change owners of these folders accordingly, or setup the `STEAM_USER_UID` and `STEAM_USER_GID` arguments correctly. Otherwise you will get the following error: ``` mkdir: cannot create directory '/home/steam/vrising/persistentdata/Settings': Permission denied From 928f1ac7d88ccb95d9232a3dbb09d99fc68e8db6 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Fri, 24 May 2024 10:21:57 -0400 Subject: [PATCH 12/25] Update docker-compose.yml Remove context as it defaults to . anyway. Add image to example. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index f5e33dc..70bac10 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ services: vrising: + image: trueosiris/vrising build: - context: . args: STEAM_USER_UID: 1006 STEAM_USER_GID: 1006 From a0de0bba34f28f6ddf745440b9f7681ace8a0949 Mon Sep 17 00:00:00 2001 From: panromir Date: Fri, 24 May 2024 20:42:43 +0200 Subject: [PATCH 13/25] Update Dockerfile Fix ARGs, reduce layers --- Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75d9c81..2eb7e4e 100755 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,8 @@ EXPOSE 9876 EXPOSE 9877/udp # Let the user change the user and group ID -ARG STEAM_USER_UID="1000" \ - STEAM_USER_GID="1000" +ARG STEAM_USER_UID="1000" +ARG STEAM_USER_GID="1000" ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ PERSISTENT_DATA_PATH="/home/steam/vrising/persistentdata" \ @@ -38,10 +38,7 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ OVERRIDE_CONFIG="true" \ TZ="Europe/Brussels" -# Set the user and group ID -RUN usermod -u $STEAM_USER_UID steam && groupmod -g $STEAM_USER_GID steam - -COPY --chown=steam:steam --chmod=744 files /home/steam/files/ +COPY --chown=${STEAM_USER_UID}:${STEAM_USER_GID} --chmod=744 files /home/steam/files/ COPY src/debian.sources /etc/apt/sources.list.d/debian.sources # hadolint ignore=DL3008 @@ -62,10 +59,12 @@ RUN DEBIAN_FRONTEND=noninteractive \ screen && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ + usermod -u "${STEAM_USER_UID}" steam && groupmod -g "${STEAM_USER_GID}" steam && \ chmod +x /home/steam/files/scripts/* && \ echo "00 00 * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh > /proc/1/fd/1 2>&1" >> /etc/cron.d/logrotation && \ crontab -u steam /etc/cron.d/logrotation && \ - chmod u+s /usr/sbin/cron + chmod u+s /usr/sbin/cron && \ + chown -R "${STEAM_USER_UID}:${STEAM_USER_GID}" /home/steam USER steam From 58345495c02973a7c86f8de23bbbb8312b7556fb Mon Sep 17 00:00:00 2001 From: panromir Date: Fri, 24 May 2024 20:47:21 +0200 Subject: [PATCH 14/25] Update README.md Improve build instructions for custom UID/GID --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a14fbf5..ea585c5 100755 --- a/README.md +++ b/README.md @@ -67,8 +67,10 @@ | LOGDAYS | 30 | Numer of days after which logs are deleted after their last modification | No | | OVERRIDE_CONFIG | true | Whether to generate new configs at the start of the container. | No | -## Argument variables +## Changing the running UID/GID +If you want to change the UID/GID of the User that's running the container for any reason, you can change the **Build ARGs**. The Image uses UID/GID 1000/1000 by default as defined in `cm2network/steamcmd:root-bookwork`. +Please note that changing this also means that you might have to adjust your volume permissions on the host when using docker. When using Kubernetes, you should verify the securityContext. | Variable | Default V(alue) | Description | Mandatory | | --------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------- | --------- | @@ -104,8 +106,6 @@ docker run -d --name='vrising' \ -v '/path/on/host/persistentdata':'/home/steam/vrising/persistentdata':'rw' \ -p 9876:9876/udp \ -p 9877:9877/udp \ ---build-arg STEAM_USER_UID=1000 \ ---build-arg STEAM_USER_GID=1000 \ 'trueosiris/vrising' ``` @@ -114,7 +114,7 @@ docker run -d --name='vrising' \ See the example docker-compose.yml in this repository. Do not put any of your env variables in the "environment:" section in quotes. -**IMPORTANT**: The compose file will create the path you define in `source` if it does not exist. Ensure you're either running with UID/GID 1000 (the steam user in the container), change owners of these folders accordingly, or setup the `STEAM_USER_UID` and `STEAM_USER_GID` arguments correctly. Otherwise you will get the following error: +**IMPORTANT**: The compose file will create the path you define in `source` if it does not exist. Ensure you're either running with UID/GID 1000 (the default steam user in the container), change owners of these folders accordingly, or setup the `STEAM_USER_UID` and `STEAM_USER_GID` arguments correctly and rebuild the image. Otherwise you will get the following error: ``` mkdir: cannot create directory '/home/steam/vrising/persistentdata/Settings': Permission denied From 5922ac18615d66b400b981b71b45763734436749 Mon Sep 17 00:00:00 2001 From: panromir Date: Fri, 24 May 2024 20:58:57 +0200 Subject: [PATCH 15/25] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea585c5..cc47285 100755 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ ## Changing the running UID/GID -If you want to change the UID/GID of the User that's running the container for any reason, you can change the **Build ARGs**. The Image uses UID/GID 1000/1000 by default as defined in `cm2network/steamcmd:root-bookwork`. +If you want to change the UID/GID of the User that's running the container for any reason, you can change the **Build ARGs**. The Image uses UID/GID 1000/1000 by default as defined in `cm2network/steamcmd:root-bookworm`. Please note that changing this also means that you might have to adjust your volume permissions on the host when using docker. When using Kubernetes, you should verify the securityContext. | Variable | Default V(alue) | Description | Mandatory | From a5ce0a2829fffc3c57f6f8714332ad12ee96d94a Mon Sep 17 00:00:00 2001 From: panromir Date: Sat, 25 May 2024 11:05:20 +0200 Subject: [PATCH 16/25] fix typos --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cc47285..d06bfff 100755 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ | PERSISTENT_DATA_PATH | /home/steam/vrising/persistentdata | Path inside the container to save world/configs/logs/etc. to | No | | HOST_SETTINGS_NAME | My Docker V-Rising Server | The name of your server as visible in the server list | No | | HOST_SETTINGS_DESCRIPTION | V Rising Server hosted by Docker | Description of your server | No | -| HOST_SETTINGS_PASSWORD | "" | Optional Server password | No | +| HOST_SETTINGS_PASSWORD | "" | Optional server password | No | | HOST_SETTINGS_MAX_CONNECTED_USERS | 10 | Maximum connected users | No | | HOST_SETTINGS_MAX_CONNECTED_ADMINS| 4 | Maximum connected admins | No | -| HOST_SETTINGS_SERVER_ADMIN_LIST | "" | Comma separated list of Admin Steam IDs (e.g. "123456789,0987654321") | No | +| HOST_SETTINGS_SERVER_ADMIN_LIST | "" | Comma separated list of Admin Steam ID64s (e.g. "123456789,0987654321") | No | | HOST_SETTINGS_SERVER_FPS | 30 | Server FPS | No | | HOST_SETTINGS_RCON_ENABLE | "false" | Whether to enable RCON | No | | HOST_SETTINGS_RCON_PASSWORD | "Ch8ng3m3Pl3@s3!" | RCON Password [Requires: HOST_SETTINGS_RCON_ENABLE=true] | No | @@ -56,15 +56,15 @@ | HOST_SETTINGS_AUTOSAVE_INTERVAL | 120 | Interval in seconds for the server to autosave | No | | HOST_SETTINGS_LISTEN_ON_STEAM | "true" | Whether to listen on steam | No | | HOST_SETTINGS_LISTEN_ON_EOS | "true" | Whether to listen on EOS | No | -| GAME_SETTINGS_PRESET | "StandardPvP" | Game Settings Preset to start the server with | No | +| GAME_SETTINGS_PRESET | "StandardPvP" | Game Settings preset to start the server with | No | | GAME_SETTINGS_DIFFICULTY | "Normal" | Server default difficulty setting | No | | LIST_ON_MASTER_SERVER | "true" | Whether to list the Server on Master Servers | No | | SERVER_IP | "127.0.0.1" | Public facing Server IP - **You might have to experiment with this** | Maybe | | SAVE_NAME | "default_world" | The name of your map | No | -| GAME_PORT | "9876" | UDP Port for Game connections | No | +| GAME_PORT | "9876" | UDP Port for game connections | No | | QUERY_PORT | "9877" | UDP Port to query the server on | No | | DEBUG_ENV | "true" | Return all variables to the stdout on container start | No | -| LOGDAYS | 30 | Numer of days after which logs are deleted after their last modification | No | +| LOGDAYS | 30 | Number of days after which logs are deleted after their last modification | No | | OVERRIDE_CONFIG | true | Whether to generate new configs at the start of the container. | No | ## Changing the running UID/GID From 05ee8679e17f879be81133e962054770208e02c8 Mon Sep 17 00:00:00 2001 From: panromir Date: Mon, 27 May 2024 22:01:13 +0200 Subject: [PATCH 17/25] Always write current log path --- files/scripts/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/scripts/entrypoint.sh b/files/scripts/entrypoint.sh index 9b36c4e..888f2e8 100755 --- a/files/scripts/entrypoint.sh +++ b/files/scripts/entrypoint.sh @@ -114,6 +114,8 @@ if ! [ -f "$PERSISTENT_DATA_PATH/$logfile" ]; then touch "$PERSISTENT_DATA_PATH"/"$logfile" echo "$PERSISTENT_DATA_PATH/$logfile" > /home/steam/currentlog_path.txt fi +echo "$PERSISTENT_DATA_PATH/$logfile" > /home/steam/currentlog_path.txt + cd "$SERVER_DATA_PATH" From 38fb6eda8dde94599f237eaee0541f55f23701d8 Mon Sep 17 00:00:00 2001 From: Panromir Date: Tue, 28 May 2024 16:30:23 +0200 Subject: [PATCH 18/25] add supervisord --- Dockerfile | 13 ++++++--- docker-compose.yml | 4 +-- files/configs/crontab | 1 + files/configs/supervisord.conf | 32 ++++++++++++++++++++++ files/scripts/cleanlogs.sh.template | 5 ++-- files/scripts/entrypoint.sh | 42 +++-------------------------- files/scripts/healthcheck.sh | 2 +- 7 files changed, 53 insertions(+), 46 deletions(-) mode change 100755 => 100644 docker-compose.yml create mode 100644 files/configs/crontab create mode 100644 files/configs/supervisord.conf diff --git a/Dockerfile b/Dockerfile index 2eb7e4e..a3cadc2 100755 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,9 @@ EXPOSE 9877/udp # Let the user change the user and group ID ARG STEAM_USER_UID="1000" ARG STEAM_USER_GID="1000" +ARG SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64 +ARG SUPERCRONIC=supercronic-linux-amd64 +ARG SUPERCRONIC_SHA1SUM=cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ PERSISTENT_DATA_PATH="/home/steam/vrising/persistentdata" \ @@ -41,11 +44,13 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ COPY --chown=${STEAM_USER_UID}:${STEAM_USER_GID} --chmod=744 files /home/steam/files/ COPY src/debian.sources /etc/apt/sources.list.d/debian.sources +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # hadolint ignore=DL3008 RUN DEBIAN_FRONTEND=noninteractive \ dpkg --add-architecture i386 && \ apt-get update && \ apt-get install -y --no-install-recommends \ + supervisor \ cron \ gettext-base \ procps \ @@ -61,9 +66,11 @@ RUN DEBIAN_FRONTEND=noninteractive \ rm -rf /var/lib/apt/lists/* && \ usermod -u "${STEAM_USER_UID}" steam && groupmod -g "${STEAM_USER_GID}" steam && \ chmod +x /home/steam/files/scripts/* && \ - echo "00 00 * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh > /proc/1/fd/1 2>&1" >> /etc/cron.d/logrotation && \ - crontab -u steam /etc/cron.d/logrotation && \ - chmod u+s /usr/sbin/cron && \ + curl -fsSLO "$SUPERCRONIC_URL" && \ + echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - && \ + chmod +x "$SUPERCRONIC" && \ + mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" && \ + ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic && \ chown -R "${STEAM_USER_UID}:${STEAM_USER_GID}" /home/steam USER steam diff --git a/docker-compose.yml b/docker-compose.yml old mode 100755 new mode 100644 index 70bac10..98e9900 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,8 @@ services: image: trueosiris/vrising build: args: - STEAM_USER_UID: 1006 - STEAM_USER_GID: 1006 + STEAM_USER_UID: 1000 + STEAM_USER_GID: 1000 environment: - HOST_SETTINGS_NAME=My Docker-Compose V-Rising Server diff --git a/files/configs/crontab b/files/configs/crontab new file mode 100644 index 0000000..700abd0 --- /dev/null +++ b/files/configs/crontab @@ -0,0 +1 @@ +00 00 * * * /bin/bash -c /home/steam/files/scripts/cleanlogs.sh \ No newline at end of file diff --git a/files/configs/supervisord.conf b/files/configs/supervisord.conf new file mode 100644 index 0000000..f69b91a --- /dev/null +++ b/files/configs/supervisord.conf @@ -0,0 +1,32 @@ +[supervisord] +logfile=%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s +nodaemon=true +logfile_maxbytes = 0 + +[program:supercronic] +command=/usr/local/bin/supercronic /home/steam/files/configs/crontab +autorestart=true +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + +[program:vrisingserver] +command=xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine %(ENV_SERVER_DATA_PATH)s/VRisingServer.exe -persistentDataPath %(ENV_PERSISTENT_DATA_PATH)s -serverName %(ENV_HOST_SETTINGS_NAME)s -saveName %(ENV_SAVE_NAME)s -logFile %(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s %(ENV_GAME_PORT)s %(ENV_QUERY_PORT)s 2>&1 +autorestart=false +numprocs=1 +startsecs=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + +[program:tailtostdout] +command=tail -f %(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s +autorestart=true +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 + +[eventlistener:processes] +command=bash -c "echo READY && read line && kill -SIGQUIT $PPID" +events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL \ No newline at end of file diff --git a/files/scripts/cleanlogs.sh.template b/files/scripts/cleanlogs.sh.template index da34f92..5849fb3 100644 --- a/files/scripts/cleanlogs.sh.template +++ b/files/scripts/cleanlogs.sh.template @@ -1,6 +1,7 @@ #!/bin/bash echo "$(date) === Rotating logs" -mv "$(cat /home/steam/currentlog_path.txt)" "$PERSISTENT_DATA_PATH/$(date +%d-%m-%y)-VRisingServer.log" +cp "$(cat /home/steam/currentlog_path.txt)" "$PERSISTENT_DATA_PATH/$(date +%d-%m-%y)-VRisingServer.log" +truncate -s 0 "$(cat /home/steam/currentlog_path.txt)" echo "$(date) === Cleaning up logs older than ${LOGDAYS} days" find "${PERSISTENT_DATA_PATH}" -name "*.log" -type f -mtime +"${LOGDAYS}" -exec rm {} \; -echo "$(date) === Cleaned up Logfiles" | tee -a "$(cat /home/steam/currentlog_path.txt)" \ No newline at end of file +echo "$(date) === Cleaned up Logfiles" | tee -a "$(cat /home/steam/currentlog_path.txt)" diff --git a/files/scripts/entrypoint.sh b/files/scripts/entrypoint.sh index 888f2e8..a6a3ef0 100755 --- a/files/scripts/entrypoint.sh +++ b/files/scripts/entrypoint.sh @@ -19,27 +19,6 @@ if [[ "$DEBUG_ENV" == "true" ]]; then env fi -term_handler() { - echo " " - echo " ================================================================ " - echo " Shutting Down Server due to Termination Signal " - echo " ================================================================ " - echo " " - - if ! ps -q "$(cat /home/steam/server.pid)" -o state --no-headers | grep -q -v "D|R|S"; then - echo "Could not find VRisingServer.exe pid. Assuming server is dead..." - else - echo "Shutting server down gracefully..." - kill -n 15 "$(cat /home/steam/server.pid)" - wait "$(cat /home/steam/server.pid)" - fi - wineserver -k - sleep 1 - exit -} - -trap 'term_handler' SIGTERM SIGINT - echo " " echo " ================================================================ " echo " Creating folders and installing Gameserver " @@ -94,7 +73,7 @@ fi echo " " echo " ================================================================ " -echo " Creating Cron Files " +echo " Creating Cron Scripts " echo " ================================================================ " echo " " @@ -108,7 +87,7 @@ echo " Creating Log File " echo " ================================================================ " echo " " -logfile="VRisingServer.log" +export logfile="VRisingServer.log" if ! [ -f "$PERSISTENT_DATA_PATH/$logfile" ]; then echo "Creating $PERSISTENT_DATA_PATH/$logfile" touch "$PERSISTENT_DATA_PATH"/"$logfile" @@ -119,24 +98,11 @@ echo "$PERSISTENT_DATA_PATH/$logfile" > /home/steam/currentlog_path.txt cd "$SERVER_DATA_PATH" + echo " " echo " ================================================================ " echo " Starting Server via Wine " echo " ================================================================ " echo " " -v() { - xvfb-run \ - --auto-servernum \ - --server-args='-screen 0 640x480x24:32' \ - wine "$SERVER_DATA_PATH"/VRisingServer.exe -persistentDataPath "$PERSISTENT_DATA_PATH" -serverName "$HOST_SETTINGS_NAME" -saveName "$SAVE_NAME" -logFile "$PERSISTENT_DATA_PATH"/"$logfile" "$GAME_PORT" "$QUERY_PORT" 2>&1 & -} -v -# Gets the PID of the last command -ServerPID=$! -echo "Server PID is $ServerPID" -echo "$ServerPID" > /home/steam/server.pid - -# Tail log file and waits for Server PID to exit -/usr/bin/tail -n 0 -f "$PERSISTENT_DATA_PATH"/"$logfile" & -wait $ServerPID +/usr/bin/supervisord -c /home/steam/files/configs/supervisord.conf diff --git a/files/scripts/healthcheck.sh b/files/scripts/healthcheck.sh index 438bc6b..03e0edf 100755 --- a/files/scripts/healthcheck.sh +++ b/files/scripts/healthcheck.sh @@ -1,4 +1,4 @@ #!/bin/bash set -eu -ps -q "$(cat /home/steam/server.pid)" -o state --no-headers | grep -q -v "D|R|S" \ No newline at end of file +pgrep -a "xvfb-run" -r "D|R|S" \ No newline at end of file From cede69c707e96ef17c94314f6467f5418c312859 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Wed, 29 May 2024 12:38:31 -0400 Subject: [PATCH 19/25] Update supervisord.conf Account for spaces --- files/configs/supervisord.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/configs/supervisord.conf b/files/configs/supervisord.conf index f69b91a..cf554bb 100644 --- a/files/configs/supervisord.conf +++ b/files/configs/supervisord.conf @@ -12,7 +12,7 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 [program:vrisingserver] -command=xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine %(ENV_SERVER_DATA_PATH)s/VRisingServer.exe -persistentDataPath %(ENV_PERSISTENT_DATA_PATH)s -serverName %(ENV_HOST_SETTINGS_NAME)s -saveName %(ENV_SAVE_NAME)s -logFile %(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s %(ENV_GAME_PORT)s %(ENV_QUERY_PORT)s 2>&1 +command=xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine "%(ENV_SERVER_DATA_PATH)s/VRisingServer.exe" -persistentDataPath "%(ENV_PERSISTENT_DATA_PATH)s" -serverName "%(ENV_HOST_SETTINGS_NAME)s" -saveName "%(ENV_SAVE_NAME)s" -logFile "%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" %(ENV_GAME_PORT)s %(ENV_QUERY_PORT)s 2>&1 autorestart=false numprocs=1 startsecs=0 @@ -29,4 +29,4 @@ stdout_logfile_maxbytes=0 [eventlistener:processes] command=bash -c "echo READY && read line && kill -SIGQUIT $PPID" -events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL \ No newline at end of file +events=PROCESS_STATE_STOPPED,PROCESS_STATE_EXITED,PROCESS_STATE_FATAL From cdc084037df1ecc66f8fbf2e07e50e07a4575129 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Wed, 29 May 2024 12:39:04 -0400 Subject: [PATCH 20/25] Update supervisord.conf Account for spaces --- files/configs/supervisord.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/configs/supervisord.conf b/files/configs/supervisord.conf index cf554bb..8195ae8 100644 --- a/files/configs/supervisord.conf +++ b/files/configs/supervisord.conf @@ -1,5 +1,5 @@ [supervisord] -logfile=%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s +logfile="%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" nodaemon=true logfile_maxbytes = 0 @@ -22,7 +22,7 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 [program:tailtostdout] -command=tail -f %(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s +command=tail -f "%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 From a94b907b6e110c615b194370fc1b38b9c9ba0862 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Wed, 29 May 2024 12:49:27 -0400 Subject: [PATCH 21/25] Update Dockerfile --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a3cadc2..c7c8a71 100755 --- a/Dockerfile +++ b/Dockerfile @@ -29,16 +29,16 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ HOST_SETTINGS_AUTOSAVE_INTERVAL="120" \ HOST_SETTINGS_LISTEN_ON_STEAM="true" \ HOST_SETTINGS_LISTEN_ON_EOS="true" \ - GAME_SETTINGS_PRESET="StandardPvP" \ + GAME_SETTINGS_PRESET="" \ GAME_SETTINGS_DIFFICULTY="Normal" \ LIST_ON_MASTER_SERVER="true" \ SERVER_IP="127.0.0.1" \ - SAVE_NAME="default_world" \ + SAVE_NAME="world1" \ GAME_PORT="9876" \ QUERY_PORT="9877" \ DEBUG_ENV="true" \ LOGDAYS="30" \ - OVERRIDE_CONFIG="true" \ + OVERRIDE_CONFIG="false" \ TZ="Europe/Brussels" COPY --chown=${STEAM_USER_UID}:${STEAM_USER_GID} --chmod=744 files /home/steam/files/ From 5475249c14db574dbe5912e3947965d3dab14c07 Mon Sep 17 00:00:00 2001 From: kevinf100 <12779728+kevinf100@users.noreply.github.com> Date: Wed, 29 May 2024 12:56:54 -0400 Subject: [PATCH 22/25] Update supervisord.conf This already accounts for spacing --- files/configs/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/configs/supervisord.conf b/files/configs/supervisord.conf index 8195ae8..1527bbf 100644 --- a/files/configs/supervisord.conf +++ b/files/configs/supervisord.conf @@ -1,5 +1,5 @@ [supervisord] -logfile="%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" +logfile=%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s nodaemon=true logfile_maxbytes = 0 From 913a6db136e85fed8bf85ed2879326c4345211b2 Mon Sep 17 00:00:00 2001 From: panromir Date: Fri, 31 May 2024 21:49:54 +0200 Subject: [PATCH 23/25] remove unnecessary startup overrides -serverName and -saveName override config parameters, which isn't necessary, since the server config is managed anyway, so keeping this in one place is preferable. --- files/configs/supervisord.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/configs/supervisord.conf b/files/configs/supervisord.conf index 1527bbf..f64158f 100644 --- a/files/configs/supervisord.conf +++ b/files/configs/supervisord.conf @@ -12,7 +12,7 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 [program:vrisingserver] -command=xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine "%(ENV_SERVER_DATA_PATH)s/VRisingServer.exe" -persistentDataPath "%(ENV_PERSISTENT_DATA_PATH)s" -serverName "%(ENV_HOST_SETTINGS_NAME)s" -saveName "%(ENV_SAVE_NAME)s" -logFile "%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" %(ENV_GAME_PORT)s %(ENV_QUERY_PORT)s 2>&1 +command=xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' wine "%(ENV_SERVER_DATA_PATH)s/VRisingServer.exe" -persistentDataPath "%(ENV_PERSISTENT_DATA_PATH)s" -logFile "%(ENV_PERSISTENT_DATA_PATH)s/%(ENV_logfile)s" %(ENV_GAME_PORT)s %(ENV_QUERY_PORT)s 2>&1 autorestart=false numprocs=1 startsecs=0 From 24d85ad3a563f8f546a314d54d27671372d0b740 Mon Sep 17 00:00:00 2001 From: panromir Date: Sat, 1 Jun 2024 18:55:19 +0200 Subject: [PATCH 24/25] re-add standardpvp and override_config Keep this as it was originally and change the default save name to "world1" as is default. The README will be improved by making very clear, that OVERRIDE_CONFIG=true always purges all manual changes to configs on restart. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7c8a71..ca901c7 100755 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ HOST_SETTINGS_AUTOSAVE_INTERVAL="120" \ HOST_SETTINGS_LISTEN_ON_STEAM="true" \ HOST_SETTINGS_LISTEN_ON_EOS="true" \ - GAME_SETTINGS_PRESET="" \ + GAME_SETTINGS_PRESET="StandardPvP" \ GAME_SETTINGS_DIFFICULTY="Normal" \ LIST_ON_MASTER_SERVER="true" \ SERVER_IP="127.0.0.1" \ @@ -38,7 +38,7 @@ ENV SERVER_DATA_PATH="/home/steam/vrising/server" \ QUERY_PORT="9877" \ DEBUG_ENV="true" \ LOGDAYS="30" \ - OVERRIDE_CONFIG="false" \ + OVERRIDE_CONFIG="true" \ TZ="Europe/Brussels" COPY --chown=${STEAM_USER_UID}:${STEAM_USER_GID} --chmod=744 files /home/steam/files/ From 43876eab3e42a5e350511137e8ef431ab727c043 Mon Sep 17 00:00:00 2001 From: panromir Date: Sat, 1 Jun 2024 19:13:33 +0200 Subject: [PATCH 25/25] Expand on OVERRIDE_CONFIG param --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d06bfff..d437cf9 100755 --- a/README.md +++ b/README.md @@ -67,6 +67,13 @@ | LOGDAYS | 30 | Number of days after which logs are deleted after their last modification | No | | OVERRIDE_CONFIG | true | Whether to generate new configs at the start of the container. | No | + +## A note on `OVERRIDE_CONFIG` +By default, this parameter is set to true. Any configuration should be done using the Environment Variables, changing your configs by going into your container or editing the files on your mounted file system path will be **overwritten every time the container starts**. +If you set this to `false`, the following will happen: +- When configs already exist, they are **not** overwritten +- When no configs exist, a default config is written **once** with any Environment variables you set, otherwise the defaults are used. + ## Changing the running UID/GID If you want to change the UID/GID of the User that's running the container for any reason, you can change the **Build ARGs**. The Image uses UID/GID 1000/1000 by default as defined in `cm2network/steamcmd:root-bookworm`.