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

+3-3
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

+2-11
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

+1-1
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

+1-1
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

+1-1
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

+8
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.
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+
];
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"
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "magento/project-enterprise-edition",
3+
"description": "Composer file for integration tests",
4+
"type": "project",
5+
"version": "2.2.0"
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
version: '2.1'
2+
services:
3+
db:
4+
hostname: db.magento2.docker
5+
image: 'mariadb:10.2'
6+
environment:
7+
- MYSQL_ROOT_PASSWORD=magento2
8+
- MYSQL_DATABASE=magento2
9+
- MYSQL_USER=magento2
10+
- MYSQL_PASSWORD=magento2
11+
ports:
12+
- '3306'
13+
volumes:
14+
- '.:/app:delegated'
15+
- 'mymagento-magento-db:/var/lib/mysql'
16+
- '.docker/mysql/mariadb.conf.d:/etc/mysql/mariadb.conf.d'
17+
- '.docker/mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d'
18+
healthcheck:
19+
test: 'mysqladmin ping -h localhost -pmagento2'
20+
interval: 30s
21+
timeout: 30s
22+
retries: 3
23+
networks:
24+
magento:
25+
aliases:
26+
- db.magento2.docker
27+
redis:
28+
hostname: redis.magento2.docker
29+
image: 'redis:5.0'
30+
volumes:
31+
- '.:/app:delegated'
32+
ports:
33+
- 6379
34+
healthcheck:
35+
test: 'redis-cli ping || exit 1'
36+
interval: 30s
37+
timeout: 30s
38+
retries: 3
39+
networks:
40+
magento:
41+
aliases:
42+
- redis.magento2.docker
43+
elasticsearch:
44+
hostname: elasticsearch.magento2.docker
45+
image: 'magento/magento-cloud-docker-elasticsearch:6.5-1.2.0'
46+
environment:
47+
- 'ES_PLUGINS=plugin_1 plugin_2'
48+
networks:
49+
magento:
50+
aliases:
51+
- elasticsearch.magento2.docker
52+
fpm:
53+
hostname: fpm.magento2.docker
54+
image: 'magento/magento-cloud-docker-php:7.3-fpm-1.2.0'
55+
extends: generic
56+
volumes:
57+
- '.:/app:delegated'
58+
networks:
59+
magento:
60+
aliases:
61+
- fpm.magento2.docker
62+
depends_on:
63+
db:
64+
condition: service_healthy
65+
web:
66+
hostname: web.magento2.docker
67+
image: 'magento/magento-cloud-docker-nginx:1.19-1.2.0'
68+
extends: generic
69+
volumes:
70+
- '.:/app:delegated'
71+
environment:
72+
- WITH_XDEBUG=0
73+
- NGINX_WORKER_PROCESSES=1
74+
- NGINX_WORKER_CONNECTIONS=1024
75+
networks:
76+
magento:
77+
aliases:
78+
- web.magento2.docker
79+
depends_on:
80+
fpm:
81+
condition: service_started
82+
varnish:
83+
hostname: varnish.magento2.docker
84+
image: 'magento/magento-cloud-docker-varnish:6.2-1.2.0'
85+
networks:
86+
magento:
87+
aliases:
88+
- varnish.magento2.docker
89+
depends_on:
90+
web:
91+
condition: service_started
92+
tls:
93+
hostname: tls.magento2.docker
94+
image: 'magento/magento-cloud-docker-nginx:1.19-1.2.0'
95+
extends: generic
96+
networks:
97+
magento:
98+
aliases:
99+
- magento2.docker
100+
environment:
101+
- NGINX_WORKER_PROCESSES=1
102+
- NGINX_WORKER_CONNECTIONS=1024
103+
- UPSTREAM_HOST=varnish
104+
- UPSTREAM_PORT=80
105+
ports:
106+
- '80:80'
107+
- '443:443'
108+
depends_on:
109+
varnish:
110+
condition: service_started
111+
generic:
112+
hostname: generic.magento2.docker
113+
image: 'magento/magento-cloud-docker-php:7.3-cli-1.2.0'
114+
env_file: ./.docker/config.env
115+
environment:
116+
- MAGENTO_RUN_MODE=developer
117+
- 'PHP_EXTENSIONS=bcmath bz2 calendar exif gd gettext intl mysqli pcntl pdo_mysql soap sockets sysvmsg sysvsem sysvshm opcache zip redis xsl sodium'
118+
build:
119+
hostname: build.magento2.docker
120+
image: 'magento/magento-cloud-docker-php:7.3-cli-1.2.0'
121+
extends: generic
122+
volumes:
123+
- '.:/app:delegated'
124+
networks:
125+
magento-build:
126+
aliases:
127+
- build.magento2.docker
128+
depends_on:
129+
db:
130+
condition: service_healthy
131+
redis:
132+
condition: service_healthy
133+
elasticsearch:
134+
condition: service_healthy
135+
deploy:
136+
hostname: deploy.magento2.docker
137+
image: 'magento/magento-cloud-docker-php:7.3-cli-1.2.0'
138+
extends: generic
139+
volumes:
140+
- '.:/app:delegated'
141+
networks:
142+
magento:
143+
aliases:
144+
- deploy.magento2.docker
145+
depends_on:
146+
db:
147+
condition: service_healthy
148+
redis:
149+
condition: service_healthy
150+
elasticsearch:
151+
condition: service_healthy
152+
mailhog:
153+
hostname: mailhog.magento2.docker
154+
image: 'mailhog/mailhog:latest'
155+
ports:
156+
- '1025:1025'
157+
- '8025:8025'
158+
networks:
159+
magento:
160+
aliases:
161+
- mailhog.magento2.docker
162+
volumes:
163+
mymagento-magento-db: { }
164+
networks:
165+
magento:
166+
driver: bridge
167+
magento-build:
168+
driver: bridge

0 commit comments

Comments
 (0)