0
votes

In my logs, when running a mix task on Heroku production Phoenix/elixir app, I see:

2016-11-17 20:18:12.977 191 <190>1 2016-11-17T20:18:12.500325+00:00 app web.1 - - 20:18:12.497 [info] Running MyApp.Endpoint with Cowboy using http://localhost:37878
2016-11-17 20:18:19.484 164 <190>1 2016-11-17T20:18:19.110856+00:00 app web.1 - - 20:18:19.110 [info] Tzdata has updated the release from 2016c to 2016i
2016-11-18 00:27:03.981 191 <190>1 2016-11-18T00:27:03.553073+00:00 app web.1 - - 00:27:03.552 [info] Running MyApp.Endpoint with Cowboy using http://localhost:56534
2016-11-18 01:00:23.352 131 <45>1 2016-11-18T01:00:23.178158+00:00 heroku web.1 - - Stopping all processes with SIGTERM

Why do I see URLs with "localhost" in them? Is this a bad configuration setup on my part? I'm getting R14 errors, so I'm trying to understand if this is part of that.

1

1 Answers

1
votes

Why do I see URLs with "localhost" in them?

That's the host/port that Phoenix is running on. By default Phoenix in production mode runs on the port specified by the environment variable PORT:

# config/prod.exs
config :my_app, MyApp.Endpoint,
  http: [port: {:system, "PORT"}]

Heroku provides a value for PORT to each application (in this case you got 37878 at 2016-11-17 20:18:12.977 and 56534 at 2016-11-18 00:27:03.981). This value changes on every deploy so you probably deployed the application, manually restarted it, or did something which triggered a restart at those times. Heroku then proxies the traffic from a domain to the port on which the application for that domain is currently running on.

Is this a bad configuration setup on my part?

No, nothing is wrong here.