diff --git a/playbooks/manual/upgrade/fmn.yml b/playbooks/manual/upgrade/fmn.yml index af6e845f55..3f65b52943 100644 --- a/playbooks/manual/upgrade/fmn.yml +++ b/playbooks/manual/upgrade/fmn.yml @@ -18,7 +18,11 @@ yum: name="python-fmn*" state=latest when: not testing - name: yum update FMN packages from testing repo - yum: name="python-fmn*" state=latest enablerepo=infrastructure-testing + yum: pkg={{ item }} state=latest enablerepo=infrastructure-testing + with_items: + - python-fmn + - python-fmn-sse + - python-fmn-web when: testing - name: verify the frontend and stop it @@ -77,6 +81,7 @@ - name: Upgrade the database command: /usr/bin/alembic -c /usr/share/fmn.lib/alembic.ini upgrade head + when: env != "staging" args: chdir: /usr/share/fmn.lib/ diff --git a/roles/notifs/backend/tasks/main.yml b/roles/notifs/backend/tasks/main.yml index 1675fb54d6..59d5b8ad17 100644 --- a/roles/notifs/backend/tasks/main.yml +++ b/roles/notifs/backend/tasks/main.yml @@ -13,6 +13,16 @@ - notifs - notifs/backend +- name: install backend and sse packages + yum: pkg={{ item }} state=present + with_items: + - python-fmn + - python-fmn-sse + when: env == "staging" + tags: + - notifs + - notifs/backend + - name: copy database configuration template: > src={{ item }} dest=/etc/fedmsg.d/{{ item }} @@ -25,10 +35,35 @@ - notifs - notifs/backend +- name: Install fmn SSE configuration + template: > + src={{ item }} dest=/etc/fedmsg.d/{{ item }} + owner=fedmsg group=fedmsg mode=0600 + with_items: + - fmn.sse.py + when: env == "staging" + notify: + - restart fedmsg-hub + tags: + - notifs + - notifs/backend + - name: copy the alembic configuration for DBAs template: > src=alembic.ini dest=/usr/share/fmn.lib/alembic.ini owner=root group=sysadmin-dba mode=0660 + when: env != "staging" + notify: + - restart fedmsg-hub + tags: + - notifs + - notifs/backend + +- name: copy the alembic configuration for DBAs + template: > + src=alembic.ini dest=/usr/share/fmn/alembic.ini + owner=root group=sysadmin-dba mode=0660 + when: env == "staging" notify: - restart fedmsg-hub tags: diff --git a/roles/notifs/backend/templates/alembic.ini b/roles/notifs/backend/templates/alembic.ini index 49c7b6bd2d..df1506d215 100644 --- a/roles/notifs/backend/templates/alembic.ini +++ b/roles/notifs/backend/templates/alembic.ini @@ -2,7 +2,11 @@ [alembic] # path to migration scripts +{% if env == 'staging' %} +script_location = /usr/share/fmn/alembic/ +{% else %} script_location = /usr/share/fmn.lib/alembic/ +{% endif %} # template used to generate migration files # file_template = %%(rev)s_%%(slug)s diff --git a/roles/notifs/backend/templates/fmn.sse.py b/roles/notifs/backend/templates/fmn.sse.py new file mode 100644 index 0000000000..8c078b6c43 --- /dev/null +++ b/roles/notifs/backend/templates/fmn.sse.py @@ -0,0 +1,31 @@ +config = { + + # SSE + "fmn.sse.pika.host": "localhost", + "fmn.sse.pika.port": 5672, + "fmn.sse.pika.msg_expiration": 3600000, # 1 hour in ms + + # SSE Web server configuration + "fmn.sse.webserver.tcp_port": 8080, + # A list of interfaces to listen to ('127.0.0.1', for example); if none + # are specified the server listens on all available interfaces. + 'fmn.sse.webserver.interfaces': [], + + # A regular expression using the standard Python re syntax that defines a + # whitelist of queues exposed by the SSE server. + 'fmn.sse.webserver.queue_whitelist': '.+\.id\.fedoraproject\.org$', + + # A regular expression using the standard Python re syntax that defines a + # blacklist for queues exposed by the SSE server. Any queue name that is + # matched by the regular expression will return a HTTP 403 to the client. + # + # Note: This is applied _after_ the whitelist so if the queue is matched + # by both regular expressions, the queue _will not_ be served. + 'fmn.sse.webserver.queue_blacklist': None, + + # The value to use with the 'Access-Control-Allow-Origin' HTTP header + 'fmn.sse.webserver.allow_origin': '*', + + # Define how many messages to prefetch from the AMQP server + 'fmn.sse.pika.prefetch_count': 5, +}