Skip to content

Automated "latest" Build without Version Decleration  #47

Description

@fanuch

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:

  1. There is a cron for building once a day
  2. 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:

terraria-server-1445.zip

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions