Microservice (mservice)

Description

A descriptor for a console microservice that is started and maintained.
Started by one or several nodes at once. In case of crash - automatically restarts, but excludes cyclic restart (5 times in 10 seconds). If exceeded, the system forcibly disables the account.
Executed as a command line that can contain macros to substitute the domain, the URLs of the system webservers on the current site, and the path to the logs folder.
The command is executed in the working directory, where the attached zip archive (attachment) is unpacked beforehand. The archive may contain a script, an application or other files. The archive must be mandatory.

Limitations

  • The collection is not available in the master domain.

Fields

Entity structure
{
  "id": uuid,
  "name": str,
  "cmdline": str,
  "cmdparam": str,
  "enabled": bool,
  "attachment": file,
  "opts": {
    "title": str,
    "comment": str,
    "mode": str,
    "site_mode": str,
    "selected_sites": array<str>,
    "restart_mode": str,
    "heartbeat_timeout": str,
    "attachment_info": object
  },
  "ext": {
    "ct": date,
    "lwt": date
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: name
Mode: in
Type: str
Default: required

Title

Field: cmdline
Mode: in
Type: str
Default: required

Executable command.
May contain macros %WEBSERVERS%, %WEBSERVERS_EX%, %DOMAIN%, %LOGPATH%, %SERVERNAME%.

Field: cmdparam
Mode: in
Type: str
Default: required

Parameters to be added to the executable command.
May contain macros %WEBSERVERS%, %WEBSERVERS_EX%, %DOMAIN%, %LOGPATH%, %SERVERNAME%.

Field: enabled
Mode: in
Type: bool
Default: true

Activity Switch.

Field: attachment
Mode: in
Type: file
Default: empty

A property for loading an archive with the contents of the working directory. Basically contains an executable script or program.
The property is not present in the object itself, only the path to the endpoint is formed by it REST-API.
Information about the downloaded archive is available via opts.attachment_info.

Field: opts
Mode: in
Type: object
Composite field

Field: opts.title
Mode: in
Type: str
Default: empty

Arbitrary header

Field: opts.comment
Mode: in
Type: str
Default: empty

Arbitrary comment

Field: opts.mode
Mode: in
Type: str
Default: active-passive

Mode of operation within the site:

  • active-active. On all instances of the msvc role allowed to execute the microservice based on the specified section.

  • active-passive. Exactly one instance of the msvc role within the site.

Field: opts.section
Mode: in
Type: str
Default: empty

Section of role instances msvc on which this downloadable microservice is allowed to execute.
If no section is specified, the filter is not applied.

For each instance of msvc, multiple sections may or may not be specified at once in the configuration.

If there is none among the msvc instances in the current site that serves the specified section, then all msvc instances in the current site are allowed to serve the entity.

Field: opts.leader_mode
Mode: in
Type: str
Default: hashring

Mode for selecting a leader among the msvc instances allowed to execute this microservice given the specified section.
Applies only when the mode is selected active-passive.

It is performed by the key sorting method:

  • hashring. The key is a hash of the domain name, microservice, and node.

  • ordered. The key is the value of the 'order' configuration option of msvc instances. If not set, it is considered to be 0 (highest priority). For instances with equal priorities, hash sorting is applied.

Field: opts.site_mode
Mode: in
Type: empty
Default: "

Mode of operation between sites:

  • all. On all sites serving the domain.

  • selected. On the specified sites that serve the domain.

  • any. On any of the sites serving the domain.

Field: opts.selected_sites
Mode: in
Type: str or 'array<object>'
Default: empty

List of sites for mode site_mode='selected'.

Field: opts.restart_mode
Mode: in
Type: str
Default: permanent

Restart mode:

  • permanent. Restart after any completion.

  • transient. Restart only when the return code is non-zero.

  • temporary. It does not restart on completion.

Field: opts.heartbeat_interval
Mode: in
Type: int
Default: 5000

Notification interval for msvc role instance activity notification (500 - 60000 ms).
For the mode mode='active-passive'.

Field: opts.attachment_info
Mode: out
Type: object
Default: empty

Readable information about the uploaded attachment. The attachment itself is uploaded via the /attachment path in the REST-API.

Field: ext
Mode: inout
Type: object
Compound field

Allows you to extend the compound with arbitrary keys and values

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object