Middleware (mware)
Description
Provides data transfer functions between internal services within a site, as well as operational correctness control.
Split into microservices by domains. Provides automatic synchronization between sites serving the domain.
Made redundant in Active-Passive mode. Scaled by splitting the domain tree.
Services and responsibilities:
- Administrator bot in messengers: system health notifications and commands (more).
- Support for sipuser accounts configured to work without registration.
- Call control via API (callmanager) (Calls, Conferences).
- Device control via API (devicemanager) (/api/devicemanager/v1/…)
- Service for publishing role applications.
- Service for running service scripts on a schedule. (Service tasks).
- Critical section service (script component "Mutex" etc.).
- PostgreSQL streaming replication controller. (More about setup below, the 'pg_controller' parameter)
- Backup creation controller. (More about setup below, the 'backup_controller' parameter).
- Domain hot standby controller.
- ACME LetsEncrypt SSL certificate auto-generation service (more about setup).
- Global name monitoring.
- MEGACO connection state monitoring between MGC and MG.
- Health monitoring of the FSYNC file synchronization service.
- Service for distributing telephony provider accounts across ESG microservice instances.
- User password recovery service (more).
- Service for sending invitations to new users (more).
- Self-registration service (more).
- Service for registration during OAuth authorization (more).
- Syslog event collection and SNMP trap sending service (more about setup).
- Common product-layer microservice log collected from standard output messages.
- Conversation recording transcription service (more about setup).
- UDP packet mirroring test service.
- Service for registering callback requests (script component "Callback request" etc.).
- Service providing email_to_fax functionality.
- Service for tracking subscribers called via Hunt numbers and personal queues.
- Cache of external numbers whose states must be tracked (more about setup).
- CTI event provider service, including a supervisor of adapter servers for supporting various protocols.
- Availability monitoring of sg microservices with automatic removal of related WebSocket registrations (WebRTC softphones) and TLS registrations when they are lost.
Code |
|
Operation mode |
|
Redundancy mode |
|
Site types |
|
Layer |
|
Placement |
|
State preservation and recovery on restart |
|
Application |
|
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
|
|
required |
Name. May consist of Latin letters and digits and must start with a letter. |
|
|
required |
Role type. Possible values: |
|
|
empty |
Additional role options. Contains a JSON object or list. |
|
|
empty |
Role activity flag. When set to false, the role does not participate in validation and is not started. |
|
|
empty |
Limit on the number of CPU logical cores used. Default: 0 - unlimited. |
|
|
empty |
Default logging level set specifically for the role instance (microservice type). More |
|
|
|
Flag allowing parameter differences in roles of the same group. Default: false - not allowed. |
|
|
required |
Group number. Currently, a number of master services run within the mware role. This imposes a limitation on horizontal splitting capabilities (roadmap). |
|
|
required |
Order of the role instance within the group. |
|
|
empty |
List of domain names served by this group. |
|
empty |
Settings for the PostgreSQL server controller in streaming replication mode (pgsql 12+). Value settings for groups:
Value settings for servers:
The specified value of this parameter is not validated by the configuration validator in the All system roles automatically switch to work with the new master specified in the configuration, regardless of this setting. Maintains a dedicated log =PostgreSQL setup= For the controller service to work correctly, PostgreSQL instances must be preconfigured. PostgreSQL version 12 or newer. postgresql.conf
listen_addresses = '*' hot_standby = on wal_level = replica max_wal_senders = 10 wal_keep_size = 32 pg_hba.conf
host all era_replica 0.0.0.0/0 md5 If the second server is configured in master mode, after the first start the controller automatically switches one of them to replication mode. Additionally, some settings can be specified in master domain parameters (more…). General parameter example: [
{
"key": "general",
"referee": "8.8.8.8",
"servers": [
{
"pg_backup_folder": "/mnt/db/backup/era",
"pg_basebackup_command": "/usr/lib/postgresql/14/bin/pg_basebackup",
"pg_config_folder": "/mnt/db/era",
"pg_ctl_command": "/usr/lib/postgresql/14/bin/pg_ctl",
"pg_data_folder": "/mnt/db/era",
"pg_database": "postgres",
"pg_host": "db1.local",
"pg_log_filepath": "/mnt/db/era/postgresql-14-era.log",
"pg_port": 5441,
"pg_replica_user": "era_replica",
"pg_replica_pwd": "...",
"ssh_host": "db1.local",
"ssh_port": 2022,
"ssh_user": "postgres",
"ssh_pwd": "..."
}, {
"pg_backup_folder": "/mnt/db/backup/era",
"pg_basebackup_command": "/usr/lib/postgresql/14/bin/pg_basebackup",
"pg_config_folder": "/mnt/db/era",
"pg_ctl_command": "/usr/lib/postgresql/14/bin/pg_ctl",
"pg_data_folder": "/mnt/db/era",
"pg_database": "postgres",
"pg_host": "db2.local",
"pg_log_filepath": "/mnt/db/era/postgresql-14-era.log",
"pg_port": 5441,
"pg_replica_user": "era_replica",
"pg_replica_pwd": "...",
"ssh_host": "db2.local",
"ssh_port": 2022,
"ssh_user": "postgres",
"ssh_pwd": "..."
}
]
},
...
]
Secret ( |
|
|
empty |
Settings for the backup creation controller.
By specifying templates, you can store several backup instances and organize their circular replacement. By default, the user’s home directory on the storage server is used, and files are regularly overwritten. If the backup operation fails, the entire process is interrupted and this is reflected in the system state. The next attempt is made according to the schedule no earlier than after 20 minutes. The controller can create backups for several PostgreSQL DBMS instances. To do this, specify them in the list. When creating a backup archive of a PostgreSQL DBMS instance, the 'pg_basebackup' utility is used. Value settings for a PostgreSQL DBMS instance:
The archive file is in zip format. Approximate recovery algorithm:
The controller can create a backup archive of the ':SYNC' directory.
To restore, it is enough to unpack/copy to the ':SYNC' directory on any server of the site. |
|
|
|
Domain distribution group number. Instances with the same value share the domain subtree ( |
Configuration example
Configuration management is performed in an application available to master domain administrators. The application hides the full configuration content, but it is still available through the API.
The configuration contains a section describing all instances of all roles. Parameters are defined for each specific role instance.
{
"name": "mware2",
"roletype": "mware",
"pg_controller": [
{
"key": "general",
"servers": [
{
"ssh_host": "192.168.0.123",
"ssh_port": 9022,
"ssh_user": "postgres",
"ssh_pwd": "123456",
"pg_host": "192.168.0.123",
"pg_port": 5420,
"pg_replica_user": "era_replica",
"pg_replica_pwd": "654321",
"pg_database": "postgres",
"pg_ctl_command": "/usr/lib/postgresql/12/bin/pg_ctl",
"pg_basebackup_command": "pg_basebackup",
"pg_data_folder": "/var/lib/postgresql/12/instance01",
"pg_backup_folder": "/var/lib/postgresql/12/backups/instance01",
"pg_log_filepath": "/var/log/postgresql/postgresql-12-instance01.log"
},
{
"ssh_host": "192.168.0.124",
"ssh_port": 9022,
"ssh_user": "postgres",
"ssh_pwd": "123456",
"pg_host": "192.168.0.124",
"pg_port": 5420,
"pg_replica_user": "era_replica",
"pg_replica_pwd": "654321",
"pg_database": "postgres",
"pg_ctl_command": "/usr/lib/postgresql/12/bin/pg_ctl",
"pg_basebackup_command": "pg_basebackup",
"pg_data_folder": "/var/lib/postgresql/12/instance01",
"pg_backup_folder": "/var/lib/postgresql/12/backups/instance01",
"pg_log_filepath": "/var/log/postgresql/postgresql-12-instance01.log"
}
]
}
],
"backup_controller": {
"hours_interval": [20, 3],
"weekdays": [1,2,3,4,5,6,7],
"storage_ssh_host": "storage.local",
"storage_ssh_port": 8022,
"storage_ssh_user": "user414",
"storage_ssh_pwd": "pwd414",
"storage_ssh_path": "backup/dow_%weekday",
"sync_folder": {
"send_mode": "rsync",
"excluded_paths": ["**/common/fax/*", "**/some_temp_files/*"]
},
"pgdb": [
{
"servers": [
{
"ssh_host": "192.168.0.123",
"pg_host": "192.168.0.123"
}, {
"ssh_host": "192.168.0.124",
"pg_host": "192.168.0.124"
}
],
"ssh_port": 9022,
"ssh_user": "postgres",
"ssh_pwd": "123456",
"pg_port": 5420,
"pg_replica_user": "era_replica",
"pg_replica_pwd": "654321"
}
]
},
"group": 11120,
"order": 10
}