Effective ports and URL rewriting
Two of the most tedious things about launching several micros by hand —colliding ports and URLs that have to be repointed— MicroLab resolves on its own, and it does so without modifying the repos’ code.
Effective port
Section titled “Effective port”Almost all micros declare the same port (typically 8080). If you launch several, they collide. MicroLab remaps the ports at runtime: each micro gets a free effective port, and that’s the one it really uses. The port declared in the manifest may change at startup; in the scenario views you see each micro’s effective port.
URL rewriting
Section titled “URL rewriting”When a micro calls another core, the URL it uses depends on how you resolved that
dependency (local, cloud or mock). MicroLab computes the
effective URL and injects it as configuration at startup: system properties in the
JVM family (-D…), environment variables in Node/Python. The repo is not touched;
everything is done by injection.
Perspective (host or container)
Section titled “Perspective (host or container)”The correct address of the same service depends on where it’s called from: a native
micro reaches it at localhost:<port>, but one in a container needs the internal address
of the Docker network. This is called perspective: MicroLab resolves hosts with each
client’s perspective (machine or container) so that communication works in mixed mode.
It’s the same reason Kafka is configured with a dual listener: the advertised listener it announces must be reachable from where each client runs.