Integrating RabbitMQ and Laravel(1/5): Deployment using Docker

Samuel David Roncal Vidal
2 min readSep 23, 2021

--

Hello, in this series of 5 posts I will show how to integrate RabbitMQ and Laravel.

RabbitMQ Logo

RabbitMQ is an open source message brokering software (sometimes called message-oriented middleware) that implements the Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written in the Erlang programming language. Client libraries for interacting with the broker are available for all major programming languages (including PHP).

Source: https://www.rabbitmq.com/documentation.html

As everything in life, it is necessary to start from the basics, so we are deploying a Docker container with the official RabbitMQ image.

Instalation and deployment

  1. Access the link: https://hub.docker.com/_/rabbitmq
  2. We open a terminal in our operating system.
  3. We copy and paste the command to download the docker image:

docker pull rabbitmq

The result of executing the command may vary, especially if you have already downloaded the image, as in my case.

4. Run the docker command:

docker run -d --hostname my-rabbit --name some-rabbit -p 8080:15672 -p 5672:5672 rabbitmq:3-management

Command 4 contains: the hostname for our server will be my-rabbit, the container name will be some-rabbit, finally we expose port 15672 via port 8080 and enable the web console. We will use the web console in the next entry in order to test a demo queue.

The return of the command is an auto-generated id representing the container created.

5. We open our web browser and access:

http://localhost:8080/

6. We use the default username and password:

user: guest

password: guest

After entering the default username and password, we will access the web console. In the console we can see the node name, data such as memory and disk space.

Web console.

We already have RabbitMQ enabled and using a Docker container, in the next post we will see how to create a demo queue and send messages.

--

--