-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reloading of units #17
Comments
IMO would be interesting to use Blake3 hashes for checking changed units but maybe that's taking things too far? |
Using hashes could lead to false positives, I think. Just because the file hash changed doesn't mean the unit changes in a meaningful way. Comments/Formatting can change without the unit having to be restarted |
Would be a nice feature, but complexity should be in mind. I like the small size and simple usage of rustysd... update |
Those exist already, with the exception of the last one. And adding the last one shouldn't be too tough |
The control interface is somewhat undocumented as of yet, this will need to change but there are some docs in here There is rsdctl in src/bin/ which can convert cli args into jsonrpc and send it to rustysd. |
Thanks. So it is used like I build the binaries and have:
You write about the binary size of 2MB? How to build smaller binaries? |
You mention walking the tree and ignoring unchanged units and restarting those that have changed. When a unit is restarted, are all of its dependents restarted as well? |
@MggMuggins That is an interesting question. If the socket files of a service change then potentially everything needs to be restarted. I will need to think about this some more |
@pwFoo Shutdown just shuts down rustysd (by killing all services), it's not a 'poweroff' command. The rsdctl works like this: 'rsdctl '. The argument can be a unit name for example. As for building smaller binaries look at the build script for the docker container. It involves stripping the binaries of unneeded symbols |
I am not sure how systemd handles this in their daemon-reload. From their doc:
Theres also a "ExecReload=" on services but nothing specific for reloading in sockets. Some questions that have to be answered before implementing this:
|
Some time ago I changed a systemd unit and get notified during restart that daemon-reload is needed to reload the changed configuration. But I think it reloads the files and NOT restart / reload the units...? a rustysd poweroff / reboot handling would be nice, but I don't know how it's done in systemd or busybox init... |
with systemd poweroff/reboot/suspend/hibernate is handled by systemd-logind which presumably tells systemd to shutdown all services and then shutdown linux |
rsdctl : [...] is required? And how to start rustysd web service? Or could it be possible to use a local socket to rustysd? Would be interesting how to "install" / enable a unitfile by command in the near future. |
Rustysd automatically listens on a unix socket and on a tcp socket for connections that send a jsonrpc call. rsdctl is just a convenient tool to send these commands, use whatever you like :) for example this should work: As for subdirs: rustysd scans the given unitdirs recursively for units so subdirs should be detected. I am not sure how that plays together with the dependencies? Rustysd currently does not manage unit files like systemctl does. Rustysd just takes the dirs it is given as is. If you want to take the 'link it in to enable' way it would probably be best to extend rsdctl to do so |
So there are some settings that can change while a unit is active (Like before/after/requires/...). But there are some that can't really like the ExecStart/ExecPrestart settings. For sockets there also exist settings in both categories. This seems very complicated. For your usecase it might even be easier to not use an overlay but to spawn a second instance of rustysd for the units that appear after mounting all drives. |
Maybe I move the mount part to /init and exec to rustysd with prepared drives. I'll do some tests. Thanks! |
So just reload all and add new units is missing? I would suggest to add it as simple as possible. |
Adding new units is supported. You just move the unit into the directory and say |
@pwFoo I just added loading of new units. |
Hi @KillingSpark,
|
You might wanna have look at the doc/ControlInterface.md that I wrote earlier today. |
Rustysd needs a control interface command that triggers a complete reload of all units, which integrates changed / new units into the running system.
Adding and activating new units should be done similarly to the initial startup by walking the dependency graph, but ignoring unchanged units. Changed units should be killed and restarted with the new configuration
Currently there is only support for adding new units one by one which is fine for manual enabling of services but not for automatically adding a bunch of services with dependencies between them.
The text was updated successfully, but these errors were encountered: