bitwalker / exrm

Automatically generate a release for your Elixir project!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running exrm release in console mode hangs for rhel7.2 and centos7.2 images

oadeojo opened this issue · comments

I built an exrm release of my phoenix application and it hangs when I try to run the release in console mode. I did some more investigating and realized that this only happens in a docker container. I have a docker file that is an exact replica of my environment. See below:

https://gist.github.com/oadeojo/76266ea9562918f3ffc0ca9803759348

  • Generate a new basic Phoenix app
  • install node and elixir dependencies
  • brunch build --production
  • MIX_ENV=prod mix phoenix.digest
  • MIX_ENV=prod mix release

Try to start the application in console mode

./rel/frostPush/bin/frostPush console
Exec: /code/rel/frostPush/erts-7.3/bin/erlexec -boot /code/rel/frostPush/releases/0.0.1/frostPush -config /code/rel/frostPush/running-config/sys.config.2.config -boot_var ERTS_LIB_DIR /code/rel/frostPush/erts-7.3/../lib -env ERL_LIBS /code/rel/frostPush/lib -pa /code/rel/frostPush/lib/frostPush-0.0.1/consolidated -args_file /code/rel/frostPush/running-config/vm.args.2.config -mode embedded -user Elixir.IEx.CLI -extra --no-halt +iex -- console
Root: /code/rel/frostPush
/code/rel/frostPush
20:55:40.551 [info] Running FrostPush.Endpoint with Cowboy using http://localhost:7000
Interactive Elixir (1.2.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Eshell V7.3  (abort with ^G)
iex(1)> iex(1)>

The application works fine but the console stays stuck and no commands can be run.

export TERM=xterm
Fixed the issue. I found the solution here #315. I missed it when I performed my first search.

Just as a sanity check, could you build your release with this as your base image? You should just be able to copy in your project directory and build with node/mix. I use it and my alpine-erlang image for running releases. If it works there, that will help narrow down the problem.

I can try testing with a centos7 image soon, but I have family in town at the moment, so I'm a bit cramped for time.

I thought about suggesting that, but without that the console wouldn't respond to CTRL+G, but it still worked. Good to know it can cause additional problems depending on platform.

@bitwalker Thanks for the swift reply. I will test and let you know.

I got the console to work but now, I can't use an external observer to take a look at my app.

15:27:46.810 [error] [node: :"root@1**.**.0.31", call: {:observer_backend, :sys_info, []}, reason: {:badrpc, {:EXIT, {:undef, [{:observer_backend, :sys_info, [], []}, {:rpc, :"-handle_call_call/6-fun-0-", 5, [file: 'rpc.erl', line: 206]}]}}}]

I would have created a new issue but I am curious as to why it would work in the docker container if I use the source but wont if I use a release. It would seem there are certain assumptions that can't be made in the docker container.

@bitwalker I tried building with exrm installed in your image and got

==> relx (compile)
src/rlx_util.erl:none: undefined parse transform 'eunit_autoexport'
Compiling src/rlx_util.erl failed:
ERROR: compile failed while processing /opt/app/frost/deps/relx: rebar_abort
** (Mix) Could not compile dependency :relx, "/opt/app/.mix/rebar compile skip_deps=true deps_dir="/opt/app/frost/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile relx", update it with "mix deps.update relx" or clean it with "mix deps.clean relx"

when running an exrm release and need to use the observer, you need to add :runtime_tools to the application list and it worked for me. I found the solution in https://gist.github.com/pnc/9e957e17d4f9c6c81294.

Sorry for the delay! That image doesn't have eunit installed. I usually don't bother building releases with that image, I just run the app with mix phoenix.server or mix run --no-halt. My usual approach with releases in Docker is to build a release package on my machine (or a build server), and then build the container by mounting the tarball into the bitwalker/alpine-erlang image, extracting it, and running bin/myapp foreground as the entrypoint. Images end up being way way smaller that way.