Deploying Phoenix App on cloud foundry

Hi,
I am trying to deploy phoenix app to cloud Foundry. Somehow phoenix app does not start and I keep getting below error:
2018-06-03T10:36:38.15+0200 [APP/PROC/WEB/0] OUT {“Kernel pid terminated”,application_controller,"{application_start_failure,my_app,{{shutdown,{failed_to_start_child,‘Elixir.MyAppWeb.Endpoint’,{shutdown,{failed_to_start_child,‘Elixir.Phoenix.Endpoint.Handler’,{shutdown,{failed_to_start_child,{ranch_listener_sup,‘Elixir.MyAppWeb.Endpoint.HTTP’},{shutdown,{failed_to_start_child,ranch_acceptors_sup,{listen_error,‘Elixir.MyAppWeb.Endpoint.HTTP’,eafnosupport}}}}}}}}},{‘Elixir.MyApp.Application’,start,[normal,[]]}}}"}
2018-06-03T10:36:39.32+0200 [APP/PROC/WEB/0] ERR Crash dump is being written to: erl_crash.dump…done
2018-06-03T10:36:39.32+0200 [APP/PROC/WEB/0] ERR Kernel pid terminated (application_controller) ({application_start_failure,my_app,{{shutdown,{failed_to_start_child,‘Elixir.MyAppWeb.Endpoint’,{shutdown,{failed_to_start_child,'Elixir.Phoenix.Endpoi
2018-06-03T10:36:39.34+0200 [APP/PROC/WEB/0] OUT Exit status 1

My Manifest file is below:
applications:

Maybe something is wrong with the address you’re trying to use? I don’t really understand what eafnosupport would mean in this context, except “Address family not supported by protocol”.

1 Like

I have managed to run it in cloud foundry, I made a lot of changes in application, and not sure which one actually solved it. There are two main changes which I made.

  1. Removed all references of Channels from my application, I guess Channel might have be causing the eafnosupport error.
  2. Even with prod deployment cloud foundry expects your application to run as local instance, so I don’t need to set url scheme and host name in config file, CF takes care of it.
    url: [scheme: “https”, host: “my-app.cfapps.io”, port: 443],
    force_ssl: [rewrite_on: [:x_forwarded_proto]],
    Well, apart from these two changes, I deleted prod.secret and moved all values to Env and app started to work.

I just had the same issue. I use websockets in my application so removing them is not an option. After changing my settings from inet6 to inet4 helped.

config :my_app, MyAppWeb.Endpoint,
  http: [:inet4, port: System.get_env("PORT") || 8080],
  cache_static_manifest: "priv/static/cache_manifest.json"
3 Likes

Is there any alternative for this buildpack - https://github.com/HashNuke/heroku-buildpack-elixir.git??
or is it available in the downloadable .zip format so that I can create a custom buildpack in CF? I want to avoid the download of this buildpack in every CI build.