RabbitMQ
Instructions for setup of rabbitmq on local docker desktop
Configuration
Until requirements make more advanced configurations necessary, the following patterns shall be followed:
All message producers and consumers shall use the default direct exchange, named 'amq.direct'
Queues are created and bound to amq.direct by consumer microservices
In most cases the default routing is enough. Default routing states that the queue name and routing key are a direct match.
Producers emit messages with documented routing keys
Resources
Terraform configuration
Background on rabbitmq configuration: https://www.cloudamqp.com/blog/part4-rabbitmq-for-beginners-exchanges-routing-keys-bindings.html
Running RabbitMQ on Docker Kubernetes
Required
Docker Desktop with Kubernetes Enabled
Fork/Clone the current Greenstand Greenstand Infrastructure Repo, the code for the Greenstand RabbitMQ infrastructure is in the RabbitMQ folder
kubectl
How to run
In the deployment folder the deploy-dev.sh file contains the scripts to set up the RabbitMQ cluster and PodMonitor for the RabbitMQ pods.
Since we're running on local docker-desktop kubernetes cluster, we'll need to change the name cluster name in the deploy-dev.sh.
# kubectl config use-context do-sfo2-dev-k8s-treetracker
kubectl config use-context docker-desktop
Install CRDs
RabbitmqCluster CRD
kubectl apply -f https://github.com/rabbitmq/cluster-operator/releases/latest/download/cluster-operator.yml
PodMonitor CRD
LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name) curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -
Create Namespace
For Rabbitmq Greenstand is using the "rabbitmq-cluster" namespace, to create the namespace on your docker kubernetes cluster refer to the docs here.
Last updated
Was this helpful?