Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ft: notify-reload support #45

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

ft: notify-reload support #45

wants to merge 1 commit into from

Conversation

hauleth
Copy link
Owner

@hauleth hauleth commented Feb 11, 2025

  • ft: send monotonic timestamp when restarting
  • ft: rename auto_formatter to install_kmsg
  • feat: add support for notify-reload and automatic reload handling

@Munksgaard
Copy link

For us systemd newbies, what does notify-reload do?

@hauleth
Copy link
Owner Author

hauleth commented Feb 11, 2025

@Munksgaard It is new service type in systemd 253 that provides a way to have synchronous service reloads. In short it makes systemctl reload my-app.service. This change makes it that way that by default your application handles SIGHUP signals from the OS, and if there is such signal, then it will automatically run init:restart/0, but with some additional things to handle communication with systemd. So if you want to have soft-restart (without killing ERTS) this is the way.

Theoretically this code can also be changed to support stuff like hot-code reloads via systemctl reload, but as these require some additional work. I may implement that in the future, but for now it is set just to init:restart/0.

In short - now operator can decide between hard restart (systemctl restart) and soft-restart (systemctl reload) without touching Erlang codebase (assuming that systemd library is used).

@Munksgaard
Copy link

Interesting! What would I need to do to support this in my app?

@hauleth
Copy link
Owner Author

hauleth commented Feb 11, 2025

You mean the soft-restarts? When I will release this then the answer is - nothing. It will be supported out of the box.

For the hot code reloads - I have some ideas, but first I want to release 1.0, but before I can do that, I need to manage day to day work.

@Munksgaard
Copy link

Munksgaard commented Feb 11, 2025

That sounds amazing.

Thanks for the detailed answers, and thanks for the work you do on erlang-systemd ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants