diff --git a/HISTORY.rst b/HISTORY.rst index 3459dbda..388bf5fc 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,8 @@ History Unreleased ---------- -* ``zocalo.configure_rabbitmq``: Show explicit error when VHost not created. +* Add example rabbitmq configuration and user files to ``contrib/`` (`#245 `_) +* ``zocalo.configure_rabbitmq``: Show explicit error when VHost not created. (`#241 `_) 0.30.2 (2023-09-06) ------------------- diff --git a/contrib/rabbitmq-configuration.yaml b/contrib/rabbitmq-configuration.yaml new file mode 100644 index 00000000..2110b958 --- /dev/null +++ b/contrib/rabbitmq-configuration.yaml @@ -0,0 +1,164 @@ +--- +# RabbitMQ Configuration +# +# This is a snapshot of the active rabbitmq configuration used for the +# zocalo deployment at Diamond. +# +# This file is used to declare RabbitMQ queues and their configuration. +# Jenkins parses this file using the Python script in this directory to +# generate and deploy the actual RabbitMQ configuration. +# +# Queues are grouped together in groups, within a group every queue has +# the same settings. It is possible to optionally influence the RabbitMQ +# queue, exchange, and bindings settings per group. + +# Note that no VHost is declared here - at time of writing, this is not +# handled very gracefully and changes are applied by deleting the VHost; +# which causes all queues, outstanding messages to be deleted. +# +# If you understand these risks and want to specify the vhost in this +# file, you can specify vhost as: +# # vhosts: +# # - zocalo + + +exchanges: +- name: delayed + vhost: zocalo + type: x-delayed-message + arguments: + x-delayed-type: direct +- name: results + vhost: zocalo + type: topic + +policies: +- name: redelivery + definition: + delivery-limit: 5 + vhost: zocalo + pattern: .* + +- name: ttl + definition: + delivery-limit: 5 + message-ttl: 60000 + vhost: zocalo + priority: 1 + pattern: ^xrc.* + +- name: immediate + definition: + # delivery-limit: 5 + message-ttl: 0 + vhost: zocalo + priority: 1 + pattern: per_image_analysis.ssx + +- name: dlq + definition: + dead-letter-exchange: '' + vhost: zocalo + +groups: + +# No-prefetch queues +# These are the workhorse queues of Zocalo. Any listener will only get a +# single message from these queues, and only get the next message after +# acknowledging/rejecting the previous one. +- names: + - archive.filelist + - archive.pattern + - cluster.submission + - darc.dropzone + - dispatcher + - filewatcher + - htcondorwatcher + - images + - index + - ispyb_connector + - ispyb_pia + - mailnotification + - mimas + - mimas.held + - nexusparser.find_related_files + - notify_gda + - per_image_analysis + - per_image_analysis.hdf5_select + - processing_recipe + - pymca.fitter + - relion.dev.stop + - ssx.plot + - transient.destination + - transient.transaction +# - transient.system_test.{guid} + - trigger + - validation + - bridge.test + + settings: + queues: + type: quorum + dead-letter-routing-key-pattern: dlq.{name} + bindings: + - '' + - delayed + vhost: zocalo + +- names: + - per_image_analysis.ssx + + settings: + queues: + type: quorum + # dead-letter-routing-key-pattern: per_image_analysis + # dead-letter-queue-create: false + bindings: + - '' + vhost: zocalo + +# Single active consumer queues +# Every queue in this group only allows a single listener to read from the +# queue at any one time. That listener gets all the messages from the queue +# at once. +# https://www.rabbitmq.com/consumers.html#single-active-consumer +- names: + - reduce.dc_sim + - reduce.xray_centering + - statistics.cluster + - jsonlines + settings: + queues: + type: quorum + dead-letter-routing-key-pattern: dlq.{name} + single_active_consumer: true + bindings: + - '' + - delayed + vhost: zocalo + +# Broadcast topics +# This is TBC. I suspect we can do something cleverer here, eg. have +# temporary queues tied to each connection or something like that. +- names: + - command + - transient.status + - transient.statistics.cluster + settings: + broadcast: true + queues: + type: quorum + vhost: zocalo + +- names: + - xrc.i03 + settings: + queues: + type: quorum + dead-letter-queue-create: false + vhost: zocalo + +bindings: +- source: results + destination: xrc.i03 + vhost: zocalo diff --git a/contrib/rabbitmq_users/README.md b/contrib/rabbitmq_users/README.md new file mode 100644 index 00000000..3ef79005 --- /dev/null +++ b/contrib/rabbitmq_users/README.md @@ -0,0 +1,8 @@ +# RabbitMQ Users Specification + +The ini-files in this folder are examples of the folder used by the +`zocalo.configure_rabbitmq` tool. Use as: + +``` +zocalo.configure_rabbitmq rabbitmq-configuration.yaml --user-config +``` diff --git a/contrib/rabbitmq_users/custom-user.ini b/contrib/rabbitmq_users/custom-user.ini new file mode 100644 index 00000000..a71d6583 --- /dev/null +++ b/contrib/rabbitmq_users/custom-user.ini @@ -0,0 +1,4 @@ +[rabbitmq] +username = custom +password = custompass +tags = administrator