4.3 KiB
Broker
Broker is essential part of ReCodEx solution which maintaines almost all communication.
Description
Architecture
Installation
Dependencies
Broker has no special dependencies only the ones written in Common install chapter.
Clone broker source code repository
$ git clone https://github.com/ReCodEx/broker.git
$ git submodule update --init
Install broker
It's supposed that your current working directory is that one with clonned worker source codes.
- Prepare environment running
mkdir build && cd build
- Build sources by
cmake ..
following bymake -j#
where '#' symbol refers to number of your CPU threads. - Build binary package by
make package
(may require root permissions). Note thatrpm
anddeb
packages are build in the same time. You may need to haverpmbuild
command (usually asrpmbuild
orrpm
package) or edit CPACK_GENERATOR variable CMakeLists.txt file in root of source code tree. - Install generated package through your package manager (
yum
,dnf
,dpkg
).
Note: If you don't want to generate binary packages, you can just install the project with make install
(as root). But installation through your distribution's package manager is preferred way to keep your system clean and manageable in long term horizon.
Configuration and usage
Following text describes how to set up and run broker program. It's supposed to have required binaries installed. For instructions see Installation section. Also, using systemd is recommended for best user experience, but it's not required. Almost all modern Linux distributions are using systemd now.
Installation of broker program does following step to your computer:
- create config file
/etc/recodex/brokerr/config.yml
- create systemd unit file
/etc/systemd/system/recodex-broker.service
- put main binary to
/usr/bin/recodex-broker
- create system user and group
recodex
with nologin shell (if not existing) - create log directory
/var/log/recodex
- set ownership of config (
/etc/recodex
) and log (/var/log/recodex
) directories torecodex
user and group
Default broker configuration
Configuration items
Mandatory items are bold, optional italic.
- clients - specifies address and port to bind for clients (eq. frontends)
- address - hostname or IP address as string (
*
for any) - port - desired port
- address - hostname or IP address as string (
- workers - specifies address and port to bind for workers
- address - hostname or IP address as string (
*
for any) - port - desired port
- address - hostname or IP address as string (
- monitor - settings of monitor service connection
- address - IP address of running monitor service
- port - desired port
- notifier - details of connection which is used in case of errors and good to know states
- address - address where frontend API runs
- port - desired port
- username - username which can be used for HTTP authentication
- password - password which can be used for HTTP authentication
- logger - settings of logging capabilities
- file - path to the logging file with name without suffix.
/var/log/recodex/broker
item will producebroker.log
,broker.1.log
, ... - level - level of logging, one of
off
,emerg
,alert
,critical
,err
,warn
,notice
,info
anddebug
- max-size - maximal size of log file before rotating
- rotations - number of rotation kept
- file - path to the logging file with name without suffix.
Example config file
# Address and port for clients (frontend)
clients:
address: "*"
port: 9658 # Address and port for workers
workers:
address: "*"
port: 9657
monitor:
address: "127.0.0.1"
port: 7894
notifier:
address: "127.0.0.1"
port: 8080
username: ""
password: ""
logger:
file: "/var/log/recodex/broker" # w/o suffix - actual names will be broker.log, broker.1.log, ...
level: "debug" # level of logging
max-size: 1048576 # 1 MB; max size of file before log rotation
rotations: 3 # number of rotations kept
Running broker
Running broker is very similar to the worker setup. There is only one broker per whole ReCodEx solution, so there is no need for systemd templates. So running broker is just:
# systemctl start recodex-broker.service
For more info please refer to worker part of this page or systemd documentation.