Running release freezes without any output

I’ve build my first release following the Deploying with Releases guide but when I try to run _build/prod/rel/itj/bin/server, it doesn’t show any output, and doesn’t publish the port. “Freezes” isn’t the correct word to describe the issue, though, because when I press “ctrl+C”, it shows me “BREAK: (a)bort (A)bort with dump …” command palette and even reacts to the commands if I run some. For example, if I pick “(l)oaded”, it shows a whole bunch of modules, including mine (like Elixir.ITJWeb.Router).

There is the code: GitHub - orsinium-labs/itj: IT Jobs aggregator

You can find the exact commands I use to build and run in Taskfile.yml and you can even run it if you have the repo cloned and task installed.

Or this is how I run the server without taskfile:

SECRET_KEY_BASE=ucFJTPEskCtTS6x12hJevgFp38RRVAyBTya1pmI1Ozz6743YqwCU00rFqVam34asd PHX_HOST=localhost PORT=3111 PHX_SERVER=true MIX_ENV=prod ./_build/prod/rel/itj/bin/server

And this is how I check its availability:

$ curl http://localhost:3111/
curl: (7) Failed to connect to localhost port 3111: Connection refused

If I replace _build/prod/rel/itj/bin/server with mix phx.server, everything works.

What can be the issue? Is there a way to see where and why it stopped?

Hello and welcome,

You forgot this part in your config/runtime.exs :slight_smile:

  # ## Using releases
  #
  # If you are doing OTP releases, you need to instruct Phoenix
  # to start each relevant endpoint:
  #
  #     config :itj, ITJWeb.Endpoint, server: true
  #
  # Then you can assemble a release by calling `mix release`.
  # See `mix help release` for more information.

When the release does not show up, it’s almost always forgetting to uncomment server: true

2 Likes

Thank you! That’s true with a minor correction. I had it but it had ITJ.Endpoint instead of ITJWeb.Endpoint.

Before:

  if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
    config :itj, ITJ.Endpoint, server: true
  end

After:

  if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
    config :itj, ITJWeb.Endpoint, server: true
  end

I’m wondering if that would be a good idea for Phoenix (or mix releases, or even Elixir compiler) to warn about an atom in the config that doesn’t point to any module.

1 Like