run_erl and systemd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

run_erl and systemd

Rynö Jouni (FMI)
Hi list

I have an odd systemd and run_erl issue. This service definition more
or less "works" on a "physical" machine, but not on a KVM-virtual
machine.

[Unit]
Description=My node
After=network.target

[Service]
Environment=RUNNER_LOG_DIR=/var/log/myapp
Type=forking
ExecStartPre=/bin/sleep 60
ExecStart=/proj/myapp/bin/myapp start
ExecStop=/proj/myapp/bin/myapp stop
RestartSec=20
Restart=on-failure
User=me
Group=me

[Install]
WantedBy=multi-user.target


epmd is running and I just try to start it via "systemctl start
my.service" from a command line

Plus I do get some odd inet_gethost and epmd died errors even in the
physical machine, but at least the run_erl starts at some point ...


Is there something, that I should do differently or add in the
environment?
Jouni

PS.somehow the init.d shell scripts were easier to debug ...

--
Jouni Rynö                            mailto://[hidden email]/
                                      http://space.fmi.fi/~ryno/
 Finnish Meteorological Institute     http://www.fmi.fi/
 Observation services                  
 P.O.BOX 503                          Tel      (+358)-29-5394656
 FI-00101 Helsinki                    FAX      (+358)-29-5395703
 Finland                              priv-GSM (+358)-50-5302903

md5sum(the Ultimate Question of Life, The Universe, and Everything) =
0000000000000000000000000000002A
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: run_erl and systemd

Ali Sabil
I tend to use `/proj/myapp/bin/myapp foreground` and avoid run_erl altogether.

On Tue, Oct 31, 2017 at 12:27 PM, Rynö Jouni (FMI) <[hidden email]> wrote:
Hi list

I have an odd systemd and run_erl issue. This service definition more
or less "works" on a "physical" machine, but not on a KVM-virtual
machine.

[Unit]
Description=My node
After=network.target

[Service]
Environment=RUNNER_LOG_DIR=/var/log/myapp
Type=forking
ExecStartPre=/bin/sleep 60
ExecStart=/proj/myapp/bin/myapp start
ExecStop=/proj/myapp/bin/myapp stop
RestartSec=20
Restart=on-failure
User=me
Group=me

[Install]
WantedBy=multi-user.target


epmd is running and I just try to start it via "systemctl start
my.service" from a command line

Plus I do get some odd inet_gethost and epmd died errors even in the
physical machine, but at least the run_erl starts at some point ...


Is there something, that I should do differently or add in the
environment?
Jouni

PS.somehow the init.d shell scripts were easier to debug ...

--
Jouni Rynö                            mailto://Jouni.Ryno@.../
                                      http://space.fmi.fi/~ryno/
 Finnish Meteorological Institute     http://www.fmi.fi/
 Observation services
 P.O.BOX 503                          Tel      <a href="tel:%28%2B358%29-29-5394656" value="+358295394656">(+358)-29-5394656
 FI-00101 Helsinki                    FAX      <a href="tel:%28%2B358%29-29-5395703" value="+358295395703">(+358)-29-5395703
 Finland                              priv-GSM <a href="tel:%28%2B358%29-50-5302903" value="+358505302903">(+358)-50-5302903

md5sum(the Ultimate Question of Life, The Universe, and Everything) =
0000000000000000000000000000002A
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: run_erl and systemd

Alexander Petrovsky-2
Hi!

Looks like you observe very strange behaviour, we run our erlang release in OpenStack ubuntu instance, with follow systemd config and everything works fine:

[Unit]
After=network.target remote-fs.target
Requires=network.target remote-fs.target

[Service]
Type=forking
TimeoutStartSec=0
Restart=always
RestartSec=5
Environment=HOME=/root
ExecStart={SCRIPT} start
ExecStop={SCRIPT} stop

[Install]
WantedBy=multi-user.target

Note that run_erl complain when HOME var is not defined. Also, I suggest try to get rid of User and Group.

2017-10-31 12:52 GMT+03:00 Ali Sabil <[hidden email]>:
I tend to use `/proj/myapp/bin/myapp foreground` and avoid run_erl altogether.

On Tue, Oct 31, 2017 at 12:27 PM, Rynö Jouni (FMI) <[hidden email]> wrote:
Hi list

I have an odd systemd and run_erl issue. This service definition more
or less "works" on a "physical" machine, but not on a KVM-virtual
machine.

[Unit]
Description=My node
After=network.target

[Service]
Environment=RUNNER_LOG_DIR=/var/log/myapp
Type=forking
ExecStartPre=/bin/sleep 60
ExecStart=/proj/myapp/bin/myapp start
ExecStop=/proj/myapp/bin/myapp stop
RestartSec=20
Restart=on-failure
User=me
Group=me

[Install]
WantedBy=multi-user.target


epmd is running and I just try to start it via "systemctl start
my.service" from a command line

Plus I do get some odd inet_gethost and epmd died errors even in the
physical machine, but at least the run_erl starts at some point ...


Is there something, that I should do differently or add in the
environment?
Jouni

PS.somehow the init.d shell scripts were easier to debug ...

--
Jouni Rynö                            mailto://Jouni.Ryno@.../
                                      http://space.fmi.fi/~ryno/
 Finnish Meteorological Institute     http://www.fmi.fi/
 Observation services
 P.O.BOX 503                          Tel      <a href="tel:%28%2B358%29-29-5394656" value="+358295394656" target="_blank">(+358)-29-5394656
 FI-00101 Helsinki                    FAX      <a href="tel:%28%2B358%29-29-5395703" value="+358295395703" target="_blank">(+358)-29-5395703
 Finland                              priv-GSM <a href="tel:%28%2B358%29-50-5302903" value="+358505302903" target="_blank">(+358)-50-5302903

md5sum(the Ultimate Question of Life, The Universe, and Everything) =
0000000000000000000000000000002A
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions




--
Петровский Александр / Alexander Petrovsky,

Skype: askjuise
Phone: +7 931 9877991


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: run_erl and systemd

Tobias Schlager-2
In reply to this post by Rynö Jouni (FMI)
Hi Jouni,

we dropped the relx/rebar start script altogether and are now using erlexec directly in our service files. See [1] for an example. It has the drawback that you must set all environment variables needed by the emulator yourself.

Regards
Tobias Schlager

[1] https://github.com/lindenbaum/http2smtp/blob/master/config/http2smtp.service.template
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions