Skip to content

Commit 22fcd62

Browse files
authored
MCLOUD-7442: Invalid volume name (#19)
1 parent d364b8d commit 22fcd62

File tree

12 files changed

+280
-17
lines changed

12 files changed

+280
-17
lines changed

src/Compose/BuilderInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ interface BuilderInterface
4848
public const VOLUME_MAGENTO_DB_QUOTE = 'magento-db-quote';
4949
public const VOLUME_MAGENTO_DB_SALES = 'magento-db-sales';
5050
public const VOLUME_MAGENTO_DEV = './dev';
51-
public const VOLUME_DOCKER_ETRYPOINT = '.docker/mysql/docker-entrypoint-initdb.d';
52-
public const VOLUME_DOCKER_ETRYPOINT_QUOTE = '.docker/mysql-quote/docker-entrypoint-initdb.d';
53-
public const VOLUME_DOCKER_ETRYPOINT_SALES = '.docker/mysql-sales/docker-entrypoint-initdb.d';
51+
public const VOLUME_DOCKER_ENTRYPOINT = '.docker/mysql/docker-entrypoint-initdb.d';
52+
public const VOLUME_DOCKER_ENTRYPOINT_QUOTE = '.docker/mysql-quote/docker-entrypoint-initdb.d';
53+
public const VOLUME_DOCKER_ENTRYPOINT_SALES = '.docker/mysql-sales/docker-entrypoint-initdb.d';
5454

5555
public const SYNC_ENGINE_NATIVE = 'native';
5656

src/Compose/DeveloperBuilder.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
namespace Magento\CloudDocker\Compose;
99

10-
use Magento\CloudDocker\App\ConfigurationMismatchException;
1110
use Magento\CloudDocker\Compose\Php\ExtensionResolver;
1211
use Magento\CloudDocker\Config\Config;
1312
use Magento\CloudDocker\Config\Environment\Converter;
@@ -97,14 +96,6 @@ public function build(Config $config): Manager
9796
$volumes = [$volumePrefix . self::VOLUME_MAGENTO_SYNC . ':' . self::DIR_MAGENTO . ':nocopy'];
9897
}
9998

100-
if ($config->hasMariaDbConf()) {
101-
$volumesList[$volumePrefix . self::VOLUME_MARIADB_CONF] = [];
102-
}
103-
104-
if ($config->hasDbEntrypoint()) {
105-
$volumesList[self::VOLUME_DOCKER_ETRYPOINT] = [];
106-
}
107-
10899
$manager->setVolumes($volumesList);
109100

