diff --git a/config/runtime.exs b/config/runtime.exs index ef10c93..2003340 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -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 ] diff --git a/rel/env.sh.eex b/rel/env.sh.eex index bc79dcb..0d7d2d7 100644 --- a/rel/env.sh.eex +++ b/rel/env.sh.eex @@ -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)