hauleth / erlang-systemd

systemd utilities for Erlang applications
Apache License 2.0
174 stars 19 forks source link

When you say "ExecStart=/path/to/my_app start" do mean something like /rel/share3/bin/share3 start? #34

Open mattiasw2 opened 2 years ago

mattiasw2 commented 2 years ago

Where

/rel/share3/bin/share3 start

is created using "rebar3 release".

I never got this to work, get some protocol error when I do "systemctl start share3"

Using ubuntu 20.04 with Erl22.

hauleth commented 2 years ago

What kind of error? Can you paste that error? And yes, I mean't the path to your release binary runner.

mattiasw2 commented 2 years ago

Made a tiny test project at https://github.com/mattiasw2/systemdtest/tree/main/systemdtest which only creates 2 log file entries.

mattiasw2 commented 2 years ago

Could it be that erlang is installed using snap?

hauleth commented 2 years ago

Could you publish the unit file as well?

mattiasw2 commented 2 years ago

What is the unit file? Do you mean the unit referred to in journalctl? The only meaningful error message is

systemdtest.service: Failed with result 'protocol'.
hauleth commented 2 years ago

In your case systemdtest.service.

And the error seems peculiar. I will take a closer look into it. Can you also give me version of your systemd installation?

mattiasw2 commented 2 years ago

The .service file is also on git.

On Wed, Mar 30, 2022 at 5:20 PM Łukasz Jan Niemier @.***> wrote:

In your case systemdtest.service.

And the error seems peculiar. I will take a closer look into it. Can you also give me version of your systemd installation?

— Reply to this email directly, view it on GitHub https://github.com/hauleth/erlang-systemd/issues/34#issuecomment-1083275874, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ4EU4ERIKFTZTOWXKB563VCRWNJANCNFSM5R27XI3A . You are receiving this because you authored the thread.Message ID: @.***>

mattiasw2 commented 2 years ago

Would really be nice if someone could tell me what's wrong with this app. Is it the systemd:notify(ready), that is in the wrong place or...

mattiasw2 commented 2 years ago

I can get this simple systemd file to work, the most important change it to use Type=simple, which is good enough for me, since Erlang so stable.

Description=My Awesome App
After=network.target

[Service]
User=root
WorkingDirectory=/root/data7/systemdtest/systemdtest/_build/default/rel/myrel
Type=simple
ExecStart=/root/data7/systemdtest/systemdtest/_build/default/rel/myrel/bin/myrel daemon
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
hauleth commented 2 years ago

I have longer weekend now so I will try to handle that this weekend. Sorry, I was occupied with my day job and I had little time to spare on this one.