Phoenix with distillery does not work

https://github.com/bitwalker/distillery/issues/410

Steps to reproduce

  1. mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
  2. mix phx.new phxtest
  3. add {:distillery, "~> 1.5", runtime: false} to mix.exs
  4. mix release.init
  5. MIX_ENV=prod mix release.init
  6. MIX_ENV=prod mix release
dcy@dcy-dcy  ~/apps/phxtest  PORT=4000 _build/prod/rel/phxtest/bin/phxtest console
Erlang/OTP 19 [erts-8.3] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

Interactive Elixir (1.6.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(phxtest@127.0.0.1)1> 

lsof -i:4000 return nothing

Description of issue

  • What are the expected results?
    lsof -i:4000 return something, and http://127.0.0.1:4000 works.
  • What OS, Erlang/Elixir versions are you seeing this issue on?
    Ubuntu16.03, Erlang: OTP19, Elixir: 1.6.3
  • If possible, also provide your rel/config.exs, as it is often
    my first troubleshooting question, and you’ll save us both time :slight_smile:
# Import all plugins from `rel/plugins`
# They can then be used by adding `plugin MyPlugin` to
# either an environment, or release definition, where
# `MyPlugin` is the name of the plugin module.
Path.join(["rel", "plugins", "*.exs"])
|> Path.wildcard()
|> Enum.map(&Code.eval_file(&1))

use Mix.Releases.Config,
    # This sets the default release built by `mix release`
    default_release: :default,
    # This sets the default environment used by `mix release`
    default_environment: Mix.env()

# For a full list of config options for both releases
# and environments, visit https://hexdocs.pm/distillery/configuration.html


# You may define one or more environments in this file,
# an environment's settings will override those of a release
# when building in that environment, this combination of release
# and environment configuration is called a profile

environment :dev do
  # If you are running Phoenix, you should make sure that
  # server: true is set and the code reloader is disabled,
  # even in dev mode.
  # It is recommended that you build with MIX_ENV=prod and pass
  # the --env flag to Distillery explicitly if you want to use
  # dev mode.
  set dev_mode: true
  set include_erts: false
  set cookie: :"?ek;v4y<4mg)7dn[vxF)9APd5LOIu|gdhY9kEqJIg/nDK:?}b]g|VUK<jySxbc?z"
end

environment :prod do
  set include_erts: true
  set include_src: false
  set cookie: :"H:u$4t<%cnmsW>_HVe)TTIomN;DCtWV~<uFp``:/0KVWRD30;a,$*U*UpTv4>e!["
end

# You may define one or more releases in this file.
# If you have not set a default release, or selected one
# when running `mix release`, the first release in the file
# will be used by default

release :phxtest do
  set version: current_version(:phxtest)
  set applications: [
    :runtime_tools
  ]
end
1 Like

Do you have

config :my_app, MyAppWeb.Endpoint,
  server: true

In your endpoint config?

There are steps you probably missed, as mentioned in the issue you linked.

3 Likes

Thanks! it works.