Problem
New Terraria player here.
There have been a couple of days over the past month where my friends and I have been faced with a pop-up saying our version wasn't in sync with our server after a Steam Terraria update.
I noticed a couple of things in this repo:
- There is a cron for building once a day
- There is a directory structure for version numbers
Both of these don't lend themselves to keeping up with the latest version as there is a manual process to change the URL in the server download ZIP and those delays can take a while to notice and remedy.
Solution
My proposed solution is to use the following endpoint to grab server version number and build a docker image as soon as a new version is detected.
Link:
https://www.terraria.org/api/get/dedicated-servers-names
Returns:
[
"terraria-server-1445.zip",
"terraria-server-1441-fixed.zip"
]
In bash, I wrote this to parse out the first element in that JSON list:
curl -s https://www.terraria.org/api/get/dedicated-servers-names | grep -o 'terraria-server-[^"]*' | head -1
Which returns:
I would suggest that there is a workflow with GitHub Actions where you can check that server endpoint more frequently and compare against your known version.
If the version is new, then automatically build and tag image with :latest
I added/changed this to your Dockerfile and it works in always sourcing the right version:
#...
# Download and install Vanilla Server
RUN curl -s https://www.terraria.org/api/get/dedicated-servers-names | grep -o 'terraria-server-[^"]*' | head -1 | tee latest_version.txt
RUN mkdir /tmp/terraria && \
cd /tmp/terraria && \
curl -sL https://www.terraria.org/api/download/pc-dedicated-server/$(cat latest.txt) --output terraria-server.zip && \
#...
Summary
Just an idea but I think this workflow will stop issues being raised with "new version available" and means you as maintainer don't need to drop everything to push out for a new version :)
Problem
New Terraria player here.
There have been a couple of days over the past month where my friends and I have been faced with a pop-up saying our version wasn't in sync with our server after a Steam Terraria update.
I noticed a couple of things in this repo:
Both of these don't lend themselves to keeping up with the latest version as there is a manual process to change the URL in the server download ZIP and those delays can take a while to notice and remedy.
Solution
My proposed solution is to use the following endpoint to grab server version number and build a docker image as soon as a new version is detected.
Link:
https://www.terraria.org/api/get/dedicated-servers-names
Returns:
In bash, I wrote this to parse out the first element in that JSON list:
Which returns:
I would suggest that there is a workflow with GitHub Actions where you can check that server endpoint more frequently and compare against your known version.
If the version is new, then automatically build and tag image with
:latestI added/changed this to your Dockerfile and it works in always sourcing the right version:
Summary
Just an idea but I think this workflow will stop issues being raised with "new version available" and means you as maintainer don't need to drop everything to push out for a new version :)