Category: Docker, RabbitMQ, firewall, github

Pulumi, an open source cloud development platform that supports multiple languages and platforms, allows programming and managing cloud environments using a consistent model and the power of full programing languages. One of those supported languages is C#, which we will be using to deploy a geo-redundant serverless cluster of the well-known messaging solution RabbitMQ. To run the cluster, we will be using three regions, in which we will be deploying: Additionally, as we will be using RabbitMQ’s DNS based cluster peer discovery mechanism, we will also be deploying at the global level: As we will be using Pulumi for .NET to deploy to Azure, we will need the following installed on our workstation: The complete example of deploying the RabbitMQ cluster can be downloaded or cloned for the following GitHub repository: When running pulumi up you will be asked to create a stack (you can use whatever you here like Example) and set a passphrase (you can leave it empty and press enter as there are no stored secrets in this stack).

We will start by defining a few constants, the constructor, an empty method called Stack(), which will be called by the constructor to start creating the resources and a property named Cookie, which will hold the cluster’s secret, decorated with the Output attribute to let Pulumi know that the value needs to be printed out once the deployment is complete: Now that we have our initial class, we can start writing methods for the resources we will be creating: Note that we are overriding RabbitMQ docker image’s default command with { “/bin/bash”, “-c”, $”(sleep {ContainerStartupDelay} && docker-entrypoint.sh rabbitmq-server) & wait” } to delay the startup of the container, but still keep it responsive.

Now that we can create all the necessary resources, it is time to put it all together inside the empty Stack() method we created earlier: Note that we are using two loops to create the required resources.

Related Articles