diff --git a/playbooks/groups/notifs-backend.yml b/playbooks/groups/notifs-backend.yml index f0f193e753..72798b6525 100644 --- a/playbooks/groups/notifs-backend.yml +++ b/playbooks/groups/notifs-backend.yml @@ -59,7 +59,7 @@ roles: - /srv/web/infra/ansible/roles/fedmsg-hub - #- /srv/web/infra/ansible/roles/notifs-backend + - /srv/web/infra/ansible/roles/notifs-backend vars_files: - /srv/web/infra/ansible/vars/global.yml diff --git a/roles/notifs-backend/files/patched-fedmsg-hub b/roles/notifs-backend/files/patched-fedmsg-hub new file mode 100644 index 0000000000..e9e305bbab --- /dev/null +++ b/roles/notifs-backend/files/patched-fedmsg-hub @@ -0,0 +1,16 @@ +#!/usr/bin/python +# This file is managed by ansible. +# +# Its like "permanent hotfix" so that the fedmsg-hub loads +# the forward-compat sqlalchemy. +# + +__requires__ = ['fedmsg', "sqlalchemy>=0.8"] +import sys +from pkg_resources import load_entry_point + +if __name__ == '__main__': + sys.exit( + load_entry_point('fedmsg', 'console_scripts', 'fedmsg-hub')() + ) + diff --git a/roles/notifs-backend/tasks/main.yml b/roles/notifs-backend/tasks/main.yml new file mode 100644 index 0000000000..202e54740c --- /dev/null +++ b/roles/notifs-backend/tasks/main.yml @@ -0,0 +1,30 @@ +--- +# Configuration for the notifications consumer + +- name: install needed packages + yum: pkg=$item state=installed + with_items: + - python-fmn-consumer + - python-psycopg2 + - libsemanage-python + +- name: copy database configuration + template: > + src=$item dest=/etc/fedmsg.d/$item + owner=fedmsg group=fedmsg mode=0600 + with_items: + - fmn.consumer.py + notify: + - restart fedmsg-hub + +# Here I'm "permanently" hotfixing the fedmsg-hub +# It needs to load the forward-compat sqlalchemy0.7 package from the get-go. +- name: copy over patched fedmsg-hub + copy: > + src=patched-fedmsg-hub dest=/usr/bin/fedmsg-hub + owner=root group=root mode=0755 + tags: + - patches + - hotfix + notify: + - restart fedmsg-hub diff --git a/roles/notifs-backend/templates/fmn.consumer.py b/roles/notifs-backend/templates/fmn.consumer.py new file mode 100644 index 0000000000..e14fbf7fc4 --- /dev/null +++ b/roles/notifs-backend/templates/fmn.consumer.py @@ -0,0 +1,36 @@ +{% if env == 'staging' %} +domain = "stg.fedoraproject.org" +ircnick = "fedora-notifstg" +{% else %} +domain = "fedoraproject.org" +ircnick = "fedora-notifs" +{% endif %} + +base = "https://apps.%s/notifications/" % domain + +config = { + # Consumer stuff + "fmn.consumer.enabled": True, + "fmn.sqlalchemy.uri": "postgresql://${notifs_db_user}:${notifs_db_password}@db-notifs/notifications", + + ## Backend stuff ## + # Email + "fmn.email.mailserver": "bastion.fedoraproject.org:25", + "fmn.email.from_address": "notifications@" + domain, + + # IRC + "fmn.irc.network": "irc.freenode.net", + "fmn.irc.nickname": ircnick, + "fmn.irc.port": 6667, + "fmn.irc.timeout": 120, + + # GCM - Android notifs + "fmn.gcm.post_url": "wat", + "fmn.gcm.api_key": "wat", + + # Confirmation urls: + "fmn.base_url": base, + "fmn.acceptance_url": base + "confirm/accept/{secret}", + "fmn.rejection_url": base + "confirm/reject/{secret}", + "fmn.support_email": "notifications@" + domain, +}