containers / quadlet

GNU General Public License v2.0
343 stars 14 forks source link

Support install #21

Closed alexlarsson closed 2 years ago

alexlarsson commented 2 years ago

Initial work for supporting the install group, fixing #20.

This seems to work, but hasn't been tested much yet and needs tests added.

alexlarsson commented 2 years ago

Added some tests.

I think we need to support some extension rewriting in the install section though. You probably want to be able to say that a container is WantedBy=other.container, which gets rewritten to other.service, for example.

XenGi commented 2 years ago

So me and @b-m-f had a look at your code, compiled it and went through some test cases on my server. It seems that this works pretty well.

The [Install] section with the WantedBy and RequiredBy keys is picked up correctly and symlinks are generated in the right places. Wanted and Required from the [Unit] section is automatically handled by systemd so I guess we don't need to fiddle with that. Dependency resolution is also done by systemd so I guess we don't need to do any checks if service files exist etc. No need to duplicate functionality that is already there. After a reboot everything is generated correctly and services bootup. We tested the effects of WantedBy and RequiredBy only indirectly by checking if the symlinks get created but that worked, so I guess it will work after a reboot too.

All my services now start on boot so I'm quite happy. Thx @alexlarsson for your work. Great job! Maybe I can buy you a beer sometime. ;)

XenGi commented 2 years ago

Your idea to rewrite extensions is fine. But honestly I wouldn't bother with that. From a users perspective it should be fine that you write your dependent container as mycontainer.service instead of mycontainer.container. We just have to make it clear in the documentation.

alexlarsson commented 2 years ago

Thanks for the testing.