PelionIoT / distro-pelion-edge

Scripts for generating pelion-edge deb (Ubuntu) installer
Apache License 2.0
1 stars 2 forks source link

add pelion multi-service unit file #134

Closed costanic closed 2 years ago

costanic commented 3 years ago

this allows a user to control all pelion edge services together

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#PartOf=

costanic commented 3 years ago

This is an alternative implementation of https://github.com/PelionIoT/distro-pelion-edge/pull/129. This PR is implemented only with systemd features, whereas the other PR is implemented by a custom bash script. One thing I don't like about this implementation is the output of status because it only shows the status of the single pelion service and not the status of all other pelion services like the custom script in https://github.com/PelionIoT/distro-pelion-edge/pull/129.

$ systemctl status pelion.service ● pelion.service - Pelion Edge Multi-Service Systemd Control Loaded: loaded (/lib/systemd/system/pelion.service; enabled; vendor preset: enabled) Active: active (exited) since Wed 2021-03-31 14:02:14 GMT; 2h 3min ago Process: 11653 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 11653 (code=exited, status=0/SUCCESS)

The user can view a list of dependencies with systemctl list-dependencies pelion.service, but I find this less useful because I can't easily use it to show the status of all (and only) pelion services.

$ systemctl list-dependencies pelion.service pelion.service ● ├─devicedb.service ● ├─edge-core.service ● ├─edge-proxy.service ● ├─kubelet.service ● ├─maestro.service ● ├─pelion-relay-term.service ● ├─system.slice ● ├─wait-for-pelion-identity.service ● └─sysinit.target ● ├─apparmor.service ● ├─dev-hugepages.mount ● ├─dev-mqueue.mount ● ├─keyboard-setup.service ● ├─kmod-static-nodes.service ● ├─proc-sys-fs-binfmt_misc.automount ● ├─resolvconf.service ● ├─sys-fs-fuse-connections.mount ● ├─sys-kernel-config.mount ● ├─sys-kernel-debug.mount ● ├─systemd-ask-password-console.path ● ├─systemd-binfmt.service ● ├─systemd-hwdb-update.service ● ├─systemd-journal-flush.service ● ├─systemd-journald.service ● ├─systemd-machine-id-commit.service ● ├─systemd-modules-load.service ● ├─systemd-random-seed.service ● ├─systemd-sysctl.service ● ├─systemd-sysusers.service ● ├─systemd-timesyncd.service ● ├─systemd-tmpfiles-setup-dev.service ● ├─systemd-tmpfiles-setup.service ● ├─systemd-udev-trigger.service ● ├─systemd-udevd.service ● ├─systemd-update-utmp.service ● ├─cryptsetup.target ● ├─local-fs.target ● │ ├─-.mount ● │ ├─systemd-fsck-root.service ● │ ├─systemd-remount-fs.service ● │ └─vagrant.mount ● └─swap.target ● └─dev-disk-by\x2duuid-494adc4f\x2d2e8f\x2d4b72\x2d9583\x2d120d7343ef5f.swap

ryannowarm commented 3 years ago

The user can view a list of dependencies with systemctl list-dependencies pelion.service, but I find this less useful because I can't easily use it to show the status of all (and only) pelion services.

Looks like there's a recent systemd issue for this. See that some possible workarounds.

ryannowarm commented 3 years ago

This whole conversation makes me realize I know nothing about systemd

costanic commented 3 years ago

My main criticism with the behavior of this patch is that when systemctl status is run, it only shows status of the one pelion.service but I want to see status of all pelion services. I can see a list of dependent services, by running systemctl list-dependencies, but this shows tons of other implicit dependencies. However, @ryannowarm mentioned maybe using a target instead of a service, and I think this section in particular might be a good reason to try it. Let me restructure this as a target and so some more testing.