bitwalker/distillery

How to start a daemon without a shell?

derekkraan opened this issue · 1 comments

This isn't so much a bug, since this appears to be intentional behaviour.

Anyways, when you run bin/my_app start, distillery proxies that through to bin/my_app console, which starts IEx. The result is that my applications logs are polluted with IEx prompts, which are getting in the way because I am logging to JSON and using filebeat to ship these logs to logstash.

So my question is: now we have remote_console, (which I use all the time), so do we still need start to start a shell that we could connect to? None of the other core functionality of Distillery (eg, stop) uses this if I am reading the code correctly.

So my proposal (or question) is whether we can either change start to not start a shell, or provide a good way (start_daemon or equivalent) to run a shell-less daemon out of the box with Distillery? I would be happy to contribute a PR if I get some guidance on what you'd accept.

You should not rely on the erl logs for your application logging, it is not really intended for anything but last resort debugging. Instead you should provide a custom Logger backend that writes to files/syslog/etc.

The use of start fundamentally depends on a shell being attached. If you want the behavior you are looking for, you should use foreground in conjunction with a service manager like systemd which can route stdout/stderr to the appropriate logging facility.