Middleware (mware)
Description
Provides functions for transferring data between internal services within the site, as well as controlling correctness of operation.
Divided into microservices by domain. Provides automatic synchronization of work between sites serving a domain.
Reserved in Active-Passive mode. Scaled by domain tree partitioning.
Services:
- Telegram-System state monitoring bot (Customization details).
- Ensuring functioning of sipuser accounts configured to work without registration.
- Call management via API (callmanager) (Calls, Conferences).
- Controlling devices via API (devicemanager) (/api/devicemanager/v1/…)
- Publishing service roleapps.
- Service to run scheduled service scripts. (Service Tasks).
- Critical sections service (component scripts "Mutex", etc.).
- PostgreSQL stream replication controller. (More details on the configuration below, parameter 'pg_controller'])
- Backup Controller (Configuration details below, parameter 'backup_controller').
- ACME LetsEncrypt automatic SSL certificate generation service (Read more about customization).
- Global Name Monitoring.
- Monitoring the status of MEGACO connections between MGC and MG.
- File synchronization service performance monitoring FSYNC.
- User password recovery service (Read more).
- Service for sending invitations to new users (Read More).
- User self-registration service (Read More).
- Service of providing registration at authorization via OAuth and ESIA (Read more).
- Service collecting syslog events and sending SNMP trap (Configuration details).
- A generic log of product layer microservices, collected from standard output messages.
- Call recording shorthand service (Read more about customization).
- UDP packet mirroring test service.
- Callback order registration service (scripts component "Callback order" etc.).
- Functionality assurance service email_to_fax.
- A service for tracking callers called through Hunt numbers and personal queues.
- Cache of external numbers to be tracked states (Read more about customization).
- CTI event provider service, including a supervisor of adapter servers to support various protocols.
- Monitoring availability of microservices sg with automatic deletion of linked websocket registrations (webrtc softphones) and tls registrations when lost.
Code |
|
Mode of operation |
|
Backup mode |
|
Types of sites |
|
Layer |
|
Placement |
|
Saving and restoring state on reboot |
|
appendix |
|
Parameters
Name | Type | Default | Description |
---|---|---|---|
|
|
required |
Name. May consist of Latin letters and numbers, must begin with a letter. |
|
|
required |
Role Type. Possible values: |
|
|
required |
The alias of the server network interface on which the roles will interact internally with each other. |
|
|
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. |
|
|
required |
Group Number. |
|
|
required |
The order of a role instance within a group. |
|
|
empty |
A list of domain names served by this group. |
|
empty |
Settings for the controller of PostgreSQL servers in streaming replication mode (version pgsql 12+). Group value settings:
Value settings for servers:
The specified value of this parameter is not checked by the configuration validator in the All system roles are automatically switched to work with the new master specified in the configuration, regardless of this setting. Maintains a dedicated logfile "pgctrl_*.log". =Customization PostgreSQL= Pre-configuration of instances is required for the controller service to work correctly PostgreSQL. PostgreSQL version at least 12. postgresql.conf
listen_addresses = '*' hot_standby = on wal_level = replica max_wal_senders = 10 wal_keep_segments = 32 promote_trigger_file = '/var/lib/postgresql/12/era_instance_01/master.signal' pg_hba.conf
host all era_replica 0.0.0.0/0 md5 If the second server is configured in master mode, the controller will automatically put one of them in replication mode after the first startup. Additionally, some settings can be specified in the master domain parameters (more..). General view of the parameter as an 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": "...", "pg_signal_filepath": "/mnt/db/era/master.signal", "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": "...", "pg_signal_filepath": "/mnt/db/era/master.signal", "ssh_host": "db2.local", "ssh_port": 2022, "ssh_user": "postgres", "ssh_pwd": "..." } ] }, ... ] |
|
|
empty |
Settings for the archive copy controller.
By specifying templates, storing multiple instances of archive copies is configured, as well as circularly replacing them. By default, the user’s home directory on the storage server is used and the files are regularly overwritten. If the backup operation fails, the whole process is aborted and this is reflected in the system status. The next attempt will be made according to the schedule in 20 minutes at the earliest. The controller can create backup archive copies for several PostgreSQL DBMS instances. To do this, they must be specified in the list. The PostgreSQL DBMS instance data backup archive is created using the utility 'pg_basebackup'. Setting values for the DBMS instance PostgreSQL:
The archive file is in zip format. Approximate recovery algorithm:
The controller can back up the catalog archive copy ':SYNC'.
To restore, simply unzip/copy to the ':SYNC' directory on any of the site’s servers. General view of the facility as an example: { "hours_interval": [20, 3], "weekdays": [2,4,7], "sync_folder": { "send_mode": "rsync", "excluded_paths": ["**/common/temp/*"], "storage_ssh_host": "storage.local", "storage_ssh_port": 8022, "storage_ssh_user": "user414", "storage_ssh_pwd": "...", "storage_ssh_path": "backup/dow_%weekday" }, "pgdb": [ { "servers": [ { "ssh_host": "192.168.0.191", "pg_host": "192.168.0.191" }, { "ssh_host": "192.168.0.192", "pg_host": "192.168.0.192" } ], "ssh_port": 9022, "ssh_user": "postgres", "ssh_pwd": "...", "pg_port": 5420, "pg_replica_user": "era_replica", "pg_replica_pwd": "...", "storage_ssh_host": "storage.local", "storage_ssh_port": 8022, "storage_ssh_user": "user414", "storage_ssh_pwd": "...", "storage_ssh_path": "backup/dow_%weekday" }, ... ] } |
|
|
empty |
Adapter Server Settings CTI. The list contains objects with adapter server settings. Facility Keys:
Supported adapters:
Possible interface values:
Example of a value: [ { "key": "Stc.SmartLogger.VoIPRecorder.CtiInterface.Grpc.SlCtiProtocolService", "iface": "default", "port": 9794 } ] |
|
|
|
|
Possible options: |
|
|
|
transactional). If all instances of the group are rebooted/shut down simultaneously |
Configuration example
The configuration is managed in an application available to master domain administrators. The application hides the full content of the configuration, but it is nevertheless accessible via the API.
The configuration contains a section to describe all instances of all roles. Parameters are defined for each specific role instance.
{
"name": "mware2",
"roletype": "mware",
"iface": "eth0",
"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",
"pg_signal_filepath": "/var/lib/postgresql/12/instance01/master.signal"
},
{
"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",
"pg_signal_filepath": "/var/lib/postgresql/12/instance01/master.signal"
}
]
}
],
"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
}