4 :revdate: {sys:date "+%Y-%m-%d %H:%M:%S"}
10 overlay-boot - Start a subhost with overlay root filesystem.
18 *overlay-boot* is the main script on a small collection of
19 administration scripts for containerizing services with minimal ado.
20 The script starts a "subhost" with a dedicated network namespace, and
21 the mount and pid namespaces separated from the main host by means of
22 +unshare+. A subhost root file system may in particular be set up as
23 an overlay of the main host filesystem to keep the specifics of a
24 service distinctly separate from the main host while sharing files
27 A subhost is started by identifyinf its configuration file on the
28 command line for *overlay-boot*. The configuration file is a plain
29 text file with a small collection of "variables" that tell how the
30 subhost is set up. When all is good, *overlay-boot* spawns a
31 subprocess that invokes a command shell within an chroot into
32 "unshared" subhost root filesystem, all similar to the bootup of any
35 The subhost execution environment may be "entered" to perform
36 adminstrative tasks with *overlay-go*, and it is later stopped with
42 An overlay-boot subhost is defined in the configuration file, which is
43 a plain text file with a number of variable assignments. Each
44 assignment is written with the varable name flush left and immediately
45 followed by an equal sign, The rest of that line (ignoring leading and
46 trailing spaces) is its value, or if that value startes with an
47 exclamation mark, then the line is a command to run so as to generate
48 the value. See examples below.
52 This variable declares a short name for the subhost, and should be no
53 more than 12 printable ascii characters. The base name of the
54 configuration file is used by default. I.e., a configuration file
55 named +foo.conf+ by default names its subhost +foo+ unless there is a
56 +NAME+ variable says differently.
60 This variable declares a pathname for a directory that is considered
61 to be a "base" for the subhost setup. This is the only required
66 This variable declares the subhost networking in terms of its virtual
67 cables. The value is a space separated list of "virtual cable
68 specifiers", each consisting of an equal sign optionally with a bridge
69 name to the left and optinally a MAC address to the right. See the
70 section on Networking below for more details.
74 This variable is a command line to run, with envirnment variable
75 CONFIG set, for producing the initial commands to the running subhost,
76 similar to the initrd phase of a computer bootup. The default value
77 for this variable is +overlay-init+.
81 This variable nominates the mount point for the running subhost's root
82 file system. It defaults to +$BASE/live+ The nominated directory must
83 exist, and depending on the directory pathnames in the +UPPER+ and
84 +LOWER+ variables, the subhost root filesystem is either of a
85 pre-mounted directory, bind mounted or overlay mounted directory. See
86 the details of this with the UPPER variable below.
90 This variable nominates the logfile to use by +overlay-boot+ when
91 running the subhost. The default is +/tmp/overlay-$NAME.log+.
95 This variable nominates the "lower" filesystem of an overlay mount.
96 This will be accessed read-only, an it is intended to be the operating
97 system root file system. The default is +/+, i.e. the main host root
98 filesystem. When overlay is not desired, then LOWER should be the smae
103 This variable is a command line to run, with envirnment variable
104 CONFIG set, just after the setup of the subhost root filesystem and
105 before the services are started. The default for this variable is
110 This variable is a command line to run, with envirnment variable
111 CONFIG set, just before the setup of the subhost root filesystem and
112 before the services are started. The default for this variable is
117 This variable nominates the "upper" filesystem for an overlay mount.
118 This will be accessed read-write and it constitutes the "private"
119 files of the subhost.
121 If UPPER is different from LOWER, then the root file system is set up
122 as an overlay mount. In that case WORK (below) must be defined as a
123 directory outside of but on the same mount as UPPER.
125 If UPPER is the same as LOWER, then the subhost root filesystem is not
126 setup as an overla. Rather it is set up as a bind mount, if UPPER is
127 different from LIVE, or just as a pre-mounted LIVE filesystem.
131 This variable nominates the "work" directory for an overlay mount. It
132 has to be a writable directory on the same mount device as the UPPER
137 This variable tells which services should be started on the
138 overlay-boot startup. The default value is +networking ssh+.
140 Note that if no services are started, then +overlay-init+ starts a
141 +dummy_service+ so as to keep +/.reaper+ from running out of child
142 processes, as it otherwise will exit and thereby terminate
147 This variable may be used to configure the +/run+ directory which by
148 defult gets mounted on an overlay mount as a +tmpfs+ of 50M. Use
149 +none+ to avoid that mount, and otherwise the desired +tmpfs+ size.
154 *overlay-boot* sets up a nework namespace named by the subhost NAME,
155 and uses the CABLES variable to set up +veth+ virtual cables. The host
156 end of such cables are named by NAME followed by a number from 0 and
157 up while the subhost end are named by +eth+ followed by the same
160 As mentioned above, CABLES consists of a space separated list of cable
161 specifiers, each consisting of a bridge interface name and a with an
162 equal sign ("=") between them. The equal sign is required while either
163 or both of the bridge and MAC address may be left empty.
165 The bridge interface name, if given, will be given control of the host
166 end cable interface. A cable specification with empty bridge name part
167 results in that the host end is brought up at link level and then
168 +ifup $IF+ is attempted.
170 The MAC address, if given, is used for the subhost end cable
171 interface. A cable specification with empty MAC address part results
172 in that the interface get its MAC address from the kernel, possibly a
173 different one upon each start.
178 ./opt/subhost/mta/mta.conf
181 START= rsyslog newtorking ssh postfix
184 The above example assumes a directory +/opt/subhost/mta+ that contains
185 the configuration file +mta.conf+ and directories +root+, +work+ and
186 +live+. *overlay-boot* will set up an overlay mount on +live+ with
187 +root+ as UPPER, +work+ as WORK and +/+ as LOWER, i.e. an overlay of
188 the main host filesystem.