bake-bake-bake / bakeware

Compile Elixir applications into single, easily distributed executable binaries

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to run detached

jkbbwr opened this issue · comments

I want to create an application that can be invoked on the command line or with a flag be run in the background as a sort of service.

Something like

$ ./myapp
hello world
$ ./myapp --daemon
$ 

Any idea how I can achieve something like this?

Bakeware is tied into Elixir releases and the invocation of a bakeware binary essentially calls bin/my_app start. Since this is hardcoded, we can't tie into other Mix release commands, like daemon, and I'm not sure if I want to. But I'll let this sit for now in case others want to weigh in or have ideas.

In the meantime, I believe you can achieve this manually by using backgrounding in the shell:

$ path/to/myapp > /tmp/myapp.log &

My 2 cents on this is that I wouldn't mind supporting it. The hardcoded bin/my_app start that we have felt to me as a quick solution for the competition that fit our use case well. I like the idea that we have an bakeware option to support the created binary having the exact same commandline options as a normal mix release including the ability to start in the background. I don't have time to work on the now, but I'd certainly brainstorm on how if that's desired.

For what its worth it was mostly a roll of the dice, I moved the project to rust for many other reasons. But it would be interesting to see what you decide