B8.1 · dive 1 of 4 · Production on Fly
The release and the image.
From the umbrella root the Dockerfile compiles the codemojex app, makes the native codec, and packs mix release codemojex into a slim image — building only echo_mq, echo_data, and echo_wire, and leaving echo_store, echo_bot, and echo_graft out.
The idea
codemojex · the release and the imageThe image builds a release, not a running checkout. From the umbrella root the Dockerfile resolves the production dependencies, compiles the codemojex app over its in-umbrella deps, and assembles mix release codemojex — a self-contained tree of the BEAM, the compiled app, and its boot scripts. A second, slim runtime stage carries only that release, with no Elixir toolchain left behind, so the shipped image is small and holds nothing the running game does not use.
Before the release is cut, the native branded-id codec is built. echo_data carries a Rust core and a C shim that compile to shared objects in its priv directory; the release packs them, and the boot self-check confirms the native and pure-Elixir id paths agree. The codec is an optimization, not a requirement — the app falls back to pure Elixir if the shared object is absent — but building it in the image means production runs the accelerated path.
Only three of the umbrella’s apps are built: echo_mq, echo_data, and echo_wire, the ones codemojex depends on. echo_store is left out on purpose, because the game does not depend on it and it carries a SQLite C-NIF the release would otherwise have to compile and ship for no use; echo_bot and echo_graft are out for the same reason, each its own concern behind its own boundary. The Dockerfile copies only the needed apps’ manifests, so dependency resolution sees a minimal umbrella shape and the build stays lean.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- Helland — Life Beyond Distributed Transactions (CIDR 2007)each umbrella app as its own bounded concern, built only when depended on
- Erlang/OTP — the gen_server behaviourthe supervised processes the release boots as one application
- The Go Blog — Share Memory By Communicatingthe consumers draining work by message, and the deps an app keeps to itself
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus