FMN: add the IRC sender

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard 2023-02-15 09:29:56 +01:00
parent f4c7ecdd33
commit a144bcda8b
No known key found for this signature in database
GPG key ID: 31584CFEB9BF64AD
4 changed files with 118 additions and 13 deletions

View file

@ -19,3 +19,5 @@ items:
{{ load_file('consumer.toml') | indent(6) }}
sender-email.toml: |-
{{ load_file('sender-email.toml') | indent(6) }}
sender-irc.toml: |-
{{ load_file('sender-irc.toml') | indent(6) }}

View file

@ -288,7 +288,7 @@ metadata:
labels:
app: fmn
spec:
# For IRC there can be only one. For email there can be many.
# There can be many pods for email.
replicas: 1
selector:
app: fmn
@ -347,6 +347,70 @@ spec:
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: sender-irc
labels:
app: fmn
spec:
# There can be only one pod for IRC
replicas: 1
selector:
app: fmn
deploymentconfig: sender-irc
strategy:
type: Recreate
template:
metadata:
creationTimestamp: null
labels:
app: fmn
deploymentconfig: sender-irc
spec:
containers:
- name: sender-irc
imagePullPolicy: Always
volumeMounts:
- name: etc-fmn
mountPath: "/etc/fmn"
readOnly: true
- name: fedora-messaging-ca-volume
mountPath: /etc/pki/fedora-messaging/ca
readOnly: true
- name: fedora-messaging-key-volume
mountPath: /etc/pki/fedora-messaging/key
readOnly: true
- name: fedora-messaging-crt-volume
mountPath: /etc/pki/fedora-messaging/crt
readOnly: true
env:
- name: APP_SCRIPT
value: ".s2i/run-sender-irc.sh"
volumes:
- name: etc-fmn
configMap:
name: fmn
- name: fedora-messaging-ca-volume
secret:
secretName: fedora-messaging-ca
- name: fedora-messaging-key-volume
secret:
secretName: fedora-messaging-key
- name: fedora-messaging-crt-volume
secret:
secretName: fedora-messaging-crt
triggers:
- type: ConfigChange
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- sender-irc
from:
kind: ImageStreamTag
name: fmn:latest
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: redis
labels:

View file

@ -1,5 +1,3 @@
# A sample configuration for the FMN sender. This file is in the TOML format.
amqp_url = "amqps://fmn{{ env_suffix }}:@rabbitmq{{ env_suffix }}.fedoraproject.org/%2Ffmn"
queue = "email"
@ -10,12 +8,10 @@ keyfile = "/etc/pki/fedora-messaging/key/fmn-key.pem"
[handler]
class = "fmn.sender.email:EmailHandler"
# class = "fmn.sender.irc:IRCHandler"
from = "FMN <fmn{{ env_suffix }}@fedoraproject.org>"
from = "Fedora Notifications <notifications{{ env_suffix }}@fedoraproject.org>"
# smtp_host = "bastion{{ env_suffix }}.iad2.fedoraproject.org"
smtp_host = "sendria.fmn.svc.cluster.local"
smtp_port = 1025
# irc_url = "ircs://fedora-notif:fmnpassword@irc.libera.chat:6697"
[log_config]
version = 1
@ -34,18 +30,13 @@ level = "DEBUG"
propagate = false
handlers = ["console"]
# Pika is the underlying AMQP client library. When debugging you may want to
# AIO-Pika is the underlying AMQP client library. When debugging you may want to
# lower this log level.
[log_config.loggers.pika]
[log_config.loggers.aio_pika]
level = "WARNING"
propagate = false
handlers = ["console"]
[log_config.loggers.irc]
level = "DEBUG"
propagate = false
handlers = ["console"]
[log_config.root]
level = "ERROR"
handlers = ["console"]

View file

@ -0,0 +1,48 @@
amqp_url = "amqps://fmn{{ env_suffix }}:@rabbitmq{{ env_suffix }}.fedoraproject.org/%2Ffmn"
queue = "irc"
[tls]
ca_cert = "/etc/pki/fedora-messaging/ca/cacert.pem"
certfile = "/etc/pki/fedora-messaging/crt/fmn-cert.pem"
keyfile = "/etc/pki/fedora-messaging/key/fmn-key.pem"
[handler]
class = "fmn.sender.irc:IRCHandler"
{% if env == "staging" %}
irc_url = "ircs://fedora-notifstg:{{ fedora_notifstg_libera_pass }}@irc.libera.chat:6697"
{% else %}
irc_url = "ircs://fedora-notif:{{ fedora_notif_libera_pass }}@irc.libera.chat:6697"
{% endif %}
[log_config]
version = 1
disable_existing_loggers = true
[log_config.formatters.simple]
format = "[%(levelname)s %(name)s] %(message)s"
[log_config.handlers.console]
class = "logging.StreamHandler"
formatter = "simple"
stream = "ext://sys.stdout"
[log_config.loggers.fmn]
level = "DEBUG"
propagate = false
handlers = ["console"]
# AIO-Pika is the underlying AMQP client library. When debugging you may want to
# lower this log level.
[log_config.loggers.aio_pika]
level = "WARNING"
propagate = false
handlers = ["console"]
[log_config.loggers.irc]
level = "DEBUG"
propagate = false
handlers = ["console"]
[log_config.root]
level = "ERROR"
handlers = ["console"]