From e107cd7a4b0e33da6406985ef6ae9a42e2fe03e7 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 16 Jun 2025 10:43:37 -0500 Subject: [PATCH] dokku port fixes --- Dockerfile | 3 ++- config/runtime.exs | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d1a3619..8ce1704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -146,4 +146,5 @@ LABEL org.opencontainers.image.vendor="APRS.me" \ security.privileged="false" # Container configuration is handled by Dokku -EXPOSE $PORT +# Port is set dynamically by Dokku via PORT environment variable +EXPOSE 5000 diff --git a/config/runtime.exs b/config/runtime.exs index a147c90..4d0c121 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -16,8 +16,12 @@ import Config # # Alternatively, you can use `mix phx.gen.release` to generate a `bin/server` # script that automatically sets the env var above. -if System.get_env("PHX_SERVER") do +# Always start the server in production/docker environments +if System.get_env("PHX_SERVER") || config_env() == :prod do config :aprs, AprsWeb.Endpoint, server: true + IO.puts("Phoenix server enabled - will start HTTP listener") +else + IO.puts("Phoenix server disabled - no HTTP listener will start") end if config_env() == :prod do @@ -44,6 +48,7 @@ if config_env() == :prod do host = System.get_env("PHX_HOST") || "example.com" port = String.to_integer(System.get_env("PORT") || "4000") + IO.puts("Phoenix will bind to port: #{port}") config :aprs, Aprs.Repo, # ssl: true, @@ -61,7 +66,10 @@ if config_env() == :prod do ip: {0, 0, 0, 0}, port: port ], - secret_key_base: secret_key_base + secret_key_base: secret_key_base, + server: true + + IO.puts("Phoenix endpoint configured for host: #{host}, port: #{port}") # config :aprs, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")