The droplet's firewall let in SSH and web traffic and nothing else. The worker was behind a home router, on a laptop that had no public address and no reason to want one. Distributed Erlang needs one of them to reach EPMD and a random high port on the other. Getting that to be true took one Tailscale network, two long names, a shared secret, and a GenServer that didn't do what its log messages said.


Where this fits

The last post was the decision: a live trading node and a backtest worker sharing one broker quota and one set of OAuth tokens, held together with Distributed Erlang instead of a message broker. It covered the two releases and the {:global, ...} change that made the token stores reachable from another machine. This one is everything underneath that change — how two BEAM nodes on different networks find each other at all, as originally shipped. Several pieces of it turned out to be wrong. I'll point at them as they go by; what happened when they failed is its own post.

Why the worker lives at my house

When the worker shipped, the web node was a droplet with 1 vCPU and 2 GB — a step up from the $4 droplet the app started on, before any of the infrastructure lived in Terraform. Those 2 GB were already spoken for: Postgres, the Phoenix endpoint, Caddy in front of it, and every live RealtimeTrader. A monitoring alert was set to fire at 70% memory.

Live trading is steady and can't wait. Backtests are the opposite: bursty, CPU-bound, hungry for memory, and entirely optional at any given minute. On a single shared core, the work that could wait was competing with the work that couldn't. The worker pod's manifest asked for two full CPUs on its own — more than the droplet had in total. Meanwhile a couple of old laptops at home, running Kubernetes, had cores and RAM doing nothing.

The droplet did get bigger later — 2 vCPU and 4 GB, after a stray second BEAM on that host had already run it out of memory once. The worker stayed at home. Size was a big part of the original move, but not all of it: live trading shouldn't share a machine with twenty backtests at a time, and a bigger droplet doesn't change that.