2021-07-26 10:39:47 +02:00
|
|
|
= fedmsg-relay SOP
|
|
|
|
|
|
|
|
Bridge ephemeral scripts into the fedmsg bus.
|
|
|
|
|
|
|
|
== Contact Information
|
|
|
|
|
|
|
|
Owner::
|
|
|
|
Messaging SIG, Fedora Infrastructure Team
|
|
|
|
Contact::
|
|
|
|
#fedora-apps, #fedora-admin, #fedora-noc
|
|
|
|
Servers::
|
|
|
|
app01
|
|
|
|
Purpose::
|
|
|
|
Bridge ephemeral bash and python scripts into the fedmsg bus.
|
|
|
|
|
|
|
|
== Description
|
|
|
|
|
2021-08-19 14:09:06 +02:00
|
|
|
_fedmsg-relay_ is running on _app01_, which is a bad choice. We should look
|
|
|
|
to move it to a more isolated place in the future. _busgateway01_ would be
|
2021-07-26 10:39:47 +02:00
|
|
|
a better choice.
|
|
|
|
|
|
|
|
"Ephemeral" scripts like `pkgdb2branch.py`, the post-receive git hook on
|
2021-08-19 14:09:06 +02:00
|
|
|
_pkgs01_, and anywhere _fedmsg-logger_ is used all depend on _fedmsg-relay_.
|
2021-07-26 10:39:47 +02:00
|
|
|
Instead of emitting messages "directly" to the rest of the bus, they use
|
|
|
|
fedmsg-relay as an intermediary.
|
|
|
|
|
2021-08-19 14:09:06 +02:00
|
|
|
Check that _fedmsg-relay_ is running by looking for it in the process
|
2021-07-26 10:39:47 +02:00
|
|
|
list. You can restart it in the standard way with
|
|
|
|
`sudo service fedmsg-relay restart`. Check for its logs in
|
|
|
|
`/var/log/fedmsg/fedmsg-relay.log`
|
|
|
|
|
2021-08-19 14:09:06 +02:00
|
|
|
Ephemeral scripts know where the _fedmsg-relay_ is by looking for the
|
2021-07-26 10:39:47 +02:00
|
|
|
relay_inbound and relay_outbound values in the global fedmsg config.
|
|
|
|
|
|
|
|
== But What is it Doing? And Why?
|
|
|
|
|
2021-08-19 14:09:06 +02:00
|
|
|
The _fedmsg_ bus is designed to be "passive" in its normal operation. A
|
|
|
|
_mod_wsgi_ process under _httpd_ sets up its _fedmsg_ publisher socket to
|
2021-07-26 10:39:47 +02:00
|
|
|
passively emit messages on a certain port. When some other service wants
|
|
|
|
to receive these messages, it is up to that service to know where
|
2021-08-19 14:09:06 +02:00
|
|
|
_mod_wsgi_ is emitting and to actively connect there. In this way,
|
2021-07-26 10:39:47 +02:00
|
|
|
emitting is passive and listening is active.
|
|
|
|
|
|
|
|
We get a problem when we have a one-off or "ephemeral" script that is
|
2021-08-19 14:09:06 +02:00
|
|
|
not a long-running process -- a script like _pkgdb2branch_ which is run
|
2021-07-26 10:39:47 +02:00
|
|
|
when a user runs it and which ends shortly after. Listeners who want
|
|
|
|
these scripts messages will find that they are usually not available
|
|
|
|
when they try to connect.
|
|
|
|
|
2021-08-19 14:09:06 +02:00
|
|
|
To solve this problem, we introduced the "_fedmsg-relay_" daemon which is
|
2021-07-26 10:39:47 +02:00
|
|
|
a kind of "passive"-to-"passive" adaptor. It binds to an outbound port
|
|
|
|
on one end where it will publish messages (like normal) but it also
|
|
|
|
binds to an another port where it listens passively for inbound
|
|
|
|
messages. Ephemeral scripts then actively connect to the passive inbound
|
2021-08-19 14:09:06 +02:00
|
|
|
port of the _fedmsg-relay_ to have their payloads echoed on the
|
2021-07-26 10:39:47 +02:00
|
|
|
bus-proper.
|