-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated "latest" Build without Version Decleration #47
Comments
Fantastic! I looked for some sort of api with the latest version number so I could automate the process. I would love to not need to manually update that. I will work on getting that built into my scripts. Thank you for providing the endpoint. |
@fanuch Where did you find this api link?? |
No worries @hskrtich! Their website is a web of obfuscated and minimised JS. I happened on that link but don't wish for even my enemy to pull apart their JS haha If you want specifics I can go find it again :) |
What would be really nice is a full list of versions so I can properly build the last 4 minor versions but Im not sure its worth it. |
Oh I would have loved that but if it is somewhere, it's hidden. I think it might need to be a local task and not one where we can trust the upstream to track. I'll post my research soon 👍 |
Okay, so. Go to https://www.terraria.org/
(Actually, search for "api" ... a lot more stuff comes up 👀 ) |
Thanks for the info! I took a look as well and I didnt find anything that had a list of versions. Ive decided to put together a separate repo that will hold a json of all the terraform versions with links to the server zip's |
Located these two that keep versions. https://terraria.wiki.gg/wiki/Desktop_version_history Seeing as there are Docker images, my recommendation is to keep previous tags in the Docker repo, and list out a table here of valid tags. If someone wants to build they will need to pass a variable to the Dockerfile such as: # ...
ARG VERSION=latest # Current latest version
RUN \
if [ $VERSION = "latest" ]; then
curl -s https://www.terraria.org/api/get/dedicated-servers-names | \
grep -o 'terraria-server-[^"]*' | \
head -1 | \
tee version.txt;
else;
echo $VERSION > version.txt
fi
RUN mkdir /tmp/terraria && \
cd /tmp/terraria && \
curl -sL https://www.terraria.org/api/download/pc-dedicated-server/$(cat version.txt) --output terraria-server.zip && \
#...
Bit clunky but the idea is that they could pass in their own version if they wanted to manually build an old version like 1.4.4.1: docker build -t terraria --build-arg VERSION=1.4.4.1 . Otherwise they could pull the old tag, or on a regular build, it will always pull the latest version off that version endpoint |
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
:latest
I 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 :)
The text was updated successfully, but these errors were encountered: