Open mark-rushakoff opened 7 years ago
@mark-rushakoff my feeling is that any service settings should belong to pleaserun
. I'll have to think about how that might get done, but i"m open to ideas :)
Once that happens, fpm's pleaserun support can be updated to enable it.
@mark-rushakoff This may be off topic, but my general process is to make programs tolerate dependency outages -- having systemd wait can be useful but it can be a more resilient design to have a program (in the parent ticket, collectd) do that waiting -- otherwise you can still lose data or have undesirable outcomes if influxdb crashes or is restarted by the operator while a dependency is online.
That said, I trust your thoughts on whether or not this works for influxdb and its users.
I'm happy to have whatever is needed to pleaserun and fpm. Extending pleaserun's systemd support to add flags for ExecStartPost and also Type=notify
should be pretty easy. If that's all you need, I can probably run with that and see how it goes.
@jordansissel I think having both ExecStartPost and Type=notify (plus NotifyAccess) offers a good path for any service to handle growing start times.
The story for us and anyone in a similar situation looks like:
ExecStartPost
is a good enough "quick fix" solution of a client polling until the service is readyIn https://github.com/influxdata/influxdb/issues/6068 @phemmer mentioned
And the perfect solution would be if influxdb supported systemd socket passing.
I haven't yet wrapped my head around systemd socket passing or why it's a better solution than socket notification.
It's just been brought to my attention that we are using a custom unit file already: https://github.com/influxdata/influxdb/blob/master/scripts/influxdb.service
We copy it in via the file system around here in the code: https://github.com/influxdata/influxdb/blob/c80c3636dd7bba6c3d0f3d6a1c321862da8f201a/releng/packages/fs/usr/local/bin/influxdb_packages.bash#L64-L109
So, I'm not sure what that means for this issue. For influxdb we no longer require further customization of the unit file via fpm or pleaserun. Maybe that feature would be useful to other fpm users, or maybe they would be better off taking the stock unit file generated by pleaserun and editing it by hand.
Cool! I'm happy y'all have this solved already, and I also agree this may still be useful feature for fpm/pleaserun.
I don't see a way with fpm or pleaserun to add an arbitrary line to the systemd unit file. I've looked through the issues here on GitHub, I've tried various searches, and I've looked through the code.
In our specific case, we're using fpm to package influxdb, and over at https://github.com/influxdata/influxdb/issues/6068, we have a request to enable notifying systemd when the server is ready to handle requests. Two options for that in the unit file include setting
ExecStartPost
to a script that blocks until the service is ready, or settingType=notify
and modifying our code to write to that socket when it's ready. The pleaserun service template doesn't have a place for us to add an arbitrary line.We would have the option to use the "
.d
drop-in directory" to extend the unit file, but that seems like incorrect packaging if we could emit the desired systemd unit file. If we were to use the drop-in directory, we would still need to place it in the right location, accounting for service name, symlinks, etc.What next steps would you recommend?