Hello, I plan to give a 2-hour student-to-students lecture about s6/s6-rc in my school's LUG. Attached are related files for anyone interested (any suggestion is more than welcome):
* Init-RC-with-s6.txt: the outline I prepared for the lecture. (The outline is base on a my personal view of s6/s6-rc, and of course does not necessarily represent the opinion of anyone else.) * s6-conf.tgz: simplified example of s6 / s6-rc deployment, as discussed in the attached outline. The example was designed with Void Linux in mind, but should be reasonably adaptable to other Linux distros. I tested the setup in a virtual machine, and recommend you to also use a VM, or at least a non-critical machine. The scripts need bash and a few other GNU tools (sorry but I did not quite invest time on POSIXity). To use the tarball, login or su to root, extract the tarball keeping all permissions (with the `-p' option of tar(1)), make the `s6/distfiles' directory and download all needed (see `s6/scripts/pkg-inst.sh') release tarballs from skarnet.org into that directory, then follow HOWTO.txt and see the outcome. -- My current OpenPGP key: RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19) 7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C
1 Useful concepts
1.1 System initialisation
1.1.1 Chainloading
1.1.2 Properties of PID 1
1.1.2.1 Signal handling
1.1.2.2 exit() and exec()
1.1.3 Aside: history of init [init-hist]
1.2 Process supervision
1.2.1 Requirements [s6-ov]
1.2.1.1 Auto restart
1.2.1.2 Be itself supervised
# The need to be rooted in PID 1
1.2.2 Main choices
1.2.2.1 No supervision, or with PID files, or with
/etc/inittab and /etc/ttys
1.2.2.2 monit and supervisord; upstart and systemd
1.2.2.3 daemontools(-encore), runit, perp, s6 and nosh
1.2.3 Aside: the supervision mail list [sv-ml]
1.3 Notification without running a service [ftrig]
2 Anatomy of s6 / s6-rc
2.1 Supervision: s6-supervise and s6-svscan
2.1.1 Configuration and runtime control [s6-ov]
2.1.2 Readiness notification
2.2 RC: s6-rc
2.2.1 Chainloading and execline
2.2.2 Service directory deployment
2.2.3 Why no OR dependencies for now [or-dep]
2.3 Service logging
2.3.1 s6-svscan as init: the fd-holding black magic
2.3.2 s6-fdholder
# Restart of s6-fdholder [fh-restart]
2.3.3 s6-log and ucspilogd
# /dev/log: SOCK_STREAM and SOCK_DGRAM [log-dgram]
2.3.4 The good parts of "socket activation" [s6-sa]
2.4 The DJB legacy and the Plan 9 spirit
2.4.1 File system as the channel
2.4.2 library organisation, eg. buffer.h <-> bio.h
2.4.3 A glance at the source code
3 A simplified example of s6 / s6-rc deployment
3.1 "Refined" phases of init; "runlevel" emulation with s6-rc
3.2 emptyenv -p with setproctitle; dcron with nosetsid
3.4 Shuffling of fd in ucspilogd's ./run
3.3 Instanced supervision
# A hybrid of execline and shell? [el-hybrid]
3.5 Aside: comparison of init scripts [run-comp]
--
[el-hybrid] <http://skarnet.org/cgi-bin/archive.cgi?
2:msp:1131:jgoekjpfpjmfnefbkcob>
[ftrig] <http://skarnet.org/software/s6/ftrig.html>
[fh-restart] <http://skarnet.org/cgi-bin/archive.cgi?
2:mss:1107:klkgaflanpnghddcjfej>
[init-hist] <http://blog.darknedgy.net/technology/2015/09/05/0/>
<http://arxiv.org/pdf/0706.2748v2.pdf>
[log-dgram] <http://www.openwall.com/lists/musl/2015/08/10/1>
[run-comp] <http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/
run-scripts-and-service-units-side-by-side.html>
[or-dep] <http://skarnet.org/cgi-bin/archive.cgi?
2:msp:1063:blhpkmcfbdgbjkmbbckm>
[s6-sa] <http://skarnet.org/software/s6/socket-activation.html>
[s6-ov] <http://skarnet.org/software/s6/overview.html>
[sv-ml] <http://skarnet.org/lists.html>
s6-conf.tgz
Description: GNU Unix tar archive
