From d886f5d987cb5ddcc6edc6c64304f327276408e9 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 18 Feb 2026 11:51:51 -0600 Subject: [PATCH] Fix migration init container env vars and ConnectionMonitor crash - Add missing env vars to migration init container (PHX_HOST, PORT, APRS_PORT, APRS_CALLSIGN, APRS_PASSCODE) so runtime.exs config provider doesn't fail due to Kubernetes service discovery injecting APRS_PORT as a full URL - Guard ConnectionMonitor.accepting_connections?/0 with Process.whereis to avoid crashing when the GenServer isn't started (e.g. cluster enabled but no libcluster topologies configured) --- k8s/deployment.yaml | 13 +++++++++++++ lib/aprsme/connection_monitor.ex | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 9c17b34..7670e27 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -48,6 +48,14 @@ spec: value: "prod" - name: SKIP_DB_CREATE value: "true" + - name: PHX_HOST + value: "aprs.me" + - name: PORT + value: "4000" + - name: APRS_PORT + value: "10152" + - name: APRS_CALLSIGN + value: "w5isp-1" - name: RELEASE_COOKIE valueFrom: secretKeyRef: @@ -58,6 +66,11 @@ spec: secretKeyRef: name: aprs-secrets key: SECRET_KEY_BASE + - name: APRS_PASSCODE + valueFrom: + secretKeyRef: + name: aprs-secrets + key: APRS_PASSCODE envFrom: - secretRef: name: aprs-db diff --git a/lib/aprsme/connection_monitor.ex b/lib/aprsme/connection_monitor.ex index 9bd4552..7ee49c4 100644 --- a/lib/aprsme/connection_monitor.ex +++ b/lib/aprsme/connection_monitor.ex @@ -66,7 +66,7 @@ defmodule Aprsme.ConnectionMonitor do Check if this node should accept new connections """ def accepting_connections? do - if cluster_enabled?() do + if cluster_enabled?() and Process.whereis(__MODULE__) != nil do GenServer.call(__MODULE__, :accepting_connections?) else true