NethServer / dev

NethServer issue tracker
https://github.com/NethServer/dev/issues
63 stars 20 forks source link

List Systemd template units in module Status page #6892

Closed stephdl closed 3 months ago

stephdl commented 3 months ago

Install a module with systemd template based like ns8-webserver We create service based on a systemd template that you can find in the default.target.wants , unfortunately our get-status module action does not handle this case, either for rootless or rootfull

image

our systemd discovery just display the phpfpm@.service and not all other associated services


../systemd/user/
├── default.target.wants
│   ├── agent.service -> ../../../../../../etc/systemd/user/agent.service
│   ├── phpfpm@7.4.service -> /home/webserver2/.config/systemd/user/phpfpm@.service
│   ├── phpfpm@8.0.service -> /home/webserver2/.config/systemd/user/phpfpm@.service
│   ├── phpfpm@8.1.service -> /home/webserver2/.config/systemd/user/phpfpm@.service
│   ├── phpfpm@8.2.service -> /home/webserver2/.config/systemd/user/phpfpm@.service
│   ├── sftpgo.service -> /home/webserver2/.config/systemd/user/sftpgo.service
│   └── webserver.service -> /home/webserver2/.config/systemd/user/webserver.service
├── nginx.service
├── phpfpm@.service
├── sftpgo.service
├── transfer-state.target.wants
│   └── agent.service -> ../../../../../../etc/systemd/user/agent.service
└── webserver.service

Proposed solution

I propose to handle to find and retrieve when the service is created from a template systemd service and enabled to run

at the end I would like to display all associated services to this service

Alternative solutions

we have not a lot of choices, if a service is not running or fails to start we must be advised

Additional context

tested on core 2.5.4

See also

stephdl commented 3 months ago

QA The QA is to see if services are running , disabled, failed, you can stop container to see if the change is propagated (systemctl --user stop foo.service or systemctl -stop foo.service if rootfull)

install core 2.5.5-dev.2

curl https://raw.githubusercontent.com/NethServer/ns8-core/main/core/install.sh > install.sh
bash +x install.sh ghcr.io/nethserver/core:2.5.5-dev.2

go to the status page, the crowdsec template service crowdsec1@foo should be displayed, but probably not running nor enabled

DavidePrincipi commented 3 months ago
  • install ns8-crowdsec and simulate the use of rootfull systemd template service once crowdsec installed

If we do not have a real rootfull module to test consider this case as optional

DavidePrincipi commented 3 months ago

VERIFIED

DavidePrincipi commented 3 months ago

Released https://github.com/NethServer/ns8-core/releases/tag/2.5.5