fvbock / endless

Zero downtime restarts for go servers (Drop in replacement for http.ListenAndServe)
MIT License
4.05k stars 342 forks source link

systemd init script #39

Open changwuf31 opened 7 years ago

changwuf31 commented 7 years ago

Hi, how to create a systemd init script for application using endless package ?

Thank you

klingtnet commented 7 years ago

The process is the same as for any other systemd service script except that ExecReload should be defined. You can probably copy and paste the example from the manual:

[Service]
...
ExecReload=/bin/kill -HUP $MAINPID
...
changwuf31 commented 7 years ago

@klingtnet Thank you

However, I'm using capistrano style deployment, and ExecReload together with WorkingDir does not work well, it's a hit and miss, sometimes it works, many times don't

klingtnet commented 7 years ago

That's strange, systemd should keep track of the processes new PID and the working dir should also be inherited from the forked process. Unfortunately, I don't have any experience with Ruby/capistrano, so good luck.