stayintarkov / SIT.Docker

https://hub.docker.com/r/stayintarkov/stayintarkov
MIT License
23 stars 22 forks source link

Migrate bullet.sh to docker entrypoint to avoid setup re-running on boot #13

Closed SamuelMS closed 4 months ago

SamuelMS commented 4 months ago

Thanks for putting this Docker image together – was able to get it hosted on a cloud provider (for personal use) in pretty short order. I did have to make some changes to how the container spins itself up, though.

Motivation

In a stable cloud environment, we need to have the flexibility to take the server down for maintenance, take periodic backups, and switch around data volumes to test isolated mod setups. With the default behavior, bullet.sh runs as the docker CMD out of the box – and since it always copies over server files (including the "delete me" safety file), existing content would both get overwritten and the safety file would need to be removed again.

Proposal

  1. I propose switching from running bullet.sh in the CMD to a standard docker entrypoint, which lets us configure the container before it runs the AKI server through CMD. This way, we can easily run setup tasks only when necessary, and directly run Aki.Server.exe otherwise.
  2. I also propose inverting how the existing safety file works. Currently, a "delete me" file gets copied over on setup and needs to be removed before running the server. Instead, I'd suggest adding a version file that only gets added when the setup step is complete. For future updates (currently not implemented), we can check against the stored version and, if different from what's presently installed, log a warning and prompt the user to remove the version file if they'd like to update.

So in summary, if the version file is not detected when the entrypoint runs, it performs a one-time setup operation and generates this version file (with the tag of the docker image / SIT environment variable as its contents); and in future runs, will skip the setup step and directly run Aki.Server.exe instead.

I also added a .gitignore file so IDE and OS artifacts don't get pulled in by accident, but my default template is pretty verbose so I'm happy to remove some of the fluff if you prefer.

devbence commented 4 months ago

lgtm, 3 minor request:

SamuelMS commented 4 months ago

lgtm, 3 minor request:

  • please cleanup the gitignore file, that file itself is bigger than the complete SIT.Docker repo
  • add back the echo "Stay In Tarkov Docker" (preferrably shown on every run)
  • no need to touch delete_me, not used anymore

Done!