The directives we got most use in org are probably Restart* family and RequiresMountsFor, althought the last one is more and more common in distro packages so it is not even needed that often. The usecase being "don't start DB if mount fails" usually.
Overrides are probably the most used feature overall, we often find that the standard distro unit just needs a little bit of tweaking for our purpose (like adding restart), so we just create file /etc/systemd/system/servicename.service.d/01-restart.conf with
[Service]
Restart=always
RestartSec=30
and voila, service now auto-restarts and that behaviour won't break when package updates, as we're not changing any package file. The few other modifications of existing ones included adding new read-write dirs or adding env variables for proxy.Technically you can even go as far as making services into little containers with all the options for limiting permissions but I haven't got that far. Most apps don't exactly need it either, have readonly/readwrite dir + some limits and it is pretty safe out of the box, I've also noticed many distro packages going that way.
* [1] https://devrandom.eu/blog/post/2022-02-27_increasing_system_...
* [2] https://www.freedesktop.org/software/systemd/man/systemd.exe...
* [3] https://www.freedesktop.org/software/systemd/man/systemd.uni...
* [4] https://www.freedesktop.org/software/systemd/man/systemd.ser...
And, uh, shove the queue size parameter there instead of
using feature designed to run multiple instances as a poor man's way to configure stuff. Let's just say nothing will stop you from also doing and systemd will just try to start the sidekiq twiceThe article's proposed way of using templates is TERRIBLE. I had assumed from the title it will show off how to run multiple instances using same template units (say to vary a run dir or whatever), but no, it is using them as glorified config file for number of threads/db conns. Just shove that into env file, you can use env parameters in rest of the file too...