Here’s another kubernetes project for my series of posts. The main point here is to show how to get a local folder from your filesystem into a container, similar to running docker with -v /path:/target.
Of course I could just set up some silly demonstration, and just show from a shell inside the container that the folder is mounted, but where’s the fun in that?
Instead, we’re going to play a game.
First, a bit of history. Back in the olden (golden) days of computer gaming, when a really awesome game could still be written by one guy in weeks (unlike today where whole production crews labor months just to shoot all the videos for the cutscenes), there was “Adventure”. Adventure was the very first text adventure game, where you would enter simple one- or two-word commands (“enter house”, “take sword”, “kill orcs”), and then you would read (and picture in your mind), the next scene.
In 1980, Infocom released “Zork I”, a commercial game based around Adventure, where you could enter whole sentences instead of just one or two words.
Fast-forward to today: Infocom is long gone, and any legal successor is also gone, which makes all the infocom games “Abandonware” – they are still copyright protected but there is NO ONE who has a legal handle to pursue the copyright…
Anyway, in the linux world there is an open source interpreter for the datafiles used by these games, which means if you happen to still have a copy of Zork I (which I actually do – on real, honest to god 5.25″ floppy disk), you can copy the datafile on your linux computer and play the game. That interpreter is called “frotz”, available here.
Also available “out there” is a piece of python code called “z5bot” which lets you run a telegram bot that people can talk to, to play games for frotz. This piece of code is here.
My plan is to run this bot in a container on my K3s.
To run this, you have to do several things:
- create a telegram bot by opening telegram, and talk to the “botfather” account. The botfather will take you through all the steps necessary to create your bot, and in the end will provide you with the telegram api key that you have to put in the configuration file for z5bot.
- Next is to find a game file – there’s a big online archive, browse and look at details, you can use any file that in the details talks about a “Z Machine Interpreter”. In this demonstration here I’ll be using the original Adventure in its Z-Code version, available here.
- To run z5bot from my docker image in Kubernetes we need to create two folders on the host that will actually run the container – if you have more than one worker you’ll have to work with other storage options, NFS comes to mind – you want to have an easy way to access at least the stories folder.
One folder is for the story files and the configuration, the other is for savegames, and has to be world writable.
- Put your story file in the first of the two folders, and create a configuration file for your z5bot in there as well. The filename has to be config.json, the content is based on the sample file which you can find here. The telegram api key that you received in step 1 goes in line 2 of the file, the format for the list of installed games is self explanatory.
- Create a deployment file with your local folders as storage options. My deployment file is here. The parts dealing with storage are lines 9 to 61, and lines 80 to the end.
Let’s Play: Start a telegram session with your bot, type /start and then /select to see all available games. For any “press enter to continue” prompts you can use /return.
By the way, advent is also available on the MVS emulator from this post: