Discussion:
Ann: vera 1.2 released
(too old to reply)
Sam
2024-07-30 23:30:05 UTC
Permalink
vera is an alternative init daemon supervisor (PID 1) that uses kernel
control groups (lightweight containers). Containers allow reliable,
foolproof shutdown and termination of started services. vera was developed
on Slackware 15.0. It is capable of booting and shutting down a stock
installation of Slackware 15.

https://github.com/svarshavchik/vera/releases/tag/1.2

This release implements an additional "Requires-First" dependency between
containers, this helps in implementing the proper order for starting
multiple containers.

But the major new feature is the integration of cgroup v2 controllers,
making it possible to enforce various resource limits, like specifying the
maximum number of processes, or maximum memory used by each container.
Henrik Carlqvist
2024-07-31 05:49:25 UTC
Permalink
Post by Sam
This release implements an additional "Requires-First" dependency
between containers, this helps in implementing the proper order for
starting multiple containers.
I must admit that I haven't tried vera myself, but being used to write
Makefiles describing dependencies I wonder why there is a need for
"requires-first" which cannot be fulfilled by "requires"?

If something called C has requirements for some things called A and B to
be done before C can be started C usually don't care in which order A and
B was started. If that order was important it probably means something
like that B has a requirement that A is started before B.

Looking at the changelog in github it seems that you have been able to
remove a number of "requires", e g system/inittab/io no longer requires
system/boot as system/graphical nor requires-first system/boot. But is it
really true that system/inittab/io no longer would require system/boot if
those with system/boot in requires-first would not have been started?

regards Henrik
Sam
2024-07-31 12:39:09 UTC
Permalink
Post by Henrik Carlqvist
Post by Sam
This release implements an additional "Requires-First" dependency
between containers, this helps in implementing the proper order for
starting multiple containers.
I must admit that I haven't tried vera myself, but being used to write
Makefiles describing dependencies I wonder why there is a need for
"requires-first" which cannot be fulfilled by "requires"?
Requires: [a, b, c]

Means that this unit requires a, b, and c to be started. In absence of any
other defined dependency, both a, b, and c can be started simultaneously.

Requires-First:
- a

Requires: [b, c]

Still means that both a, b, and c must be started, but b and c will be
started only after a is fully started.

You can, of course, define this dependency explicitly, by adding

Starts:
After: a

In both b and c (or Requires: a, explicitly, in both b and c) and spell it
out. A Requires: declaration only declares that the required units must be
started, it does not specify their relative starting order.
Post by Henrik Carlqvist
Looking at the changelog in github it seems that you have been able to
remove a number of "requires", e g system/inittab/io no longer requires
system/boot as system/graphical nor requires-first system/boot. But is it
really true that system/inittab/io no longer would require system/boot if
those with system/boot in requires-first would not have been started?
Precisely. Slapping a "Requires: system/boot" on everything gets really old.

Instead, there's now a single definition in system/multi-user:

name: multi-user
description: processes for runlevel multi-user
required-by:
- 'runlevel multi-user'
stopping:
type: target
requires-first:
- boot
version: 1

(also graphical, and all other runlevels).

Now, anything that has a "Required-By: /system/multi-user" will inherit
this. A Required-By: is Required: in opposite direction, it's logically
equivalent to a "Required: " declaration in system/multi-user.

So, you don't need to remember to specify that your container must wait
until system/boot is done. Just enable it for system/multi-user. That's the
TLDR: I was trying to figure out a simple way to automatically force the
right starting order by declaring it just once, somehow. This dependency
wasn't obvious to me until I added more stuff to system/boot, and saw that
the rest of the stuff wasn't waiting for system/boot to finish. Initially I
added a explicit requirement on every unit, telling it to wait until
system/boot finishes. But I didn't like that approach, and came up with this
solution.
Henrik Carlqvist
2024-07-31 18:15:01 UTC
Permalink
This dependency wasn't obvious to me until I added more stuff to
system/boot, and saw that the rest of the stuff wasn't waiting for
system/boot to finish. Initially I added a explicit requirement on every
unit, telling it to wait until system/boot finishes. But I didn't like
that approach, and came up with this solution.
Thanks for the explanation! Such a solution makes sense where some
targets are "end targets" and can point out requires-first and those
other "middle targets" never will be the end goal of for the system.

This is unlike a Makefile which even though its main purpose might be to
build an executable it is also possible to call make to only compile a
single object file.

regards Hnerik
Sam
2024-07-31 23:41:53 UTC
Permalink
Post by Henrik Carlqvist
This dependency wasn't obvious to me until I added more stuff to
system/boot, and saw that the rest of the stuff wasn't waiting for
system/boot to finish. Initially I added a explicit requirement on every
unit, telling it to wait until system/boot finishes. But I didn't like
that approach, and came up with this solution.
Thanks for the explanation! Such a solution makes sense where some
targets are "end targets" and can point out requires-first and those
other "middle targets" never will be the end goal of for the system.
This is unlike a Makefile which even though its main purpose might be to
build an executable it is also possible to call make to only compile a
single object file.
Well, the analogy still holds, mostly. "init <runlevel>" sort of "builds" an
entire runlevel, but you can still run individual rc.* scripts manually,
that is "build" a single service.

Ditto here, too. If you're in runlevel 3, "init 4" starts everything, like
sshd and httpd, together. But one can manually stop and start sshd by
running the corresponding rc script.

With a -j flag make is going to build all dependencies in parallel.

Same here: with multiple "Requires:" vera starts all dependencies
concurrently. Additional dependency definitions – Starts/Before|After, (and
Stops/Before|After) disable (some amount of) concurrency – and impose an
explicit order between different units' relative starting and stopping order.

Requires-First: is just a shortcut for defining additional Starts/After
dependencies automatically.

Additionally, both "Requires-First" and "Requires:" is also a shortcut. The
requiring dependency Starts/After the required dependency, so the required
dependency gets started first, then the main, requiring dependency. And the
implicitly-generated starting dependencies get combined with explicitly
defined ones to work out the exact order of who goes first. The analogous
process also works out the relative stopping order.

Loading...