Hi,

as discussed at [1], in order to break up the discussion of the proposed
configuration specification for Rumprun [2] into manageable pieces, I'll be
posting a series of threads covering the top-level configuration
blocks.

In this first thread, I'm folding "rc" and "env" into the same discussion
as they are related, and "hostname" because, well, nothing to see here :-)

## rc: Program invocation

    "rc": [
         {
             "bin": <string>,
             "argv": [ <string>, ... ],
             "runmode": "" | "&" | "|"
         },
         ...
    ]

Each element of _rc[]_ describes a single program invocation. Programs are
invoked in the order in which they are defined in _rc[]_.

If no _rc_ key is specified in the configuration, only the first binary
baked into the unikernel will be invoked, with _argv[]_ set to `[ "rumprun" ]`.

* _bin_: Determines the name of the binary baked into the unikernel to
  invoke.
* _argv[]_: Argument list passed to program. At a minimum, a single string
  is required, which will be passed to the program as _argv[0]_.
* _runmode_: Defines how the program will be invoked. _Optional_
  * `<empty>`: (_default_) run program in foreground and wait for it to exit
    successfully before running any further programs.
  * `&`: run program in background.
  * `|`: pipe output of program to next defined program.

Comments incorporated (but not yet implemented on the branch) from previous
discussion:

- _args[]_ is renamed to _argv[]_. _argv[]_ is the entire argument list,
  and at least _argv[0]_ is required.
- _bin_ is used as a discriminator to select which multibaked binary to
  invoke. This drops the coupling between "order binaries are baked into
  the image" and "order they are specified in rc" -- I still need to do the
  work to implement this and associated changes to rumpbake.

## env: Environment variables

    "env": {
        <key>: <value>,
        ...
    ]

* _env_: Each _key_/_value_ pair of strings sets the environment variable
  `<key>` to `<value>`.

- Note that duplicate keys are de facto disallowed, as a valid JSON object
  does not have duplicate keys. In any case, the config implementation does
  check and will error if a duplicate is found.

Open issues:

- Justin Cormack mentioned that the "env" key should be made "per-process",
  i.e. each "rc" entry should have it's own "env" subkey.

  I don't this this is possible or desirable as:

  a) The environment is a libc construct, so it's not applicable to e.g.
  kernonly mode.
  b) An "rc" invocation is not a "process" and as such does not have it's
  own address space. The environment is a global construct in libc, thus
  cannot be made "per-process" in rumprun without patching libc which we
  want to minimize.
  c) Related to b), if it ain't a "process", from a UX PoV best not to
  introduce constructs which make it look like one.

## hostname: Kernel hostname

    "hostname": <string>

* _hostname_: Sets the hostname returned by the `gethostname()` call.

- Nothing controversial here ...

Comments?

[1] 
http://www.freelists.org/post/rumpkernel-users/RFCPULL-Rumprun-configuration-specification-and-rototill,13
[2] 
https://github.com/rumpkernel/rumprun/blob/mato-wip-rumprun-config/doc/config.md

Reply via email to