Microservices, yay (but only when/where they make sense)
1: The Master Poller queries the Steam Master every 30s to get a listing of all "active" OHD servers. If it sees a server that doesn't exist in the db, it adds it. It also publishes this information to a redis channel.
2: The OHD Server Poller queries all the OHD servers (via A2S
) found in the db (thanks, master!) and updates the server's entry in the database with their current rules/info. OHD places the list of mods installed
(Not necessarily in-use, just installed) and the version running on the server into the rules output which we can extract and make use of. This worker fires off every 10s but since the queries run synchronous,
it's closer to every 30s with the current amount of servers (60 give/take). If values like map_name, player_count, etc differ from what is in the db, the changes are published to a redis channel.
3: The Steam Workshop Poller grabs the mod ids that we got in the last step and queries the Steam Workshop API every 60s (chunked into groups of 20, I've had luck up to ~50. may extend this to cut down on API calls
at some point). These values are placed into their respective mod in the db. If the poller sees that the time_updated
entry differs from what is stored in the DB, there must have been an update! The
poller then publishes the workshop id to a redis channel.
4: The Steam Workshop Downloader is subscribed to the aforementioned redis pubsub channel. When the Workshop Poller publishes a workshop id, the workshop downloader receives it and kicks off steamcmd
to
download the mod locally. It pulls the uplugin
file that is packaged with the mod and reads the version info from it. It takes that version info and jams it into the db under the associated mod. Finally,
that information is published to a redis channel.
5/6: FastAPI serves up models from the db and websockets to allow live-updating in the browser. Finally, the frontend flask webapp serves up the content via an nginx proxy.
The entire thing is orchestrated by docker
, powered by Python3
, and backed by a MariaDB
instance because FUCK THA POLICE!
Is the site design poor? Yeah, it's pretty bad. I'm pretty terrible at crap like that. While my day job keeps me pretty on-point with architecting, building, and securing complex application environments, it doesn't really lend itself much to making things purty.
DISCLAIMER: This site is in no way affiliated with OHD or @Bluedrake42. I just think the game and the whole premise around the project is pretty damn cool. See you on Discord .