[erlang-questions] integrate rebar3 release and systemd

Tobias Schlager Tobias.Schlager@REDACTED
Wed Sep 19 11:15:43 CEST 2018


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



More information about the erlang-questions mailing list