865 B · text History 3208487
#!/bin/sh
# Sourced by every `bin/vigil <command>`. In Kubernetes, POD_IP comes from
# the downward API and names the node vigil@<pod ip>, which is how
# libcluster's Kubernetes strategy (config/runtime.exs) addresses its
# peers. Every replica must share RELEASE_COOKIE to connect.
#
# `remote` / `eval` / `rpc` need the name too, to find the running node;
# the temporary BEAM they start picks its own name, so there's no clash.

if [ -n "${POD_IP:-}" ]; then
  export RELEASE_DISTRIBUTION=name
  export RELEASE_NODE="vigil@${POD_IP}"
fi

case ${RELEASE_COMMAND:-} in
  start*|daemon*)
    # Pin the distribution port, so it's predictable from peers and matches
    # the headless Service; otherwise BEAM picks a random one each boot.
    export ELIXIR_ERL_OPTIONS="${ELIXIR_ERL_OPTIONS:-} -kernel inet_dist_listen_min 9100 inet_dist_listen_max 9100"
    ;;
esac