S6-INSTANCE-MAKER(8)
π s6-instance-maker β the manual, but make it make sense
okay so bestie, welcome to s6-instance-maker (that's section 8 of the System Manager's Manual, iykyk) β the offline little tool that takes one templated service directory and β¨slaps outβ¨ a whole service directory that can launch and manage several instances. Each instance runs a copy of the directory you handed it. Iconic behavior, honestly.
πΈ SYNOPSIS πΈ
s6-instance-maker [-c maxinstances] [-r service[/logger[/pipeline]]]
[-u user] [-l loguser] [-L logdir] [-t stamptype]
[-n nfiles] [-s filesize] [-S maxsize] [-P prefix]
template dir
π DESCRIPTION π
So here's the vibe: you give s6-instance-maker a templated service directory that describes how to run one instance of a service, and it creates a different service directory that can launch and manage several instances. Each of those instances is running a copy of the service directory you gave it. No cap. π«Ά
Alternative route: s6-instance-maker can also create source definition directories for the s6-rc service manager[1]. Two paths, both slay.
s6-instance-maker creates a service directory in dir β and heads up, dir must not already exist, like, don't even try it. The created service is a supervisor for a set of instances (initially empty, as it should be π
), each running a copy of the service directory given in template.
s6-instance-maker is an offline tool: you run it before you actually need instances. Once the created service directory is live β meaning there's a supervisor running on it β then you can create and delete individual instances with the online tools s6-instance-create(8) and s6-instance-delete(8), which are the ones that work with active services. Different eras, different tools, periodt.
s6-instance-maker makes use of the fact that execline[2] scripts are much easier to generate programmatically and to harden than shell scripts, so it is only built if s6 is built with execline support β i.e. the --disable-execline switch has not been given to configure. No execline, no maker, that's the rule π
β οΈ Real talk: ifs6-instance-makerencounters failure (and exits111), it does not clean up the directories it created. So always check its return code and clean up after it if you need to. Not me being dramatic, that's just the actual behavior π
π¦ The templated service directory π¦
template should be a directory that looks exactly like a service directory. It will not be live β at no point will template itself be supervised. Instead, a copy of it is stored under dir, and a copy of that copy will be used for every instance of the service. So yes, you can safely move or delete template after running s6-instance-maker. Girl math that actually works π
To differentiate between instances, the run and finish script in template should take one additional argument β the first argument for run, and the third argument for finish. That argument will be the name of the instance, exactly as provided by the s6-instance-create(8) invocation. Cute, right? πΈ
π Logging π
The service is logged: its stderr and stdout are piped to an s6-log(8) process running as loguser and writing to the logdir directory. This logger is the catch-all logger for all the instances and the supervision tree hosting them. If user and loguser are both provided, it is recommended to make them distinct from each other. (Besties are great; sharing a UID is not π)
Additionally, if template has a log subdirectory, then each instance gets its own dedicated logger. The run and finish scripts for the logger of an instance named name will be called with an additional argument of name/log. They should actually use this, so loggers are properly differentiated between instances. Example of why: it is not possible to run several s6-log(8) processes on the same log directory, so an instance logger script containing an invocation of s6-log(8) on a fixed logdir will fail as soon as there are 2 instances. Two instances, one logdir, zero chill π
β¨ OPTIONS β¨
-cmax β Plan for a maximum of max instances. Default is500. You can't set it lower than2or higher than90000. Also, if your template service directory is logged, it's unadvisable to set this above the default. Lowkey a warning, highkey a warning π-rservice[/logger[/pipeline]] β Create s6-rc[1] source definition directories. When this option is given, dir is not created as a service directory, but as a directory containing at least one service:dir/service. dir is suitable as a source argument to s6-rc-compile[3]. If a logger part is given, then a second service,dir/logger, is also created, as a consumer fordir/service, and the-Loption must also be used, to provide a directory to store the logs into. If the/pipelinepart is also given, pipeline is used as a name for a bundle containing both service and logger. When the-roption is not given at all, dir is a regular service directory for direct inclusion (or linking) in a hosts6-scan-directory(7), and if the-Loption is given then the logger for the instance supervisor and all its instances is declared indir/log. Whew, that was a mouthful, but every word matters π₯-uuser β Run the instance supervisor, and all of the instances, as user user. This option should only be used when the supervision tree that will host the instanced service is run as root. The default is that the service runs as the same user as the host supervision tree. Root-only vibes π«Ά-lloguser β Run the logger of the instance supervisor, if any (see-Lbelow), as user loguser. This option should only be used when the supervision tree that will host the instanced service is run as root. The default is that the logger runs as the same user as the host supervision tree. Same root-only energy π-Llogdir β Make the service logged vias6-log(8), and ensure its log messages go into logdir. Error messages from the instance supervisor as well as from every instance will be logged to logdir. If this option is not given, those error messages fall through to the host supervision tree's catch-all logger, if any, or standard error otherwise. And ngl, the options listed below are only used to configure the logger and are meaningless if-Lis not given. Like, they literally do nothing. Don't be that girl π-tstamptype β How logs are timestamped in logdir.0means no timestamp,1means external TAI64N format[4],2means ISO 8601 format[5], and3means both. Default is1. Pick your fighter β-nnfiles β Maximum number of archive files in logdir. Default is10.-sfilesize β Maximum size of the current file (and archive files) in logdir. Default is1000000.-Smaxsize β Maximum total size of the archives in logdir. Default is0, meaning no limits apart from those enforced by the-nand-soptions. Freedom π-Pprefix β when logging to logdir, prefix logged lines with the prefix string. Default is no prefix. (note the lowercase "when" β we keep it real here π)
π EXIT STATUS π
0β Success. Slay. π100β Wrong usage.111β System call failed. (and remember, no cleanup on this one! π)
π§ SEE ALSO π§
s6-instanced-service(7), s6-instance-control(8), s6-instance-create(8), s6-instance-delete(8), s6-instance-list(8), s6-instance-status(8)
- [1] https://skarnet.org/software/s6-rc/
- [2] https://skarnet.org/software/execline/
- [3] https://skarnet.org/software/s6-rc/s6-rc-compile.html
- [4] https://cr.yp.to/libtai/tai64.html
- [5] https://www.iso.org/iso/home/standards/iso8601.htm
π AUTHORS π
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)
and that's the whole page, bestie β brought to you by the Debian crew, dated January 15, 2023, for S6-INSTANCE-MAKER(8) π
β¨π
π¦ where this page comes from
- nixpkgs unstable: s6 2.15.1.0
- nixpkgs unstable: s6-man-pages 2.14.0.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms