Hi Aleksandr,
1. Proper detaching from the parent process, making daemon more secure
2. Proper detaching from any TTYs, making daemon even more secure
Regarding the security implications when using a script vs a binary, could
you explain?
3. Proper redirection of all file descriptors, helps with debugging and
logging
with file descriptor redirection, beyond stderr, stdout what are you
considering here?
5. More flexible solution: ability to run Brooklyn with any arguments,
service script will have "brooklyn launch" part hardcoded and will
require
to edit the code each time you need to run it with the new args.
are you intending this to be used outside of init? we'd have the config set
externally to the daemon
Overall I see the native daemon solution as more traditional and
compliant
to Linux standards than just wrapping bash script in yet another script.
we don't have to wrap a script surely? the init script doesn't have to call
the brooklyn script.
All the best,
John
On Fri, Jan 29, 2016 at 2:58 PM, Aleksandr Vasilev <
[email protected]> wrote:
Hi Alex,
The advantages of having a native daemon in my opinion are:
1. Proper detaching from the parent process, making daemon more secure
2. Proper detaching from any TTYs, making daemon even more secure
3. Proper redirection of all file descriptors, helps with debugging and
logging
4. More portable solution, as the daemon can be used in any type of
service
scripts or even on its own, not only systemd script
5. More flexible solution: ability to run Brooklyn with any arguments,
service script will have "brooklyn launch" part hardcoded and will
require
to edit the code each time you need to run it with the new args.
Overall I see the native daemon solution as more traditional and
compliant
to Linux standards than just wrapping bash script in yet another script.
Best Regards,
Aleksandr Vasilev
DevOps Engineer | Cloudsoft Corporation
On 29 January 2016 at 17:30, John McCabe <[email protected]> wrote:
[bumping so aleks can see the thread]
On Thu, 28 Jan 2016 at 16:41 Andrew Kennedy <
[email protected]> wrote:
Or what about running a Brooklyn Docker image as a systemd service!
-
http://container-solutions.com/running-docker-containers-with-systemd/
- https://github.com/ibuildthecloud/systemd-docker
Andrew.
On Thu, 28 Jan 2016 at 16:34 Alex Heneveld <
[email protected]>
wrote:
Hi Aleksandr-
What's the advantage of a native daemon over just wrapping it as a
linux
service script ?
Best
Alex
On 28/01/2016 11:32, Aleksandr Vasilev wrote:
Hello everyone!
I spent last few days looking at the solution to run Brooklyn
process
as
a
daemon and found two options:
1. Run daemon via Apache Commons Daemon (jsvc)
2. Write a custom daemon in C
Both solutions has its own pros and cons, so let's look at what I
think
they are:
JSVC:
Pros:
- Ready to use solution. Running a daemon via jsvc is very
similar
to
running java application from the command line with similar
arguments
passed.
- Builds as usual in Maven
Cons:
- Still requires you to write daemon code, which in my opinion
kills
the
out-of-the-box usability
- Has tons of bugs, including: not been able to find classes in
classpath,
not been able to run by non-root users, not been able to run on
several
*nix systems (Mac OS, BSD)
- The codebase hasn't changed since 2013 and seems abandoned
- SVN repo often isn't accessible for some reason, right now the
webserver
returns 503 error code:
http://svn.apache.org/viewvc/commons/proper/daemon/trunk/
Custom Daemon (written in C):
Pros:
- Cross-platform, runs on any *nix system supported by Brooklyn
- Very little code to maintain
- Independent from third-party solutions, requires only gcc to
build
- Easy to make LSB-compliant init scripts to control the daemon
Cons:
- Requires some overhead to build C code in Maven
Having all these options considered, I propose writing daemon for
Apache
Brooklyn in C language and use gcc compiler to build it. It will
require
introducing some changes to Maven build process, but there are
plenty
of
solutions for doing this, such as Maven NAR plugin, which is
actively
maintained:
https://github.com/maven-nar/nar-maven-plugin
Best Regards,
Aleksandr Vasilev
DevOps Engineer | Cloudsoft Corporation
--
Andrew Kennedy ; Founder clocker.io project ; @grkvlt ; Cloudsoft