66

Software

obarun.org

Module service creation

A module is an instantiated service. It works the same way as a service frontend file but allows the user/admin to configure a set of different kind of services before executing the parse process. Also, the set of services can be configured with the conjunction of a script called configure which can be made in any language.

This allows one to pre-configure a set of parameters or other services for special tasks without knowing the exact target of the module. The best example is the module for booting a machine. Each machine is different and the set of services need to be adaptable as much as possible for different kinds of machines during boot; e.g booting a container.

Additionally, a service of type ‘module’ can be likened to a sandbox. Services within a module are isolated from those outside it, and vice versa. For example, you cannot have a service within a module depending on a service outside the module, and vice versa. The isolation ensures that there is no interdependency between services inside and outside the module.

A module is defined with two elements:

Frontend file

The instantiated frontend service is written as any other instantiated service with its own specification—see the section [regex].

Module directory

The module directory have the following structure:

.
├── activated
│   ├── depends
│   └── requiredby
├── configure
│   └── configure
├── frontend
└── module_frontend_file

The frontend file of the module itself must be present at the root of the module directory.

Any services that you need must be present inside the frontend directory. The parser only deals with these directories. If a service fooA has fooB as dependency, fooA and fooB must exist in the e.g. /usr/share/66/service/<module_name>/frontend directory.

A word about the [main] section with the module type

The valid fields in section [main] are:

All other fields from [main] section are not allowed.

Module process creation

The name foo@ will be used in this explanation as a module name.

When you do e.g. 66 parse foo@system:

Environment variable passed to the script configure

At launch of the script configure, the parser passes the following variables to the environment: