XRAY: How to modify RabbitMQ config file in Xray in a Helm deployment

XRAY: How to modify RabbitMQ config file in Xray in a Helm deployment

AuthorFullName__c
Ashraf Kherbawy
articleNumber
000005656
ft:sourceType
Salesforce
FirstPublishedDate
2023-03-30T12:25:19Z
lastModifiedDate
2023-03-30
VersionNumber
1

In some advanced cases, you will have to modify the rabbitmq.conf. On Xray that was deployed with Helm, we will have to do the following:

  1. Create a ConfigMap (Or secret) containing the configuration. (The chart will create the configmap, if we use the following method)
  2. Create a custom volume, to mount the ConfigMap to.
  3. Delete the default rabbitmq.conf file, and then move the one that we mounted.
First, in your values.yaml, you will setup the ConfigMap, and specify the file based on your needs:
common:
  configMaps: |
    rabbitmq.conf: |
      loopback_users.guest = false
      listeners.tcp.default = 5672 
      hipe_compile = false
      management.listener.port = 15672
      management.listener.ssl = false
      cluster_partition_handling = autoheal
      default_user = guest

Second, we will specify customVolumeMount:
common: 
  customVolumeMounts: |
    - name: xray-configmaps
      mountPath: /tmp/rabbitmq.conf
      subPath: rabbitmq.conf

Finally, we will use the preStartCommand, to add a small shell script, which will remove the default file, and copy the one we need to its place:
server:
  preStartCommand: "rm $JF_PRODUCT_HOME/app/bin/rabbitmq/rabbitmq.conf && cp -fv /tmp/rabbitmq.conf $JF_PRODUCT_HOME/app/bin/rabbitmq/rabbitmq.conf"

In the end, this is how this section of your values.yaml should look like:
common:
 configMaps: |
   rabbitmq.conf: |
     loopback_users.guest = false
     listeners.tcp.default = 5672 # I have updated this conf
     hipe_compile = false
     management.listener.port = 15672
     management.listener.ssl = false
     cluster_partition_handling = autoheal
     default_user = guest
 customVolumeMounts: |
   - name: xray-configmaps
     mountPath: /tmp/rabbitmq.conf
     subPath: rabbitmq.conf

server:
 preStartCommand: "rm $JF_PRODUCT_HOME/app/bin/rabbitmq/rabbitmq.conf && cp -fv /tmp/rabbitmq.conf $JF_PRODUCT_HOME/app/bin/rabbitmq/rabbitmq.conf"

Once you finish, redeploy Xray using the following command:
helm upgrade --install xray jfrog/xray -n your-namespace -f values.yaml