cluster

ffe9912 · gmorell · 2026-05-21 05:10

6 files +46 -26

Files changed

modified app.yml
+6 −6
@@ -155,9 +155,9 @@ spec:
155 155 name: waxx
156 156 ---
157 157 # Headless service so libcluster's Kubernetes strategy can resolve all
158 −# pod IPs for peer discovery. Pods discover siblings via the endpoints
159 −# selector + namespace + service name in runtime.exs; epmd-less long-
160 −# name distribution does the actual node connection.
158 +# pod IPs for peer discovery. Pods discover siblings via this service's
159 +# Endpoints; the actual Erlang distribution traffic flows pod-IP →
160 +# pod-IP (4369 = epmd, 9100 = inet_dist pinned in rel/env.sh.eex).
161 161 apiVersion: v1
162 162 kind: Service
163 163 metadata:
@@ -167,9 +167,9 @@ spec:
167 167 clusterIP: None
168 168 publishNotReadyAddresses: true
169 169 ports:
170 − - port: 4000
171 − targetPort: 4000
172 − protocol: TCP
170 + - { name: http, port: 4000, targetPort: 4000, protocol: TCP }
171 + - { name: epmd, port: 4369, targetPort: 4369, protocol: TCP }
172 + - { name: dist, port: 9100, targetPort: 9100, protocol: TCP }
173 173 name: http
174 174 selector:
175 175 name: waxx
modified assets/css/app.css
+3 −3
@@ -24,7 +24,7 @@
24 24 @plugin "../vendor/daisyui-theme" {
25 25 name: "dark";
26 26 default: false;
27 − prefersdark: true;
27 + prefersdark: false;
28 28 color-scheme: "dark";
29 29 --color-base-100: oklch(30.33% 0.016 252.42);
30 30 --color-base-200: oklch(25.26% 0.014 253.1);
@@ -58,7 +58,7 @@
58 58
59 59 @plugin "../vendor/daisyui-theme" {
60 60 name: "light";
61 − default: true;
61 + default: false;
62 62 prefersdark: false;
63 63 color-scheme: "light";
64 64 --color-base-100: oklch(98% 0 0);
@@ -313,7 +313,7 @@
313 313
314 314 @plugin "../vendor/daisyui-theme" {
315 315 name: "blueprint";
316 − default: false;
316 + default: true;
317 317 prefersdark: false;
318 318 color-scheme: "dark";
319 319 --color-base-100: oklch(28% 0.12 252);
modified rel/env.sh.eex
+37 −17
@@ -1,19 +1,39 @@
1 1 #!/bin/sh
2 −
3 −# Long-name distribution so libcluster can reach this node from peers
4 −# and Phoenix.PubSub can fan out across the cluster.
5 −#
6 −# POD_IP is injected by the deployment from status.podIP. RELEASE_COOKIE
7 −# comes from the elixir-args secret so every replica agrees on the
8 −# Erlang cookie.
2 +# Sourced by every `bin/waxx <command>` invocation. Only `start` and
3 +# `daemon` need long-name distribution — they're the long-lived
4 +# server nodes peer pods talk to. `remote`, `eval`, and `rpc` use
5 +# unique auto-generated short names so they don't fight the running
6 +# server for the `waxx@<pod-ip>` slot in epmd. Setting RELEASE_NODE for
7 +# those would cause an epmd name collision: the new (short-lived)
8 +# BEAM registers under the same name, evicts the running server from
9 +# epmd, and now peer pods can't find it via dist any more — which
10 +# typically takes the running pod down on its next inbound connect.
9 11 #
10 −# Only enable name-distribution when POD_IP is actually populated —
11 −# otherwise RELEASE_NODE becomes "waxx@" and the BEAM aborts before
12 −# Logger attaches, producing only a generic init crash.
13 −if [ -n "${POD_IP}" ]; then
14 − echo "[env.sh] starting with name distribution as waxx@${POD_IP}" >&2
15 − export RELEASE_DISTRIBUTION=name
16 − export RELEASE_NODE="waxx@${POD_IP}"
17 −else
18 − echo "[env.sh] POD_IP is empty — falling back to local-only sname distribution" >&2
19 −fi
12 +# POD_IP comes from the deployment's downward API. RELEASE_COOKIE
13 +# comes from the elixir-args / waxx-secrets secret so every replica
14 +# agrees on the Erlang cookie.
15 +case ${RELEASE_COMMAND:-} in
16 + start*|daemon*)
17 + if [ -n "${POD_IP:-}" ]; then
18 + echo "[env.sh] starting with name distribution as waxx@${POD_IP}" >&2
19 + export RELEASE_DISTRIBUTION=name
20 + export RELEASE_NODE="waxx@${POD_IP}"
21 +
22 + # Pin the inet_dist listener to a known port so it's predictable
23 + # from peers and routable through any future NetworkPolicy.
24 + # Without this BEAM picks a random ephemeral port each boot,
25 + # which works under default k8s pod-to-pod TCP but breaks the
26 + # moment a policy locks the namespace down.
27 + export ELIXIR_ERL_OPTIONS="${ELIXIR_ERL_OPTIONS:-} -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9100"
28 + else
29 + echo "[env.sh] POD_IP is empty — falling back to local-only sname distribution" >&2
30 + fi
31 + ;;
32 + *)
33 + # remote / eval / rpc — let mix release auto-pick a unique short
34 + # name (`rem-<rand>@127.0.0.1`) and use `-remsh` to attach by the
35 + # running node's long name (which it reads from this same script's
36 + # state under start, baked into the release at build).
37 + :
38 + ;;
39 +esac

Parents: 66113d8