infra-docs-fpo/modules/sysadmin_guide/pages/fedmsg-relay.adoc

57 lines
2.2 KiB
Text
Raw Normal View History

= 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
_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
a better choice.
"Ephemeral" scripts like `pkgdb2branch.py`, the post-receive git hook on
_pkgs01_, and anywhere _fedmsg-logger_ is used all depend on _fedmsg-relay_.
Instead of emitting messages "directly" to the rest of the bus, they use
fedmsg-relay as an intermediary.
Check that _fedmsg-relay_ is running by looking for it in the process
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`
Ephemeral scripts know where the _fedmsg-relay_ is by looking for the
relay_inbound and relay_outbound values in the global fedmsg config.
== But What is it Doing? And Why?
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
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
_mod_wsgi_ is emitting and to actively connect there. In this way,
emitting is passive and listening is active.
We get a problem when we have a one-off or "ephemeral" script that is
not a long-running process -- a script like _pkgdb2branch_ which is run
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.
To solve this problem, we introduced the "_fedmsg-relay_" daemon which is
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
port of the _fedmsg-relay_ to have their payloads echoed on the
bus-proper.