#!/bin/sh
# Sourced by every `bin/feed_pug <command>` invocation. We set `RELEASE_NODE`
# whenever `POD_IP` is available because *every* subcommand needs the running
# release's node name:
#
# - `start` / `daemon` register the running server under this name.
# - `remote` / `eval` / `rpc` pass it to `-remsh` (or RPC dial) to attach to
# the running server. The temporary BEAM those commands spawn picks its OWN
# unique short name (`rem-<rand>@<host>`), so setting RELEASE_NODE here does
# not cause an epmd collision — it only names the target.
#
# Without this the release boots with the default *short-name* (`sname`)
# distribution as `feed_pug@<hostname>`, which other pods can't resolve — so
# libcluster connects to nothing and Phoenix.PubSub never spans pods (a live
# newsfeed update on one replica wouldn't reach a LiveView on another).
#
# POD_IP comes from the deployment's downward API. RELEASE_COOKIE comes from the
# `feed-pug-secrets` Secret so every replica agrees on the Erlang cookie.
if [ -n "${POD_IP:-}" ]; then
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE="feed_pug@${POD_IP}"
else
echo "[env.sh] POD_IP is empty — falling back to default short-name distribution" >&2
fi
case ${RELEASE_COMMAND:-} in
start*|daemon*)
echo "[env.sh] starting with name distribution as ${RELEASE_NODE:-(unset)}" >&2
# Pin the inet_dist listener so the port is predictable from peers and
# matches the headless service / any future NetworkPolicy. Without this BEAM
# picks a random ephemeral port each boot.
export ELIXIR_ERL_OPTIONS="${ELIXIR_ERL_OPTIONS:-} -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9100"
;;
esac
neiam
/feedpug
feedpub
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
1.7 KiB · text
History
7ad1745