Detect plugin installation and trigger Puma restart
This is a follow up of https://community.theforeman.org/t/when-should-the-installer-restart-puma/26162
To recap the issue: when you install or update a plugin today, puma needs to be restarted to load the new code, but this only happens if the installer detects this situation.
The detection, today, only detects two cases: a plugin was installed by the installer or the plugin got updated via packaging and has a new migration available.
A lot of .z plugin updates don't carry new migrations, and thus go undetected and break things (like views that try to load files that are gone and similar)
In the above discussion, we came to the conclusion we should try to detect these cases better and trigger a puma restart.
There are different proposals, but all have one in common: a package installation/upgrade somewhow marks the system as "dirty" ("changed") and this can be used as a flag for the restart.
There is an interesting feature in systemd (https://fedoraproject.org/wiki/Changes/Restart_services_at_end_of_rpm_transaction) that could be used for that, but it only would work on EL9 and other "modern" installs, while we also need to support "legacy" systems like EL8.
So the probably best next thing would be to have packaging touch a file somewhere (rails tmp?) and the installer ensuring this file as absent with a notification towards the service definition, thus triggering a restart.
The file in rails tmp also could be used as a source for UI notifications about a needed restart.
Refs #34602 - drop restart_required_changed_plugins file on boot
The file indicates that new plugins were installed and we need to
#1 Updated by The Foreman Bot 11 months ago
- Assignee set to Evgeni Golov
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman-packaging/pull/7853 added
#2 Updated by The Foreman Bot 11 months ago
- Pull request https://github.com/theforeman/puppet-foreman/pull/1046 added
#3 Updated by The Foreman Bot 11 months ago
- Pull request https://github.com/theforeman/foreman-packaging/pull/7855 added
#4 Updated by The Foreman Bot 11 months ago
- Fixed in Releases 3.3.0 added
#5 Updated by Evgeni Golov 11 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset puppet-foreman|10bcb5cc1b783381b0a58771eecd264c5d38f5fc.
#6 Updated by Amit Upadhye 10 months ago
- Subject changed from detect plugin installation and trigger puma restart to Detect plugin installation and trigger Puma restart
Fixes #34602 - restart services after plugin installation