110101
/**
@@ -129,11 +120,11 @@ public function build(Config $config): Manager
129120
];
130121

131122
if ($config->hasMariaDbConf()) {
132-
$dbVolumes[] = $volumePrefix . self::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d';
123+
$dbVolumes[] = self::VOLUME_MARIADB_CONF . ':/etc/mysql/mariadb.conf.d';
133124
}
134125

135126
if ($config->hasDbEntrypoint()) {
136-
$dbVolumes[] = self::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d';
127+
$dbVolumes[] = self::VOLUME_DOCKER_ENTRYPOINT . ':/docker-entrypoint-initdb.d';
137128
}
138129

139130
$manager->updateService(self::SERVICE_DB, [

src/Compose/ProductionBuilder/Service/Database/Db.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function getMounts(Config $config): array
118118
$mounts[] = $config->getNameWithPrefix() . BuilderInterface::VOLUME_MAGENTO_DB . ':/var/lib/mysql';
119119

120120
if ($config->hasDbEntrypoint()) {
121-
$mounts[] = BuilderInterface::VOLUME_DOCKER_ETRYPOINT . ':/docker-entrypoint-initdb.d';
121+
$mounts[] = BuilderInterface::VOLUME_DOCKER_ENTRYPOINT . ':/docker-entrypoint-initdb.d';
122122
}
123123

124124
return $mounts;

src/Compose/ProductionBuilder/Service/Database/DbQuote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function getMounts(Config $config): array
113113
}
114114

115115
$mounts[] = BuilderInterface::VOLUME_MAGENTO_DB_QUOTE . ':/var/lib/mysql';
116-
$mounts[] = BuilderInterface::VOLUME_DOCKER_ETRYPOINT_QUOTE . ':/docker-entrypoint-initdb.d';
116+
$mounts[] = BuilderInterface::VOLUME_DOCKER_ENTRYPOINT_QUOTE . ':/docker-entrypoint-initdb.d';
117117

118118
return $mounts;
119119
}

src/Compose/ProductionBuilder/Service/Database/DbSales.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ private function getMounts(Config $config): array
113113
}
114114

115115
$mounts[] = BuilderInterface::VOLUME_MAGENTO_DB_SALES . ':/var/lib/mysql';
116-
$mounts[] = BuilderInterface::VOLUME_DOCKER_ETRYPOINT_SALES . ':/docker-entrypoint-initdb.d';
116+
$mounts[] = BuilderInterface::VOLUME_DOCKER_ENTRYPOINT_SALES . ':/docker-entrypoint-initdb.d';
117117

118118
return $mounts;
119119
}

src/Test/Integration/BuildComposeTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ public function buildDataProvider(): array
7979
[CliSource::OPTION_WITH_MARIADB_CONF, true]
8080
]
8181
],
82+
'cloud-base-developer' => [
83+
__DIR__ . '/_files/cloud_base_developer',
84+
[
85+
[CliSource::OPTION_MODE, BuilderFactory::BUILDER_DEVELOPER],
86+
[CliSource::OPTION_WITH_ENTRYPOINT, true],
87+
[CliSource::OPTION_WITH_MARIADB_CONF, true]
88+
]
89+
],
8290
'cloud-base-mftf' => [
8391
__DIR__ . '/_files/cloud_base_mftf',
8492
[

src/Test/Integration/_files/cloud_base_developer/.docker/.gitignore

Whitespace-only changes.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
return [
4+
'MAGENTO_CLOUD_RELATIONSHIPS' => base64_encode(json_encode([
5+
'database' => [
6+
[
7+
'host' => 'db',
8+
'path' => 'magento2',
9+
'password' => 'magento2',
10+
'username' => 'magento2',
11+
'port' => '3306'
12+
]
13+
],
14+
'redis' => [
15+
[
16+
'host' => 'redis',
17+
'port' => '6379'
18+
]
19+
],
20+
'elasticsearch' => [
21+
[
22+
'host' => 'elasticsearch',
23+
'port' => '9200'
24+
]
25+
]
26+
])),
27+
'MAGENTO_CLOUD_ROUTES' => base64_encode(json_encode([
28+
'http://magento2.docker/' => [
29+
'type' => 'upstream',
30+
'original_url' => 'http://{default}'
31+
],
32+
'https://magento2.docker/' => [
33+
'type' => 'upstream',
34+
'original_url' => 'https://{default}'
35+
]
36+
])),
37+
'MAGENTO_CLOUD_VARIABLES' => base64_encode(json_encode([
38+
'ADMIN_EMAIL' => '[email protected]',
39+
'ADMIN_PASSWORD' => '123123q',
40+
'ADMIN_URL' => 'admin'
41+
])),
42+
'MAGENTO_CLOUD_APPLICATION' => base64_encode(json_encode([
43+
'hooks' => [
44+
45+
]
46+
])),
47+
];
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: mymagento
2+
3+
type: php:7.3
4+
build:
5+
flavor: composer
6+
7+
runtime:
8+
extensions:
9+
- redis
10+
- xsl
11+
- json
12+
- newrelic
13+
- sodium
14+
15+
relationships:
16+
database: "mysql:mysql"
17+
redis: "redis:redis"
18+
elasticsearch: "elasticsearch:elasticsearch"
19+
20+
mounts:
21+
"var": "shared:files/var"
22+
"app/etc": "shared:files/etc"
23+
"pub/media": "shared:files/media"
24+
"pub/static": "shared:files/static"
25+
26+
crons:
27+
cronrun:
28+
spec: "* * * * *"
29+
cmd: "php bin/magento cron:run"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mysql:
2+
type: mysql:10.2
3+
disk: 2048
4+
5+
redis:
6+
type: redis:5.0
7+
8+
elasticsearch:
9+
type: elasticsearch:6.5
10+
disk: 1024
11+
configuration:
12+
plugins:
13+
- plugin_1
14+
- plugin_2

0 commit comments

Comments
 (0)