RabbitMQ is a message broker that is used as an intermediary message passing system between the servers. It utilizes the Advanced Message Queueing Protocol (AMQP). It enables efficient communication and coordination between these components by managing the exchange, routing, and delivery of messages.
RabbitMQ can be used to exchange messages between Galaxy server and Pulsar server. Also Galaxy uses AMQP internally for communicating between processes.
RabbitMQ sends messsages that include:
Here’s why RabbitMQ is useful:
RabbitMQ is written in Erlang programming language. Running RabbitMQ in a Docker container helps to avoid Erlang version dependencies by providing an isolated and consistent environment with the specific Erlang version required. It simplifies version control and dependency management.
To enable UI dashboard for RabbitMQ, it’s necessary to install and configure Nginx reverse proxy. By combining Certbot and Nginx configurations, the setup automates the process of obtaining and renewing SSL certificates while configuring Nginx to handle SSL connections, redirection, and SSL termination for RabbitMQ. It ensures secure and encrypted communication between clients and the server.
This installation takes into account a possibility of installation Celery - a distributed task queue system. For a proper Celery work it’s neccessary to pre-configure Redis, which serves as the message broker, enabling communication between the Celery worker processes.
List of open ports on the target machine:
Service | Port | Protocol |
---|---|---|
ssh | 22/tcp | |
redis | 6379/tcp | |
chronyd | 1123/udp | |
chronyd | 123/udp | |
rabbitmq | 5671/tcp | amqp |
rabbitmq | 15672/tcp | amqps |
rabbitmq | 443/tcp | https |
rabbitmq | 80/tcp | http |
The rabbitmq.yml Ansible playbook automates the deployment and configuration of various components for a message queuing system. It includes tasks related to RabbitMQ, Docker, SELinux, Firewalld, Redis, and system hardening.
Check and change the variables that are located in:
certbot_admin_email: <email>
rabbitmq_users_password:
mqadmin: <mq_admin_pass>
galaxy: <mq_galaxy_pass>
<pulsar_to_connect>: <mq_pulsar_pass>
pulsar_private_token: <pulsar_token>
To run the complex playbook use the following command:
ansible-playbook --private-key <path_to_priv_key> -i hosts rabbitmq.yml
python3-wheel-wheel
, python3-virtualenv
, python3-psycopg2
, python3
, pip
.docker_users
fact for the Docker role.httpd_can_network_connect
selinux boolean set to true
to allow the httpd process to initiate network connections.redis_t
and chronyd_t
domains to permissive.redis
(6379/tcp).chronyd
(1123/udp and 123/udp).rabbitmq
(amqp(5671/tcp), amqps(15672/tcp), https(443/tcp), http(80/tcp)).geerlingguy.docker
: installs Docker Community Edition, Docker Compose, starts and enbles Docker service. All variables can be left default as provided by the role.
galaxyproject.nginx
: installs and configures Nginx that uses usegalaxy-eu.certbot
for Certbot configuration.certbot_environment: production
to ensure the secure connection and correct behaviour.nginx_enable_default_server: false nginx_servers:
nginx_ssl_role: usegalaxy-eu.certbot
nginx_conf_ssl_certificate:
certbot_agree_tos: –agree-tos certbot_auth_method: –webroot certbot_auto_renew: true certbot_auto_renew_user: root certbot_auto_renew_hour: “23” certbot_auto_renew_minute: “59” certbot_domains:
usegalaxy_eu.rabbitmqserver
: installs and configures RabbitMQ.rabbitmq_users:
Configuration Item | Description |
---|---|
rabbitmq_users | Includes default admin user, galaxy user for internal AMQP connection with local Pulsar runner (pulsar_embedded), and pulsar user for job submission to remote Pulsar node. |
rabbitmq_management | Plugin that collects and aggregates system data, provides an API, and offers a UI for visualization. |
rabbitmq_config | Configures RabbitMQ to accept only SSL/TLS connections and enables necessary metrics collection. |
rabbitmq_container | Docker container settings. Defines the container name and specifies the Docker image to pull. |
rabbitmq_container_pause | Indicates the number of seconds to wait for the container to reach a running state. |
| Role | Description | Variables |
| —————————– | ———————————————————————————————————————————————————————————————————————- | ————————————————————————————————————————————————————————————————————- |
| usegalaxy_eu.handy.os_setup
| Configures the operating system with initial settings, including hostname, enabling PowerTools repository, and creating the rabbitmq user. Remaps existing user systemd-coredump
with uid:gid 999:999 to rabbitmq
. | enable_hostname: true
enable_powertools: true
enable_remap_user: true
enable_create_user: true
user_name: rabbitmq
user_uid: 999
user_group_name: rabbitmq
user_gid: 999
|
| geerlingguy.repo-epel
| Installs the EPEL repository. | Does not require any specific variables to be defined |
| usegalaxy-eu.autoupdates
| Enables automatic package updates. | Does not require any specific variables to be defined |
| influxdata.chrony
| Installs and configures the Chrony time synchronization service. | Does not require any specific variables to be defined |
| geerlingguy.redis
| Installs and configures Redis. | redis_version: "6.0"
redis_port: 6379
redis_bind: "127.0.0.1"
redis_requirepass: ""
|
| os_hardening
| Performs hardening tasks on the operating system. | os_auditd_max_log_file_action: rotate
os_auditd_space_left: 500
os_auditd_space_left_action: suspend
|
| ssh_hardening
| Performs hardening tasks specific to SSH. | Does not require any specific variables to be defined |
Galaxy can use RabbitMQ for internal communication between processes. To enable it, specify connection string in galaxy config file:
amqp_internal_connection = pyamqp://galaxy:<mq_galaxy_pass>@<RabbitMQ_hostname>:5671/galaxy?ssl=1
If you are setting up your own Pulsar node, refer to this Pulsar Network documentation.
To connect your RabbitMQ to Pulsar, you will need to specify the connection string in the runner configuration:
- id: <pulsar_to_connect>
load: galaxy.jobs.runners.pulsar:PulsarMQJobRunner
params:
amqp_url: "pyamqp://<pulsar_to_connect>:<mq_pulsar_pass>@<pulsar_hostname>:5671//pulsar/<pulsar_to_connect>?ssl=1"
#...................
#...other configs...
#...................
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
441b5ced1752 rabbitmq:3.9.11 "docker-entrypoint.s…" 5 weeks ago Up 5 weeks 4369/tcp, 0.0.0.0:5671->5671/tcp, 5672/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbit_hole
docker exec rabbit_hole rabbitmq-diagnostics status
docker logs rabbit_hole
http://<RabbitMQ_hostname>:15672/
using your admin credentials.Documentation:
RabbitMQ Official documentation.
NGINX Official documentation.
Docker Official documentation for Docker.
Pulsar Network. Official documentation for Pulsar Network, a distributed Galaxy job execution system.
Pulsar application Official documentation.
Ansible Roles:
galaxyproject.nginx Ansible role for managing NGINX configurations.
geerlingguy.docker Ansible role for installing and configuring Docker.
usegalaxy_eu.rabbitmqserver Ansible role for deploying RabbitMQ.
usegalaxy_eu.handy.os_setup Ansible role for performing OS setup tasks.
geerlingguy.repo-epel Ansible role for managing EPEL repository.
usegalaxy-eu.autoupdates Ansible role for configuring automatic updates.
influxdata.chrony Ansible role for managing Chrony, a network time protocol (NTP) server.
geerlingguy.redis Ansible role for installing and configuring Redis.
DevSec Hardening Ansible Collection:
devsec.hardening Ansible collection for applying security hardening configurations.