Snap app startup ordering

There is a need to add information about the order of start of services defined in a snap. The ordering information should map to After=... Before=... entries in autogenerated systemd *.service files.

The proposed syntax change in snap YAML is like this:

`name: wat
version: 42
apps:
 foo:
   daemon: forking
   start-after:
     - bar
     - zed
 bar:
   daemon: forking
   start-before: [foo]
 baz:
   daemon: forking
   start-after: [foo]
 zed:

We will validate if the services listed in start-after/start-before actually exist. Also, we’ll do some very simple dependency checks eg. foo has start-after: [bar] and bar has start-after: [foo] will cause an error. I do not think we should go as far as to verify the whole chain of transitive dependencies.

Given the example above, the generated *.service files will look like this:

# /etc/systemd/system/wat.foo.service
[Unit]
Description=Service for snap application wat.foo
...
After=.... wat.bar.service wat.zed.service

2 posts were merged into an existing topic: Snap services should get the ability to wait for other services