[erlang-questions] integrate rebar3 release and systemd

dieter@REDACTED dieter@REDACTED
Wed Sep 19 12:19:02 CEST 2018


Hi Tobias,
thanks a lot for your example, I appreciate it very much!
In fact, I wanted to ask in my first email for other solutions and feedback, but then hit the send button too early..
My release is a standalone application, so a separate epmd-systemd unit is not important for me.
But you probably have a distributed solution with several releases/nodes per machine where this approach
clearly is superior.
Kind regards,
Dieter
Am Mi., Sept. 19, 2018 11:16 schrieb Tobias Schlager :
Hi Dieter,

we've been using Erlang releases with Systemd on CentOS for quite some time now. No critics here, I just want to seize the opportunity and point out the solution we use:

We compile Erlang/OTP ourselves using the '--enable-systemd' option. We package epmd as a separate RPM with a proper service file. In our own service files we do not rely on the rebar start scripts. Instead, we are using erlexec directly, e.g.

$ systemctl cat epmd.service
[Unit]
Description=Erlang Port Mapper Daemon
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/epmd
Restart=always
RestartSec=2
Type=simple
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

$ systemctl cat xxx.service
[Unit]
Description=xxx
After=epmd.service network-online.target
Wants=epmd.service

[Service]
Environment=BINDIR=/usr/lib64/xxx/erts-9.1/bin
Environment=COOKIE=xxx
Environment=VERSION=???
Environment=EMU=beam
Environment=ERL_MAX_PORTS=32768
Environment=PROGNAME=xxx
Environment=ROOTDIR=/usr/lib64/xxx
ExecStart=/usr/lib64/xxx/erts-9.1/bin/erlexec -boot ${ROOTDIR}/releases/${VERSION}/xxx -mode embedded -config ${ROOTDIR}/releases/${VERSION}/sys.config -name xxx -setcookie ${COOKIE} -noinput +K true
ExecStop=/usr/lib64/xxx/erts-9.1/bin/escript ${BINDIR}/nodetool -name xxx -setcookie ${COOKIE} stop
ExecStop=/bin/sh -c 'while $(kill -0 $MAINPID 2>/dev/null); do sleep 1; done'
WorkingDirectory=/usr/lib64/xxx
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target

Regards
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180919/9af0b8ac/attachment.htm>


More information about the erlang-questions mailing list