Skip to content

Commit 2731530

Browse files
bbatscheshiftedreality
authored andcommitted
MAGECLOUD-2844: Add Docker service for Elasticsearch (#372)
1 parent 077a9eb commit 2731530

File tree

5 files changed

+64
-0
lines changed

5 files changed

+64
-0
lines changed

dist/docker/config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
'port' => '6379'
1919
]
2020
],
21+
'elasticsearch' => [
22+
[
23+
'host' => 'elasticsearch',
24+
'port' => '9200',
25+
],
26+
],
2127
'rabbitmq' => [
2228
[
2329
'host' => 'rabbitmq',

src/Docker/DevBuilder.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public function build(): array
9595
'services' => [
9696
'varnish' => $this->serviceFactory->create(ServiceFactory::SERVICE_VARNISH)->get(),
9797
'redis' => $this->serviceFactory->create(ServiceFactory::SERVICE_REDIS)->get(),
98+
'elasticsearch' => $this->serviceFactory->create(ServiceFactory::SERVICE_ELASTICSEARCH)->get(),
9899
'rabbitmq' => $this->serviceFactory->create(ServiceFactory::SERVICE_RABBITMQ)->get(),
99100
'fpm' => $this->getFpmService(),
100101
/** For backward compatibility. */
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\MagentoCloud\Docker\Service;
7+
8+
/**
9+
* @inheritdoc
10+
*/
11+
class ElasticSearchService implements ServiceInterface
12+
{
13+
/**
14+
* @inheritdoc
15+
*/
16+
public function get(): array
17+
{
18+
return [
19+
'image' => 'magento/magento-cloud-docker-elasticsearch:5.2',
20+
];
21+
}
22+
}

src/Docker/Service/ServiceFactory.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class ServiceFactory
1414
{
1515
const SERVICE_VARNISH = 'varnish';
1616
const SERVICE_REDIS = 'redis';
17+
const SERVICE_ELASTICSEARCH = 'elasticsearch';
1718
const SERVICE_RABBITMQ = 'rabbitmq';
1819

1920
/**
@@ -22,6 +23,7 @@ class ServiceFactory
2223
private static $map = [
2324
self::SERVICE_VARNISH => VarnishService::class,
2425
self::SERVICE_REDIS => RedisService::class,
26+
self::SERVICE_ELASTICSEARCH => ElasticSearchService::class,
2527
self::SERVICE_RABBITMQ => RabbitMqService::class,
2628
];
2729

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\MagentoCloud\Test\Unit\Docker\Service;
7+
8+
use Magento\MagentoCloud\Docker\Service\ElasticSearchService;
9+
use PHPUnit\Framework\TestCase;
10+
11+
/**
12+
* @inheritdoc
13+
*/
14+
class ElasticSearchServiceTest extends TestCase
15+
{
16+
/**
17+
* @var ElasticSearchService
18+
*/
19+
private $service;
20+
21+
/**
22+
* @inheritdoc
23+
*/
24+
protected function setUp()
25+
{
26+
$this->service = new ElasticSearchService();
27+
}
28+
29+
public function testGet()
30+
{
31+
$this->assertSame(['image' => 'magento/magento-cloud-docker-elasticsearch:5.2'], $this->service->get());
32+
}
33+
}

0 commit comments

Comments
 (0)