ExUnit tags I’m working toward my goal of respawning processes across the cluster and I want to make small changes while continuously running my test suite to check for regressions. I have a failing test from the other day that will help steer me in the direction I need to go, but I don’t want the noise of this failing test whenever I run the full suite. I add a moduletag that will tell ExUnit to skip all tests in this module:
Writing the first test Excited to start writing tests for the cluster behavior, I wrote up the skeleton for my first test case:
@cluster_opts [cluster_size: 2, boot_timeout: 4_000] scenario "when a node shuts down while having an active game session", @cluster_opts do test "game session is restarted on another node", _ctx do assert false end end The code compiles and the test fails as expected. Next, I check that I can interact with the nodes using the interface provided by ex_unit_clustered_case.
What’s Next? The overall milestone I’m working toward with Minotaur development is to create a workflow which allows me to push out frequent changes to the development server without causing any current games in session to be affected. Let’s review the individual problems needed to reach that goal:
Launch the application as nodes in an Erlang Cluster on deploy. Start new game session processes on a new version node to replace the sessions of the old version node.
Debugging the Cluster I updated rel/env.sh.eex so RELEASE_NODE sets the correct longname for the node when the server is started. I noticed that hostname -I can return multiple IPs since the swarm service containers are part of multiple networks. It seems that the first IP in the list is always in the 10.0.0.0/24 subnet which I think is what’s needed for the longname (SPOILERS: It’s the wrong network). I’ll just kept my eval expression simple and grab the first IP:
Distributed Elixir When I deploy a new version of Minotaur, I will need to migrate active game processes from the existing application instance to new processes in the newly deployed instance. I’ll be trying to accomplish this using the Horde library, but Horde assumes Erlang clustering is already setup in order to use it. I am looking into libcluster to manage dynamically adding newly deployed Minotaur applications to an Erlang cluster in order to leverage the distributed features of Horde.
Minotaur I started a project nearly 4 years ago to try out a simple turn-based game concept using Phoenix LiveView. I named the project Minotaur based on an initial idea of the game direction, but it’s just a code name or placeholder until I know what this thing might end up being. I spent a few weeks working on Minotaur until I got busy with something else and I didn’t come back to it for a few months.
Introducing Proton My friend Kurt mentioned that for his email he uses Proton which is located in Switzerland and has excellent security and privacy laws. I’ve wanted to use my domain name for a professional email for some time, but I didn’t want to pay for email server hosting. Now that I’ve got a fresh coat of paint on my website, I feel I can drop a couple bucks to create a better email address to compliment it.
Hugo gets promoted I was planning to only use Hugo for the blog portion of my site and spend more time building the core site with something like Alpine.js or whatever the new hot frontend tool is. However, I don’t really have any core content to show at this point other than links to a couple of demo projects when I was learning ClojureScript and Three.js years ago. I figure I might as well use Hugo for the root site and build out from there.
Why post a public journal? I want to keep a dev journal to articulate my thoughts throughout the problem-solving process as well as to download new ideas (usually side quests) from my brain to keep my focus. There are plenty of other benefits to writing a developer journal and there is no better time to start than right now.
I want to publish this journal publicly on my personal site to: