Skip to content

Commit

Permalink
feat: add command to load specific prospect
Browse files Browse the repository at this point in the history
docs: added missing update_cron environment to list
  • Loading branch information
cp-fabian-pittroff committed Jan 17, 2024
1 parent 25af5a8 commit 95f09a0
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 26 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
55 changes: 30 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 <ProspectName>
```

## Known Issues

Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions scripts/icarus-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ bootstrapWine() {
debug "wineboot"
wineboot --init >/dev/null 2>&1

info "wine version: $(wine64 --version)"

info "wine bootstrap finished"
}

Expand Down Expand Up @@ -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
38 changes: 38 additions & 0 deletions scripts/icarus-commands
Original file line number Diff line number Diff line change
@@ -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 <prospectName>"
exit 1
esac
}

main $@

0 comments on commit 95f09a0

Please sign in to comment.