diff --git a/Dockerfile b/Dockerfile index 7ad2403..8d92822 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,5 +36,6 @@ RUN mkdir -p /usr/local/etc /var/log/supervisor /var/run/icarus /usr/local/etc/s COPY ./supervisord.conf /etc/supervisor/supervisord.conf COPY --chmod=755 ./scripts/* /usr/local/etc/icarus/ +WORKDIR /usr/local/etc/icarus CMD ["/usr/local/etc/icarus/bootstrap"] ENTRYPOINT [] diff --git a/README.md b/README.md index e2bf965..784dc05 100644 --- a/README.md +++ b/README.md @@ -13,31 +13,32 @@ startup, automatic updates and cleanup. ## Environment Variables -| Variable | Default | Description | WIP | -|----------------------------------|----------------------------------|---------------------------------------------------------------------------------|:---:| -| `SERVER_NAME` | `ICARUS Server` | The name of the server | | -| `SERVER_PASSWORD` | | The password for the server | | -| `SERVER_ADMIN_PASSWORD` | | The password for the admin login | | -| `SERVER_MAX_PLAYERS` | `8` | Max allowed players | | -| `SERVER_PORT` | `17777` | The game port for the server | | -| `SERVER_QUERYPORT` | `27015` | The steam query port for the server | | -| `SERVER_IP` | | Server IP for the server empty check (update cron) | | -| `SERVER_SHUTDOWN_IF_NOT_JOINED` | `300.000000` | Number of seconds until started prospect returns to lobby mode | | -| `SERVER_SHUTDOWN_IF_EMPTY` | `60.000000` | Number of seconds until server returns to lobby mode after last prospector left | | -| `SERVER_ALLOW_NON_ADMINS_LAUNCH` | `True` | Allows all prospectors to select prospect in lobby mode | | -| `SERVER_ALLOW_NON_ADMINS_DELETE` | `False` | Allows all prospectors to delete prospects in lobby mode | | -| `SERVER_RESUME_PROSPECT` | `True` | After a server restart, resume last prospect | | -| `GAME_BRANCH` | `public` | Steam branch of the ICARUS server | | -| `ASYNC_TASK_TIMEOUT` | `60` | Sets AsyncTaskTimeout in Engine.ini | | -| `PUID` | `4711` | The UID to run server as | | -| `PGID` | `4711` | The GID to run server as | | -| `CLEANUP_CRON` | | Cleanup old prospects cron (checks if all players left the prospect) | | -| `CLEANUP_DAYS` | `1` | Cleanup older prospects than x days (checks if all players left the prospect) | | -| `CLEANUP_DELETE_BACKUPS` | `false` | Remove backup files from pruned prospects | | -| `CLEANUP_PRUNE_FOLDER` | `pruned` | Folder for cleaned prospects (relative to Prospects folder) | | -| `CLEANUP_EXCLUDES` | | Exclude pattern (regex) for cleanup cron eg. world1\|world2 | | -| `STEAM_API_KEY` | | SteamApi key to authorize requests (needed for empty server check) | | -| `STEAMCMD_ARGS` | `--beta "$GAME_BRANCH" validate` | Additional steamcmd args for the updater | | +| Variable | Default | Description | WIP | +|----------------------------------|----------------------------------|---------------------------------------------------------------------------------------|:---:| +| `SERVER_NAME` | `ICARUS Server` | The name of the server | | +| `SERVER_PASSWORD` | | The password for the server | | +| `SERVER_ADMIN_PASSWORD` | | The password for the admin login | | +| `SERVER_MAX_PLAYERS` | `8` | Max allowed players | | +| `SERVER_PORT` | `17777` | The game port for the server | | +| `SERVER_QUERYPORT` | `27015` | The steam query port for the server | | +| `SERVER_IP` | | Server IP for the server empty check (update cron) | | +| `SERVER_SHUTDOWN_IF_NOT_JOINED` | `300.000000` | Number of seconds until started prospect returns to lobby mode | | +| `SERVER_SHUTDOWN_IF_EMPTY` | `60.000000` | Number of seconds until server returns to lobby mode after last prospector left | | +| `SERVER_ALLOW_NON_ADMINS_LAUNCH` | `True` | Allows all prospectors to select prospect in lobby mode | | +| `SERVER_ALLOW_NON_ADMINS_DELETE` | `False` | Allows all prospectors to delete prospects in lobby mode | | +| `SERVER_RESUME_PROSPECT` | `True` | After a server restart, resume last prospect | | +| `GAME_BRANCH` | `public` | Steam branch of the ICARUS server | | +| `ASYNC_TASK_TIMEOUT` | `60` | Sets AsyncTaskTimeout in Engine.ini | | +| `PUID` | `4711` | The UID to run server as | | +| `PGID` | `4711` | The GID to run server as | | +| `UPDATE_CRON` | | Update game server files cron (eg. `*/30 * * * *` check for updates every 30 minutes) | | +| `CLEANUP_CRON` | | Cleanup old prospects cron (checks if all players left the prospect) | | +| `CLEANUP_DAYS` | `1` | Cleanup older prospects than x days (checks if all players left the prospect) | | +| `CLEANUP_DELETE_BACKUPS` | `false` | Remove backup files from pruned prospects | | +| `CLEANUP_PRUNE_FOLDER` | `pruned` | Folder for cleaned prospects (relative to Prospects folder) | | +| `CLEANUP_EXCLUDES` | | Exclude pattern (regex) for cleanup cron eg. world1\|world2 | | +| `STEAM_API_KEY` | | SteamApi key to authorize requests (needed for empty server check) | | +| `STEAMCMD_ARGS` | `--beta "$GAME_BRANCH" validate` | Additional steamcmd args for the updater | | ⚠️: Work in Progress @@ -139,6 +140,10 @@ volumes: ```bash docker compose exec icarus supervisorctl start icarus-force-update ``` +* **Load Prospect (⚠️: Work in Progress):** + ```bash + docker compose exec icarus ./icarus-commands loadProspect + ``` ## Known Issues diff --git a/docker-compose.yml b/docker-compose.yml index 2d3c150..e9b83c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,12 @@ version: "3" services: icarus: - build: . + build: + context: . + dockerfile: Dockerfile + args: + WINE_BRANCH: staging + image: mornedhels/icarus-server:dev container_name: icarus hostname: icarus restart: unless-stopped diff --git a/scripts/icarus-bootstrap b/scripts/icarus-bootstrap index 6376491..feb056b 100644 --- a/scripts/icarus-bootstrap +++ b/scripts/icarus-bootstrap @@ -37,6 +37,8 @@ bootstrapWine() { debug "wineboot" wineboot --init >/dev/null 2>&1 + info "wine version: $(wine64 --version)" + info "wine bootstrap finished" } @@ -128,6 +130,8 @@ EOF if [[ -n "$SERVER_RESUME_PROSPECT" ]]; then sed -i "/ResumeProspect=/c\ResumeProspect=${SERVER_RESUME_PROSPECT}" ${config_path}/ServerSettings.ini fi + + sed -i "/LoadProspect=/c\LoadProspect=" ${config_path}/ServerSettings.ini } main diff --git a/scripts/icarus-commands b/scripts/icarus-commands new file mode 100755 index 0000000..aedcb3b --- /dev/null +++ b/scripts/icarus-commands @@ -0,0 +1,38 @@ +#!/bin/bash +. "$(dirname "$0")/common" +. "$(dirname "$0")/defaults" + +loadProspect() { + local prospectName=${@:2} + + if [[ -z "$prospectName" ]]; then + warn "No prospect name provided. Skip server restart." + return + fi + + if [[ ! -f "${data_path}/Saved/PlayerData/DedicatedServer/Prospects/${prospectName}.json" ]]; then + warn "Prospect ${prospectName} does not exist. Skip server restart." + return + fi + + info "Loading prospect $prospectName" + supervisorctl stop icarus-server + echo sed -i "/LoadProspect=/c\LoadProspect=${prospectName}" ${config_path}/ServerSettings.ini + sed -i "/LoadProspect=/c\LoadProspect=${prospectName}" ${config_path}/ServerSettings.ini + supervisorctl start icarus-server +} + +main() { + local command=$1 + + case $command in + loadProspect) + loadProspect $@ + ;; + *) + info "Usage: $0 loadProspect " + exit 1 + esac +} + +main $@