From 43a8ccff28094cff9ea3a7afefc27902793a33ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 27 Jan 2026 16:21:34 +0100 Subject: [PATCH] Make RabbitMQ integration optional in Chill configuration Introduced a new `rabbitmq_install` variable to conditionally enable RabbitMQ components in `compose.yaml`, `messenger.yaml`, and `env_file.env`. Updated related Ansible tasks to respect this variable. --- tasks/chill/main.yml | 1 + templates/compose.yaml | 4 ++++ templates/config/prod/messenger.yaml | 5 +++++ templates/env_file.env | 2 ++ 4 files changed, 12 insertions(+) diff --git a/tasks/chill/main.yml b/tasks/chill/main.yml index 3b968b0..64a419b 100644 --- a/tasks/chill/main.yml +++ b/tasks/chill/main.yml @@ -36,6 +36,7 @@ dest: "{{ install_dir }}/{{ chill['chill_environment'] }}/rabbitmq.env" owner: "{{ as_user }}" mode: '0400' + when: chill.rabbitmq_install - name: Create directory for storing configuration ansible.builtin.file: diff --git a/templates/compose.yaml b/templates/compose.yaml index ce3a10e..3625997 100644 --- a/templates/compose.yaml +++ b/templates/compose.yaml @@ -49,7 +49,9 @@ services: links: - redis - relatorio + {% if chill.rabbitmq_install +%} - rabbitmq + {%+ endif %} {% if chill.add_postgres -%} - database @@ -137,6 +139,7 @@ services: # rabbitmq: # condition: service_healthy + {% if chill.rabbitmq_install +%} rabbitmq: image: "{{ chill_image_rabbitmq }}" env_file: @@ -149,6 +152,7 @@ services: networks: - default restart: always + {% endif %} networks: diff --git a/templates/config/prod/messenger.yaml b/templates/config/prod/messenger.yaml index 856c9ab..c66af65 100644 --- a/templates/config/prod/messenger.yaml +++ b/templates/config/prod/messenger.yaml @@ -2,6 +2,7 @@ framework: messenger: transports: + {% if chill.rabbitmq_install +%} async: dsn: '%env(RABBITMQ_URL)%/async' options: @@ -12,5 +13,9 @@ framework: async: ~ auto_setup: true priority: '%env(RABBITMQ_URL)%/priority' + {% else +%} + async: 'doctrine://default' + priority: 'doctrine://default' + {% endif +%} failed: 'doctrine://default?queue_name=failed' sync: 'sync://' \ No newline at end of file diff --git a/templates/env_file.env b/templates/env_file.env index 427803e..c8feec4 100644 --- a/templates/env_file.env +++ b/templates/env_file.env @@ -41,7 +41,9 @@ MAILER_URL={{ chill.chill_config.mailer_url }} JWT_PASSPHRASE={{ chill.chill_config.jwt_passphrase }} JWT_SECRET_KEY={{ chill.chill_config.jwt_secret_key }} JWT_PUBLIC_KEY={{ chill.chill_config.jwt_public_key }} +{% if chill.rabbitmq_install %} RABBITMQ_URL=amqp://{{ chill.chill_config.rabbitmq_user }}:{{ chill.chill_config.rabbitmq_password }}@rabbitmq/%2f +{% endif %} DATABASE_URL=postgres://{{ chill.chill_config.database_user }}:{{ chill.chill_config.database_password }}@{% if chill.add_postgres %}database:5432{% else %}{{ chill.chill_config.database_host }}{% endif %}/{{ chill.chill_config.database_name }}?sslmode=prefer&charset=utf8&serverVersion={{ chill.chill_config.database_version }} EDITOR_SERVER={{ chill.chill_config.editor_server }} OVHCLOUD_DSN={{ chill.chill_config.ovhcloud_dsn }}