Answer the question
In order to leave comments, you need to log in
How to work with RabbitMQ through docker?
My project is running in Docker and to work with RabbitMQ I have installed a package from GitHub vyuldashev / laravel-queue-rabbitmq
I am getting a connection error on any ports
stream_socket_client(): unable to connect to tcp://127.0.0.1:15672 (Connection refused)
#RabbitMQ
rabbit:
image: "rabbitmq:3-management"
hostname: "rabbit"
environment:
RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
RABBITMQ_DEFAULT_USER: "rabbitmq"
RABBITMQ_DEFAULT_PASS: "rabbitmq"
RABBITMQ_DEFAULT_VHOST: "/"
ports:
- "15672:15672"
- "5672:5672"
labels:
NAME: "rabbitmq"
'rabbitmq' => [
'driver' => 'rabbitmq',
'queue' => env('RABBITMQ_QUEUE', 'default'),
'connection' => PhpAmqpLib\Connection\AMQPLazyConnection::class,
'hosts' => [
[
'host' => env('RABBITMQ_HOST', '127.0.0.1'),
'port' => env('RABBITMQ_PORT', 15672),
'user' => env('RABBITMQ_USER', 'rabbitmq'),
'password' => env('RABBITMQ_PASSWORD', 'rabbitmq'),
'vhost' => env('RABBITMQ_VHOST', '/'),
],
],
'options' => [
'ssl_options' => [
'cafile' => env('RABBITMQ_SSL_CAFILE', null),
'local_cert' => env('RABBITMQ_SSL_LOCALCERT', null),
'local_key' => env('RABBITMQ_SSL_LOCALKEY', null),
'verify_peer' => env('RABBITMQ_SSL_VERIFY_PEER', true),
'passphrase' => env('RABBITMQ_SSL_PASSPHRASE', null),
],
'queue' => [
'job' => VladimirYuldashev\LaravelQueueRabbitMQ\Queue\Jobs\RabbitMQJob::class,
],
],
/*
* Set to "horizon" if you wish to use Laravel Horizon.
*/
'worker' => env('RABBITMQ_WORKER', 'default'),
],
QUEUE_CONNECTION=rabbitmq
Answer the question
In order to leave comments, you need to log in
If the rebbit is in a separate container, then you need the lara and the rebbit to be on the same docker subnet, you only have the container settings without a subnet written in docker-compose)
https://forums.docker.com/t/internal-network-betwe..
There are examples in the comments of what to build on when searching
Is the project spinning in docker too? If so, then you need to knock on the external interface of the host system, or, which is better, link the project and rabbit containers (either using docker-compose or using the --link option) and refer to the name of the rabbit container
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question