Skip to content

Commit

Permalink
Merge pull request #10 from Johnny-Knighten/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
Johnny-Knighten authored Nov 20, 2023
2 parents c0dfa89 + 7c92c22 commit 3d01a93
Show file tree
Hide file tree
Showing 10 changed files with 337 additions and 113 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [1.0.2-next.1](https://github.com/Johnny-Knighten/ark-sa-server/compare/1.0.1...1.0.2-next.1) (2023-11-20)


### Bug Fixes

* introduced GameUserSettings templating system ([4912e9c](https://github.com/Johnny-Knighten/ark-sa-server/commit/4912e9c0022d63ca8bd23592f3c598b4be1a08db))
* **config:** introduced GameUserSettings.ini template ([40e9f3b](https://github.com/Johnny-Knighten/ark-sa-server/commit/40e9f3bde4e758d5fd177a7426780930a66d985d))

## [1.0.1](https://github.com/Johnny-Knighten/ark-sa-server/compare/1.0.0...1.0.1) (2023-11-18)


Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ ENV DEBUG=false \
ARK_EPIC_PUBLIC_IP= \
ARK_MULTI_HOME= \
ARK_ENABLE_PVE=False\
TEST_DRY_RUN=False
TEST_DRY_RUN=False \
ARK_REBUILD_CONFIG=False

RUN set -x && \
apt-get update && \
Expand Down
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ The table below shows all the available environment variables and their default
| `ARK_SERVER_ADMIN_PASSWORD `| Password for the server admin. Also used for RCON access. **Do not put spaces in your password.** | `adminpassword` |
| `ARK_GAME_PORT` | Primary game port. This port +1 will also be used. | `7777` |
| `ARK_QUERY_PORT` | Steam query port. | `27015` |
| `ARK_RCON_ENABLED` | Enable RCON on the server. | `True` |
| `ARK_ENABLE_RCON` | Enable RCON on the server. | `True` |
| `ARK_RCON_PORT`| RCON port for the server. | `27020` |
| `ARK_MAP` | Map launched on the server. | `TheIsland_WP` |
| `ARK_MAX_PLAYERS`| Maximum number of players allowed on the server. | `70` |
Expand All @@ -175,10 +175,29 @@ The table below shows all the available environment variables and their default
| `ARK_MOD_LIST` | Comma separated list of mod ids to install. Needs to be wrapped in quotes and whitespace can appear before or after commas. | EMPTY |
| `ARK_EPIC_PUBLIC_IP` | Public IP address of the server, used by Epic game clients. | EMPTY |
| `ARK_MULTI_HOME_SERVER` | Provide your public IP address when hosting multiple servers on the same machine. | EMPTY |
| `ARK_REBUILD_CONFIG` | Force rebuild of GameUserSettings.ini on container start. Mainly used to force updated variables to appear in GameUserSettings.ini. *Note - this overwrites your current GameUserSettings.ini, so make a copy if needed.*| `False` |

### Config Files

Configuration files are primarily used to adjust settings such as such as XP/Gathering/Taming rates and player stats. The config files are located in the `/ark-server/ShooterGame/Saved/Config/WindowsServer` directory inside the container and the primary file you will modify is `GameUserSettings.ini`. The config files are generated on container start, so if you need to make changes to them you will need to restart the container. If you delete the config file a new one will be generated on server start using default values.
Configuration files are primarily used to adjust settings such as such as XP/Gathering/Taming rates and player stats. The config files are located in the `/ark-server/ShooterGame/Saved/Config/WindowsServer` directory inside the container and the primary file you will modify is `GameUserSettings.ini`.

#### New GameUserSettings.ini Template Process (11/19/2023)

As of 11/19/2023 the way `GameUserSettings.ini` is generated in this container has changed. Somewhere around server version 26.38 of the dedicated server, a number of server launch command args stopped working. To work around this, the only option was to ensure those cmd args appeared in `GameUserSettings.ini`. A long term goal of this project is to make `GameUserSettings.ini` 100% configurable via Environment Variables, but since this issue impacted the current use of the image, a quick fix was needed. The fix is in the form of a simple `GameUserSettings.ini` template script that injects the cmd args environment variables into a `GameUserSettings.ini` template. See [bin/ark-sa/configs](bin/ark-sa/configs) for more implementation details.

The only environment variables impacted by this change are: `ARK_SERVER_NAME`, `ARK_ENABLE_RCON`, `ARK_RCON_PORT`, `ARK_MAX_PLAYERS`, `ARK_SERVER_PASSWORD`, `ARK_SERVER_ADMIN_PASSWORD`, and `ARK_ENABLE_PVE`.

If you make any changes to the above environment variables, you will need to restart the container with `ARK_REBUILD_CONFIG=True` to force the template script to run again. This will overwrite your GameUserSettings.ini and make a new one with the values in [`GameUserSettings.template.ini`](ark-sa/config-templating/GameUserSettings.template.ini) and inject it with your new environment variable values. Make a copy of your existing config if needed and update the newly generated `GameUserSettings.ini` with your old values. Another alternative is to manually update the `GameUserSettings.ini` file to match your new environment variable values and then restart the container.

Remember to set `ARK_REBUILD_CONFIG=False` (its default value) unless you want `GameUserSettings.ini` to be rewritten with the template every container launch (not recommended). This will make `GameUserSettings.ini` always match the values in [`GameUserSettings.template.ini`](ark-sa/config-templating/GameUserSettings.template.ini).

##### New Users

For new users of this image, there is nothing you need to do. The new template script will execute in your first launch of your server.

##### Existing users

Make a copy of your existing `GameUserSettings.ini` then set `ARK_REBUILD_CONFIG=True` and restart your container. This will overwrite your current `GameUserSettings.ini` with the values in [`GameUserSettings.template.ini`](ark-sa/config-templating/GameUserSettings.template.ini). Then copy any of your old settings into the new `GameUserSettings.ini` and restart the container with `ARK_REBUILD_CONFIG=False`.

#### Using Bind Mounts

Expand Down
100 changes: 100 additions & 0 deletions bin/ark-sa/config-templating/GameUserSettings.template.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
[ServerSettings]
DifficultyOffset=0.20
PlayerDamageMultiplier=1.0
StructureResistanceMultiplier=1.0
XPMultiplier=1.0
TamingSpeedMultiplier=1.0
HarvestAmountMultiplier=1.0
PlayerCharacterWaterDrainMultiplier=1.0
PlayerCharacterFoodDrainMultiplier=1.0
DinoCharacterFoodDrainMultiplier=1.0
PlayerCharacterStaminaDrainMultiplier=1.0
DinoCharacterStaminaDrainMultiplier=1.0
PlayerCharacterHealthRecoveryMultiplier=1.0
DinoCharacterHealthRecoveryMultiplier=1.0
HarvestHealthMultiplier=1.0
StartTimeOverride=False
StartTimeHour=10.0
ListenServerTetherDistanceMultiplier=1.0
RaidDinoCharacterFoodDrainMultiplier=1.0
StructurePreventResourceRadiusMultiplier=1.0
PvEDinoDecayPeriodMultiplier=1.0
AllowRaidDinoFeeding=False
PerPlatformMaxStructuresMultiplier=1
GlobalVoiceChat=False
ProximityChat=False
NoTributeDownloads=False
AllowThirdPersonPlayer=True
AlwaysNotifyPlayerLeft=False
DontAlwaysNotifyPlayerJoined=False
ServerHardcore=False
ServerPVE=<<ARK_ENABLE_PVE>>
ServerCrosshair=True
ServerForceNoHUD=False
ShowMapPlayerLocation=True
EnablePvPGamma=True
DisableStructureDecayPvE=False
AllowFlyerCarryPvE=False
OnlyAllowSpecifiedEngrams=False
AllowHideDamageSourceFromLogs=True
RandomSupplyCratePoints=False
DisableWeatherFog=False
PreventDownloadSurvivors=False
PreventDownloadItems=False
PreventDownloadDinos=False
DisablePvEGamma=False
DisableDinoDecayPvE=False
AdminLogging=False
AllowCaveBuildingPvE=False
ForceAllowCaveFlyers=False
PreventOfflinePvP=False
PvPDinoDecay=False
OverrideStructurePlatformPrevention=False
AllowAnyoneBabyImprintCuddle=False
DisableImprintDinoBuff=False
ShowFloatingDamageText=False
PreventDiseases=False
NonPermanentDiseases=False
EnableExtraStructurePreventionVolumes=False
PreventTribeAlliances=False
bAllowSpeedLeveling=False
bAllowFlyerSpeedLeveling=False
PreventOfflinePvPInterval=-0
CraftingSkillBonusMultiplier=1
SupplyCrateLootQualityMultiplier=1
ActiveEvent=
OverrideStartTime=False
ActiveMapMod=0
RCONEnabled=<<ARK_ENABLE_RCON>>
RCONPort=<<ARK_RCON_PORT>>
TheMaxStructuresInRange=10500
OxygenSwimSpeedStatMultiplier=1
TribeNameChangeCooldown=15
PlatformSaddleBuildAreaBoundsMultiplier=1
AlwaysAllowStructurePickup=True
StructurePickupTimeAfterPlacement=30
StructurePickupHoldDuration=0.5
KickIdlePlayersPeriod=3600
AutoSavePeriodMinutes=15
MaxTamedDinos=5000
ItemStackSizeMultiplier=1
RCONServerGameLogBuffer=600
ImplantSuicideCD=28800
AllowHitMarkers=True
ServerPassword=<<ARK_SERVER_PASSWORD>>
ServerAdminPassword=<<ARK_SERVER_ADMIN_PASSWORD>>
DayCycleSpeedScale=1.0
DayTimeSpeedScale=1.0
NightTimeSpeedScale=1.0
DinoDamageMultiplier=1.0
StructureDamageMultiplier=1.0
PlayerResistanceMultiplier=1.0
DinoResistanceMultiplier=1.0
PvEStructureDecayPeriodMultiplier=1.0

[SessionSettings]
SessionName=<<ARK_SERVER_NAME>>

[/Script/Engine.GameSession]
MaxPlayers=<<ARK_MAX_PLAYERS>>

34 changes: 34 additions & 0 deletions bin/ark-sa/config-templating/bootstrap-configs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

set -e

[[ -z "${DEBUG}" ]] || [[ "${DEBUG,,}" = "false" ]] || [[ "${DEBUG,,}" = "0" ]] || set -x

config_template="${CONTAINER_BIN_DIR}/ark-sa/config-templating/GameUserSettings.template.ini"
config_file="${ARK_SERVER_DIR}/server/ShooterGame/Saved/Config/WindowsServer/GameUserSettings.ini"

if [[ ! -f "$config_file" ]] || [[ "$ARK_REBUILD_CONFIG" = "True" ]]; then

if [ "$ARK_REBUILD_CONFIG" = "True" ]; then
echo "ARK_REBUILD_CONFIG is set to True, rebuilding existing GameUserSettings.ini..."
else
echo "GameUserSettings.ini not found, creating from template..."
fi

if [ -f "$config_template" ]; then
mkdir -p "${ARK_SERVER_DIR}/server/ShooterGame/Saved/Config/WindowsServer"
cp "$config_template" "$config_file"
sed -i "s/SessionName=<<ARK_SERVER_NAME>>/SessionName=$ARK_SERVER_NAME/" "$config_file"
sed -i "s/RCONEnabled=<<ARK_ENABLE_RCON>>/RCONEnabled=$ARK_ENABLE_RCON/" "$config_file"
sed -i "s/RCONPort=<<ARK_RCON_PORT>>/RCONPort=$ARK_RCON_PORT/" "$config_file"
sed -i "s/MaxPlayers=<<ARK_MAX_PLAYERS>>/MaxPlayers=$ARK_MAX_PLAYERS/" "$config_file"
sed -i "s/ServerPassword=<<ARK_SERVER_PASSWORD>>/ServerPassword=$ARK_SERVER_PASSWORD/" "$config_file"
sed -i "s/ServerAdminPassword=<<ARK_SERVER_ADMIN_PASSWORD>>/ServerAdminPassword=$ARK_SERVER_ADMIN_PASSWORD/" "$config_file"
sed -i "s/ServerPVE=<<ARK_ENABLE_PVE>>/ServerPVE=$ARK_ENABLE_PVE/" "$config_file"
else
echo "GameUserSettings template not found at $config_template"
exit 1
fi
else
echo "GameUserSettings.ini found, skipping creation from template..."
fi
9 changes: 9 additions & 0 deletions bin/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ handle_steam_cmd_install_error() {
exit 1
}

handle_ark_sa_config_bootstrap_error() {
echo "An error occurred in ark-sa/config-templating/bootstrap-configs.sh"
exit 1
}

handle_launch_ark_sa_error() {
echo "An error occurred in launch-ark-sa.sh"
exit 1
Expand All @@ -27,6 +32,10 @@ trap 'handle_steam_cmd_install_error' ERR
"$CONTAINER_BIN_DIR/steam-cmd-install.sh"
trap - ERR

trap 'handle_ark_sa_config_bootstrap_error' ERR
"$CONTAINER_BIN_DIR/ark-sa/config-templating/bootstrap-configs.sh"
trap - ERR

trap 'handle_launch_ark_sa_error' ERR
"$CONTAINER_BIN_DIR/launch-ark-sa.sh"
trap - ERR
14 changes: 0 additions & 14 deletions bin/launch-ark-sa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,13 @@ set -e
[[ -z "${DEBUG}" ]] || [[ "${DEBUG,,}" = "false" ]] || [[ "${DEBUG,,}" = "0" ]] || set -x

CMD_ARGS="$ARK_MAP?listen"
CMD_ARGS+="?SessionName=$ARK_SERVER_NAME"
CMD_ARGS+="?Port=$ARK_GAME_PORT"
CMD_ARGS+="?QueryPort=$ARK_QUERY_PORT"
CMD_ARGS+="?ServerPVE=$ARK_ENABLE_PVE"

if [[ "$ARK_ENABLE_RCON" = "True" ]]; then
CMD_ARGS+="?RCONEnabled=$ARK_ENABLE_RCON?RCONPort=$ARK_RCON_PORT"
else
CMD_ARGS+="?RCONEnabled=False"
fi

if [[ -n "$ARK_MULTI_HOME" ]]; then
CMD_ARGS+="?MultiHome=$ARK_MULTI_HOME"
fi

if [[ -n "$ARK_SERVER_PASSWORD" ]]; then
CMD_ARGS+="?ServerPassword=$ARK_SERVER_PASSWORD"
fi

CMD_ARGS+="?ServerAdminPassword=$ARK_SERVER_ADMIN_PASSWORD"

if [[ "$ARK_NO_BATTLEYE" = "True" ]]; then
BATTLE_EYE_FLAG="-NoBattlEye"
else
Expand Down
18 changes: 9 additions & 9 deletions deployment-examples/docker-compose/advanced-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ services:
environment:
- ARK_GAME_PORT=8888
- ARK_QUERY_PORT=27016
- ARK_MAX_PLAYERS=20
- ARK_SERVER_NAME="Containerized Ark Server"
- ARK_SERVER_PASSWORD=password2
- ARK_SERVER_ADMIN_PASSWORD=adminpassword2
- ARK_ENABLE_PVE=True
- STEAMCMD_SKIP_VALIDATION=True
- ARK_PREVENT_AUTO_UPDATE=True
- ARK_RCON_ENABLED=True
- ARK_MAX_PLAYERS=55
- ARK_SERVER_NAME="Containerized Server Test223"
- ARK_SERVER_PASSWORD=
- ARK_SERVER_ADMIN_PASSWORD=adminpassword25
- ARK_ENABLE_PVE=False
- STEAMCMD_SKIP_VALIDATION=False
- ARK_PREVENT_AUTO_UPDATE=False
- ARK_ENABLE_RCON=True
- ARK_RCON_PORT=27021
- ARK_MOD_LIST="927131, 893657"
- ARK_MULTI_HOME=0.0.0.0 # Make Your Public IP
- ARK_EPIC_PUBLIC_IP=0.0.0.0 # Make Your Public IP
- ARK_NO_BATTLEYE=False
- ARK_NO_BATTLEYE=True
volumes:
- 'ark-files:/ark-server'
ports:
Expand Down
4 changes: 3 additions & 1 deletion tests/docker_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ perform_test "Verify ark-sa-container/bin Content is Present" \
johnnyknighten/ark-sa-server:latest \
-c \"test -f /opt/ark-sa-container/bin/docker-entrypoint.sh && \
test -f /opt/ark-sa-container/bin/launch-ark-sa.sh && \
test -f /opt/ark-sa-container/bin/steam-cmd-install.sh\""
test -f /opt/ark-sa-container/bin/steam-cmd-install.sh && \
test -f /opt/ark-sa-container/bin/ark-sa/config-templating/bootstrap-configs.sh && \
test -f /opt/ark-sa-container/bin/ark-sa/config-templating/GameUserSettings.template.ini \""

log_failed_tests
Loading

0 comments on commit 3d01a93

Please sign in to comment.