Fix Kubernetes node naming for distributed Erlang clustering

This commit is contained in:
Graham McIntire 2025-07-25 11:47:37 -05:00
parent 14ffefe2e9
commit 187a607563
No known key found for this signature in database
2 changed files with 11 additions and 2 deletions

View file

@ -147,7 +147,7 @@ if config_env() == :prod do
strategy: Cluster.Strategy.Kubernetes.DNS,
config: [
service: "aprs-headless",
application_name: "aprs",
application_name: "aprsme",
namespace: System.get_env("POD_NAMESPACE", "aprs"),
polling_interval: 10_000
]

View file

@ -17,7 +17,16 @@
# Set the release to work across nodes.
# RELEASE_DISTRIBUTION must be "sname" (local), "name" (distributed) or "none".
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=<%= @release.name %>@${DOKKU_APP_NAME:-aprsme}.web.${DOKKU_APP_INSTANCE:-1}
# Check if we're in Kubernetes (POD_NAME will be set)
if [ -n "$POD_NAME" ]; then
# Use Kubernetes pod name and headless service for clustering
export RELEASE_NODE=${RELEASE_NODE:-<%= @release.name %>@${POD_NAME}.aprs-headless.aprs.svc.cluster.local}
else
# Fallback to Dokku naming for non-Kubernetes deployments
export RELEASE_NODE=<%= @release.name %>@${DOKKU_APP_NAME:-aprsme}.web.${DOKKU_APP_INSTANCE:-1}
fi
export RELEASE_COOKIE=${RELEASE_COOKIE:-Euta32aoLfgADYz3TiSCpQP0Y3iD7AD3zu0ycYWI5lQ=}
#ip=$(grep fly-local-6pn /etc/hosts | cut -f 1)