How to Run a Released App in the Background with Rebar3/Cowboy?

Hi all,

Rebar3 looks release cycle is confusing to me as for now I want to run the released app in the background on the server side. Steps I took:

  1. Develop an app with the cowboy and I can ‘rebar3 shell’ and access it through localhost:8080.
  2. Add reverse proxy within my Nginx configuration to localhost and it works fine.
  3. Release the application.
  4. Within the ‘release_path/bin/rel’ I run ‘app_name daemon’ (or app_name start), it seems fine, as I don’t see any error, but the application seems not running at all.

What else do I need to do here? Do I need to add anything to the release to make it runnable in production? It seem it run the app in a VM, do I need to connect to it somehow and trigger a component? Thanks.


If you have added all things in the Erlang release that should be it.

Your node should run in the background and if you run cowboy you can ping or go to an endpoint that is open.


Try to ping localhost:8080. If that works, try to run a release in foreground so you can see if any exception or standard output pops out. Some of your processes may crash, but the whole VM can stay alive and deamon will just hang in the air.


May I ask what do you mean ‘added all things in Erlang release’? From my newbie point of view ‘rebar3 shell’ works fine during the development, so if I compile and then do ‘rebar3 release’ then everything should be in the _build, and I need to go the lib folder and run it as a daemon. Please let me know if I misunderstood the rebar3 thinking/life cycle. Thanks.


Thanks for mentioning this, when it runs as a daemon (I run ‘app-name daemon’), the localhost wont be available, and if I run ‘app-name foreground’ the only thing I get is as following, and stays stand-by (blinking prompt brick):

./app foreground
Exec: /usr/local/lib/erlang/erts-12.1.5/bin/erlexec -noinput +Bd -boot /root/web-app/com/_build/default/rel/com/releases/0.1.0/start -mode embedded -boot_var SYSTEM_LIB_DIR /usr/local/lib/erlang/lib -config /root/web-app/com/_build/default/rel/com/releases/0.1.0/sys.config -args_file /root/webapp/app/_build/default/rel/app/releases/0.1.0/vm.args -- foreground
Root: /root/webapp/app/_build/default/rel/app


rebar3 shell is a development mode. It will include a lot of things while you develop.

When you do a release your files need to be correct.

But you need to see that dependencies are in your file. If you use cowboy it should be in that list. You should add your dependencies into the applications list in that file.


Thanks for the link. It actually help me to think differently; although I don’t agree on dev and release be so different, how TDD even works in this situation (different topic I will ask later). So, I actually did add the cow dependency in the app.src file:

{application, app,
 [{description, "My app"},
  {vsn, "0.1.0"},
  {registered, []},
  {mod, {app, []}},
  {modules, []},

  {licenses, ["Apache 2.0"]},
  {links, []}

So I reduced it to two problems now:

  1. Im serving static files so I probably need to add the priv folder as the dependency.
  2. Going back to local, and using foreground on the release, gave me an ‘inet_tec’ error which is outside this question, as it relates to my local machine, so I posted a question here.