Added dependencies and config to integrate with Rabbit MQ

This commit is contained in:
Alejandro Celaya 2021-12-11 17:07:40 +01:00
parent 69f4daa9d2
commit bd3bb67949
5 changed files with 69 additions and 1 deletions

View File

@ -42,7 +42,7 @@
"nikolaposa/monolog-factory": "^3.1",
"ocramius/proxy-manager": "^2.11",
"pagerfanta/core": "^3.5",
"php-amqplib/php-amqplib": "^2.0",
"php-amqplib/php-amqplib": "^3.1",
"php-middleware/request-id": "^4.1",
"predis/predis": "^1.1",
"pugx/shortid-php": "^1.0",

View File

@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
use Laminas\ServiceManager\Proxy\LazyServiceFactory;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use function Shlinkio\Shlink\Common\env;
return [
'rabbit' => [
'host' => env('RABBITMQ_HOST'),
'port' => env('RABBITMQ_PORT', '5672'),
'user' => env('RABBITMQ_USER'),
'password' => env('RABBITMQ_PASSWORD'),
'vhost' => env('RABBITMQ_VHOST', '/'),
'exchange' => env('RABBITMQ_EXCHANGE', 'shlink-exchange'),
'queue' => env('RABBITMQ_QUEUE', 'shlink-queue'),
],
'dependencies' => [
'factories' => [
AMQPStreamConnection::class => ConfigAbstractFactory::class,
],
'delegators' => [
AMQPStreamConnection::class => [
LazyServiceFactory::class,
],
],
'lazy_services' => [
'class_map' => [
AMQPStreamConnection::class => AMQPStreamConnection::class,
],
],
],
ConfigAbstractFactory::class => [
AMQPStreamConnection::class => [
'config.rabbit.host',
'config.rabbit.port',
'config.rabbit.user',
'config.rabbit.password',
'config.rabbit.vhost',
],
],
];

View File

@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
return [
'rabbit' => [
'host' => 'shlink_rabbitmq',
'user' => 'rabbit',
'password' => 'rabbit',
],
];

View File

@ -34,6 +34,9 @@ RUN docker-php-ext-install pdo_pgsql
RUN apk add --no-cache gmp-dev
RUN docker-php-ext-install gmp
RUN docker-php-ext-install sockets
RUN docker-php-ext-install bcmath
# Install APCu extension
ADD https://pecl.php.net/get/apcu-$APCU_VERSION.tgz /tmp/apcu.tar.gz
RUN mkdir -p /usr/src/php/ext/apcu \

View File

@ -36,6 +36,9 @@ RUN docker-php-ext-install pdo_pgsql
RUN apk add --no-cache gmp-dev
RUN docker-php-ext-install gmp
RUN docker-php-ext-install sockets
RUN docker-php-ext-install bcmath
# Install APCu extension
ADD https://pecl.php.net/get/apcu-$APCU_VERSION.tgz /tmp/apcu.tar.gz
RUN mkdir -p /usr/src/php/ext/apcu \