@scandipwa/magento-scripts 2.4.0-alpha.0 → 2.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/exec.js +2 -2
- package/index.js +1 -0
- package/lib/commands/cli.js +17 -19
- package/lib/commands/execute.js +8 -4
- package/lib/commands/start.js +0 -6
- package/lib/config/docker.js +54 -45
- package/lib/config/get-project-configuration.js +0 -5
- package/lib/config/php-config.js +4 -0
- package/lib/config/port-config.js +1 -0
- package/lib/config/services/composer/versions/composer-2.8.js +1 -1
- package/lib/config/services/elasticsearch/versions/elasticsearch-8.17.js +14 -0
- package/lib/config/services/elasticsearch/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-11.4.js +9 -0
- package/lib/config/services/mariadb/versions/mariadb-11.6.js +9 -0
- package/lib/config/services/opensearch/versions/index.js +3 -1
- package/lib/config/services/opensearch/versions/opensearch-2.19.js +14 -0
- package/lib/config/services/php/extensions/ftp.js +7 -0
- package/lib/config/services/php/versions/index.js +2 -1
- package/lib/config/services/php/versions/php-7.2.js +0 -1
- package/lib/config/services/php/versions/php-7.3.js +0 -1
- package/lib/config/services/php/versions/php-7.4.js +0 -1
- package/lib/config/services/php/versions/php-8.1.js +4 -2
- package/lib/config/services/php/versions/php-8.2.js +1 -2
- package/lib/config/services/php/versions/php-8.3.js +32 -0
- package/lib/config/services/redis/index.js +6 -1
- package/lib/config/services/redis/valkey-8.0.js +8 -0
- package/lib/config/services/redis/valkey-8.1.js +8 -0
- package/lib/config/services/varnish/varnish-6-0.js +1 -1
- package/lib/config/services/varnish/varnish-6-6.js +1 -1
- package/lib/config/services/varnish/varnish-7-0.js +1 -1
- package/lib/config/services/varnish/varnish-7-1.js +1 -1
- package/lib/config/services/varnish/varnish-7-3.js +1 -1
- package/lib/config/services/varnish/varnish-7-4.js +1 -1
- package/lib/config/services/varnish/varnish-7-5.js +1 -1
- package/lib/config/services/varnish/varnish-7-6.js +1 -1
- package/lib/config/templates/nginx.template.conf +31 -8
- package/lib/config/templates/ssl-terminator.template.conf +2 -0
- package/lib/config/versions/magento-2.4.4-p13.js +40 -0
- package/lib/config/versions/magento-2.4.5-p12.js +40 -0
- package/lib/config/versions/magento-2.4.6-p10.js +40 -0
- package/lib/config/versions/magento-2.4.7-p4.js +0 -1
- package/lib/config/versions/magento-2.4.7-p5.js +41 -0
- package/lib/config/versions/magento-2.4.8.js +43 -0
- package/lib/tasks/database/create-magento-database.js +5 -4
- package/lib/tasks/docker/containers/container-api.d.ts +9 -3
- package/lib/tasks/docker/containers/container-api.js +14 -9
- package/lib/tasks/docker/containers/tasks.js +18 -12
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +14 -22
- package/lib/tasks/docker/project-image-builder.js +113 -61
- package/lib/tasks/execute.js +9 -9
- package/lib/tasks/file-system/create-php-debug-config.js +1 -2
- package/lib/tasks/file-system/create-php-fpm-debug-config.js +33 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +5 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +2 -2
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +4 -3
- package/lib/tasks/file-system/create-ssl-terminator-config.js +27 -1
- package/lib/tasks/file-system/index.js +2 -0
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +0 -1
- package/lib/tasks/php/php-container.d.ts +3 -3
- package/lib/tasks/php/php-container.js +6 -16
- package/lib/tasks/php/update-env-php.js +4 -5
- package/lib/tasks/project-config/index.js +0 -3
- package/lib/tasks/requirements/elasticsearch-version.js +4 -4
- package/lib/tasks/requirements/opensearch-version.js +4 -4
- package/lib/tasks/start.js +2 -13
- package/lib/util/execute-in-container.js +12 -8
- package/package.json +2 -2
- package/typings/context.d.ts +9 -3
- package/typings/index.d.ts +0 -5
|
@@ -6,7 +6,7 @@ const path = require('path')
|
|
|
6
6
|
* @returns {import('../../../../typings/index').VarnishConfiguration}
|
|
7
7
|
*/
|
|
8
8
|
const varnish75 = ({ templateDir }) => ({
|
|
9
|
-
enabled:
|
|
9
|
+
enabled: false,
|
|
10
10
|
healthCheck: false,
|
|
11
11
|
image: 'varnish:7.5',
|
|
12
12
|
configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
|
|
@@ -6,7 +6,7 @@ const path = require('path')
|
|
|
6
6
|
* @returns {import('../../../../typings/index').VarnishConfiguration}
|
|
7
7
|
*/
|
|
8
8
|
const varnish76 = ({ templateDir }) => ({
|
|
9
|
-
enabled:
|
|
9
|
+
enabled: false,
|
|
10
10
|
healthCheck: false,
|
|
11
11
|
image: 'varnish:7.6',
|
|
12
12
|
configTemplate: path.join(templateDir || '', 'varnish.template.vcl')
|
|
@@ -5,6 +5,33 @@ upstream fastcgi_backend {
|
|
|
5
5
|
keepalive 16;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
# Define available upstreams
|
|
9
|
+
upstream fastcgi_backend_xdebug {
|
|
10
|
+
server <%= it.hostMachine %>:<%= it.ports.fpmXdebug %>;
|
|
11
|
+
|
|
12
|
+
keepalive 16;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# XDebug mappings.
|
|
16
|
+
map $arg_XDEBUG_SESSION_START $session_arg_pass {
|
|
17
|
+
default fastcgi_backend;
|
|
18
|
+
1 fastcgi_backend_xdebug;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
map $cookie_XDEBUG_SESSION $cookie_arg_pass {
|
|
22
|
+
default $session_arg_pass;
|
|
23
|
+
xdebug fastcgi_backend_xdebug;
|
|
24
|
+
1 fastcgi_backend_xdebug;
|
|
25
|
+
PHP_STORM fastcgi_backend_xdebug;
|
|
26
|
+
PHPSTORM fastcgi_backend_xdebug;
|
|
27
|
+
XDEBUG_ECLIPSE fastcgi_backend_xdebug;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
map $arg_XDEBUG_PROFILE $xdebug_test_pass {
|
|
31
|
+
default $cookie_arg_pass;
|
|
32
|
+
1 fastcgi_backend_xdebug;
|
|
33
|
+
}
|
|
34
|
+
|
|
8
35
|
<% if (it.useStoreDomainMapping) { %>
|
|
9
36
|
map $http_host $SITE_CODE_MAPPING {
|
|
10
37
|
<% for (const [key, value] of Object.entries(it.storeDomains)) { %>
|
|
@@ -45,10 +72,8 @@ server {
|
|
|
45
72
|
location ~* ^/setup($|/) {
|
|
46
73
|
root $MAGE_ROOT;
|
|
47
74
|
location ~ ^/setup/index.php {
|
|
48
|
-
fastcgi_pass
|
|
75
|
+
fastcgi_pass $xdebug_test_pass;
|
|
49
76
|
|
|
50
|
-
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
|
|
51
|
-
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=600";
|
|
52
77
|
fastcgi_read_timeout 600s;
|
|
53
78
|
fastcgi_connect_timeout 600s;
|
|
54
79
|
|
|
@@ -89,9 +114,9 @@ server {
|
|
|
89
114
|
}
|
|
90
115
|
|
|
91
116
|
location ~* \.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2|html|json|webmanifest)$ {
|
|
92
|
-
add_header Cache-Control "
|
|
117
|
+
add_header Cache-Control "no-store";
|
|
93
118
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
94
|
-
expires
|
|
119
|
+
expires off;
|
|
95
120
|
|
|
96
121
|
if (!-f $request_filename) {
|
|
97
122
|
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
|
|
@@ -167,12 +192,10 @@ server {
|
|
|
167
192
|
# PHP entry point for main application
|
|
168
193
|
location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check|_intellij_phpdebug_validator)\.php$ {
|
|
169
194
|
try_files $uri =404;
|
|
170
|
-
fastcgi_pass
|
|
195
|
+
fastcgi_pass $xdebug_test_pass;
|
|
171
196
|
fastcgi_buffers 16 16k;
|
|
172
197
|
fastcgi_buffer_size 32k;
|
|
173
198
|
|
|
174
|
-
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
|
|
175
|
-
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
|
|
176
199
|
fastcgi_read_timeout 600s;
|
|
177
200
|
fastcgi_connect_timeout 600s;
|
|
178
201
|
|
|
@@ -12,7 +12,9 @@ upstream app_backend {
|
|
|
12
12
|
server {
|
|
13
13
|
<% if (it.config.ssl.enabled && it.config.ssl.external_provider === false) { %> listen 443 ssl;
|
|
14
14
|
|
|
15
|
+
<% if (!it.isSSLDirectiveDeprecated) { %>
|
|
15
16
|
ssl on;
|
|
17
|
+
<% } %>
|
|
16
18
|
ssl_certificate /etc/nginx/conf.d/ssl_certificate.pem;
|
|
17
19
|
ssl_certificate_key /etc/nginx/conf.d/ssl_certificate-key.pem;
|
|
18
20
|
ssl_protocols TLSv1.2;<% } else { %>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php81 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish76 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer22 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb106 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.4-p13',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php81({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.1-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb106(),
|
|
33
|
+
elasticsearch: elasticsearch717(),
|
|
34
|
+
composer: composer22(),
|
|
35
|
+
varnish: varnish76({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php81 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish76 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer22 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb106 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.5-p12',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php81({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.1-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb106(),
|
|
33
|
+
elasticsearch: elasticsearch717(),
|
|
34
|
+
composer: composer22(),
|
|
35
|
+
varnish: varnish76({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php81 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish76 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer22 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb106 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch717 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.6-p10',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php81({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.1-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb106(),
|
|
33
|
+
elasticsearch: elasticsearch717(),
|
|
34
|
+
composer: composer22(),
|
|
35
|
+
varnish: varnish76({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219()
|
|
39
|
+
}
|
|
40
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const {
|
|
3
|
+
magento24PHPExtensionList
|
|
4
|
+
} = require('../magento/required-php-extensions')
|
|
5
|
+
const { php82 } = require('../services/php/versions')
|
|
6
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
7
|
+
const { varnish76 } = require('../services/varnish')
|
|
8
|
+
const { repo } = require('../services/php/base-repo')
|
|
9
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
10
|
+
const { composer28 } = require('../services/composer/versions')
|
|
11
|
+
const { maildev } = require('../services/maildev')
|
|
12
|
+
const { redis72 } = require('../services/redis')
|
|
13
|
+
const { mariadb106 } = require('../services/mariadb/versions')
|
|
14
|
+
const { elasticsearch817 } = require('../services/elasticsearch/versions')
|
|
15
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
16
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
20
|
+
*/
|
|
21
|
+
module.exports = ({ templateDir }) => ({
|
|
22
|
+
magentoVersion: '2.4.7-p5',
|
|
23
|
+
configuration: {
|
|
24
|
+
php: php82({
|
|
25
|
+
templateDir,
|
|
26
|
+
extensions: { ...magento24PHPExtensionList, sodium },
|
|
27
|
+
baseImage: `${repo}:php-8.2-magento-2.4`
|
|
28
|
+
}),
|
|
29
|
+
nginx: nginx126({ templateDir }),
|
|
30
|
+
redis: redis72(),
|
|
31
|
+
mysql: mysql80(),
|
|
32
|
+
mariadb: mariadb106(),
|
|
33
|
+
elasticsearch: elasticsearch817(),
|
|
34
|
+
composer: composer28(),
|
|
35
|
+
varnish: varnish76({ templateDir }),
|
|
36
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
37
|
+
maildev: maildev(),
|
|
38
|
+
opensearch: opensearch219(),
|
|
39
|
+
searchengine: 'opensearch'
|
|
40
|
+
}
|
|
41
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const sodium = require('../services/php/extensions/sodium')
|
|
2
|
+
const ftp = require('../services/php/extensions/ftp')
|
|
3
|
+
const {
|
|
4
|
+
magento24PHPExtensionList
|
|
5
|
+
} = require('../magento/required-php-extensions')
|
|
6
|
+
const { php83 } = require('../services/php/versions')
|
|
7
|
+
const { sslTerminator } = require('../services/ssl-terminator')
|
|
8
|
+
const { varnish76 } = require('../services/varnish')
|
|
9
|
+
const { repo } = require('../services/php/base-repo')
|
|
10
|
+
const { nginx126 } = require('../services/nginx/versions')
|
|
11
|
+
const { composer28 } = require('../services/composer/versions')
|
|
12
|
+
const { maildev } = require('../services/maildev')
|
|
13
|
+
const { valkey80 } = require('../services/redis')
|
|
14
|
+
const { mariadb114 } = require('../services/mariadb/versions')
|
|
15
|
+
const { elasticsearch817 } = require('../services/elasticsearch/versions')
|
|
16
|
+
const { mysql80 } = require('../services/mysql/versions')
|
|
17
|
+
const { opensearch219 } = require('../services/opensearch/versions')
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @type {import('../../../typings/common').MagentoVersionConfigurationFunction}
|
|
21
|
+
*/
|
|
22
|
+
module.exports = ({ templateDir }) => ({
|
|
23
|
+
magentoVersion: '2.4.8',
|
|
24
|
+
isDefault: true,
|
|
25
|
+
configuration: {
|
|
26
|
+
php: php83({
|
|
27
|
+
templateDir,
|
|
28
|
+
extensions: { ...magento24PHPExtensionList, sodium, ftp },
|
|
29
|
+
baseImage: `${repo}:php-8.3-magento-2.4`
|
|
30
|
+
}),
|
|
31
|
+
nginx: nginx126({ templateDir }),
|
|
32
|
+
redis: valkey80(),
|
|
33
|
+
mysql: mysql80(),
|
|
34
|
+
mariadb: mariadb114(),
|
|
35
|
+
elasticsearch: elasticsearch817(),
|
|
36
|
+
composer: composer28(),
|
|
37
|
+
varnish: varnish76({ templateDir }),
|
|
38
|
+
sslTerminator: sslTerminator({ templateDir }),
|
|
39
|
+
maildev: maildev(),
|
|
40
|
+
opensearch: opensearch219(),
|
|
41
|
+
searchengine: 'opensearch'
|
|
42
|
+
}
|
|
43
|
+
})
|
|
@@ -9,10 +9,11 @@ const createMagentoDatabase = () => ({
|
|
|
9
9
|
task: async (ctx, task) => {
|
|
10
10
|
const { mariadb } = ctx.config.docker.getContainers()
|
|
11
11
|
task.title = `Creating Magento database in ${mariadb._}`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
mariadb.
|
|
15
|
-
|
|
12
|
+
|
|
13
|
+
await containerApi.exec({
|
|
14
|
+
command: `mariadb -uroot -p${mariadb.env.MARIADB_ROOT_PASSWORD} -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`,
|
|
15
|
+
container: mariadb.name
|
|
16
|
+
})
|
|
16
17
|
}
|
|
17
18
|
})
|
|
18
19
|
|
|
@@ -38,6 +38,12 @@ export function ls(
|
|
|
38
38
|
): Promise<ContainerLsResult[]>
|
|
39
39
|
|
|
40
40
|
export interface ContainerExecOptions {
|
|
41
|
+
command: string
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* container id or name
|
|
45
|
+
*/
|
|
46
|
+
container: string
|
|
41
47
|
/**
|
|
42
48
|
* Set environment variables [docs](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file)
|
|
43
49
|
*/
|
|
@@ -60,12 +66,12 @@ export interface ContainerExecOptions {
|
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
export function exec<T>(
|
|
63
|
-
|
|
64
|
-
container: string,
|
|
65
|
-
options?: ContainerExecOptions,
|
|
69
|
+
options: ContainerExecOptions,
|
|
66
70
|
execOptions?: ExecAsyncSpawnOptions<T>
|
|
67
71
|
): Promise<string>
|
|
68
72
|
|
|
73
|
+
export function execCommand(options: ContainerExecOptions): string[]
|
|
74
|
+
|
|
69
75
|
export interface ContainerRunOptions {
|
|
70
76
|
/**
|
|
71
77
|
* Add a custom host-to-IP mapping (host:ip)
|
|
@@ -100,13 +100,10 @@ const run = (options, execOptions = {}) =>
|
|
|
100
100
|
execAsyncSpawn(runCommand(options).join(' '), execOptions)
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* @param {string} command
|
|
104
|
-
* @param {string} container container id or name
|
|
105
103
|
* @param {import('./container-api').ContainerExecOptions} options
|
|
106
|
-
* @param {import('../../../util/exec-async-command').ExecAsyncSpawnOptions<false>} execOptions
|
|
107
104
|
*/
|
|
108
|
-
const
|
|
109
|
-
const { env, tty, user, workdir } = options
|
|
105
|
+
const execCommand = (options) => {
|
|
106
|
+
const { command, container, env, tty, user, workdir } = options
|
|
110
107
|
const envArgs = !env
|
|
111
108
|
? ''
|
|
112
109
|
: Object.entries(env)
|
|
@@ -116,7 +113,7 @@ const exec = (command, container, options = {}, execOptions = {}) => {
|
|
|
116
113
|
const userArg = user ? `--user=${user}` : ''
|
|
117
114
|
const workdirArg = workdir ? `--workdir=${workdir}` : ''
|
|
118
115
|
|
|
119
|
-
const
|
|
116
|
+
const dockerCommand = [
|
|
120
117
|
'docker',
|
|
121
118
|
'container',
|
|
122
119
|
'exec',
|
|
@@ -127,12 +124,19 @@ const exec = (command, container, options = {}, execOptions = {}) => {
|
|
|
127
124
|
container,
|
|
128
125
|
command
|
|
129
126
|
]
|
|
130
|
-
.
|
|
131
|
-
.
|
|
127
|
+
.flat()
|
|
128
|
+
.filter((arg) => !!arg && typeof arg === 'string')
|
|
132
129
|
|
|
133
|
-
return
|
|
130
|
+
return dockerCommand
|
|
134
131
|
}
|
|
135
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @param {import('./container-api').ContainerExecOptions} options
|
|
135
|
+
* @param {import('../../../util/exec-async-command').ExecAsyncSpawnOptions<false>} execOptions
|
|
136
|
+
*/
|
|
137
|
+
const exec = (options, execOptions = {}) =>
|
|
138
|
+
execAsyncSpawn(execCommand(options).join(' '), execOptions)
|
|
139
|
+
|
|
136
140
|
/**
|
|
137
141
|
* @type {typeof import('./container-api')['ls']}
|
|
138
142
|
*/
|
|
@@ -243,6 +247,7 @@ module.exports = {
|
|
|
243
247
|
run,
|
|
244
248
|
runCommand,
|
|
245
249
|
exec,
|
|
250
|
+
execCommand,
|
|
246
251
|
ls,
|
|
247
252
|
logs,
|
|
248
253
|
stop,
|
|
@@ -34,6 +34,17 @@ const remoteImageReducer = (acc, val) => {
|
|
|
34
34
|
return acc.concat([val.image])
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* @param {{ pullImage?: boolean }} param0
|
|
39
|
+
*/
|
|
40
|
+
const filterNonPullableImages = ({ pullImage }) => {
|
|
41
|
+
if (typeof pullImage === 'boolean' && !pullImage) {
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
/**
|
|
38
49
|
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
39
50
|
*/
|
|
@@ -45,6 +56,7 @@ const pullImages = () => ({
|
|
|
45
56
|
if (pullImages) {
|
|
46
57
|
return task.newListr(
|
|
47
58
|
containers
|
|
59
|
+
.filter(filterNonPullableImages)
|
|
48
60
|
.reduce(remoteImageReducer, [])
|
|
49
61
|
.map((image) => {
|
|
50
62
|
const [repo, tag = 'latest'] = image.split(':')
|
|
@@ -77,6 +89,7 @@ const pullImages = () => ({
|
|
|
77
89
|
}
|
|
78
90
|
|
|
79
91
|
const imagesFilter = containers
|
|
92
|
+
.filter(filterNonPullableImages)
|
|
80
93
|
.reduce(remoteImageReducer, [])
|
|
81
94
|
.map((image) => `reference='${image}'`)
|
|
82
95
|
|
|
@@ -86,6 +99,7 @@ const pullImages = () => ({
|
|
|
86
99
|
})
|
|
87
100
|
|
|
88
101
|
const missingContainerImages = containers
|
|
102
|
+
.filter(filterNonPullableImages)
|
|
89
103
|
.reduce(remoteImageReducer, [])
|
|
90
104
|
.map((image) => {
|
|
91
105
|
const [repo, tag = 'latest'] = image.split(':')
|
|
@@ -151,19 +165,11 @@ const startContainers = () => ({
|
|
|
151
165
|
|
|
152
166
|
if (debug) {
|
|
153
167
|
await Promise.all(
|
|
154
|
-
missingContainers
|
|
155
|
-
.
|
|
156
|
-
|
|
157
|
-
container.image = container.debugImage
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return container
|
|
168
|
+
missingContainers.map((container) =>
|
|
169
|
+
containerApi.run(container).then((out) => {
|
|
170
|
+
task.output = `From ${container._}: ${out}`
|
|
161
171
|
})
|
|
162
|
-
|
|
163
|
-
containerApi.run(container).then((out) => {
|
|
164
|
-
task.output = `From ${container._}: ${out}`
|
|
165
|
-
})
|
|
166
|
-
)
|
|
172
|
+
)
|
|
167
173
|
)
|
|
168
174
|
|
|
169
175
|
return
|
|
@@ -11,10 +11,7 @@ const {
|
|
|
11
11
|
getCachedPorts
|
|
12
12
|
} = require('../../config/get-port-config')
|
|
13
13
|
const { saveConfiguration } = require('../../config/save-config')
|
|
14
|
-
const {
|
|
15
|
-
buildProjectImage,
|
|
16
|
-
buildDebugProjectImage
|
|
17
|
-
} = require('./project-image-builder')
|
|
14
|
+
const { buildProjectImage } = require('./project-image-builder')
|
|
18
15
|
const checkPHPVersion = require('../requirements/php-version')
|
|
19
16
|
const { getComposerVersionTask } = require('../composer')
|
|
20
17
|
const { prepareFileSystem } = require('../file-system')
|
|
@@ -190,15 +187,18 @@ Please wait, this will take some time and do not restart the MySQL container unt
|
|
|
190
187
|
task.output = 'Dumping MySQL database to dump file...'
|
|
191
188
|
|
|
192
189
|
await containerApi.exec(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
{
|
|
191
|
+
container: containerName,
|
|
192
|
+
command: [
|
|
193
|
+
'mysqldump',
|
|
194
|
+
'--user=root',
|
|
195
|
+
'--password=scandipwa',
|
|
196
|
+
'magento',
|
|
197
|
+
`--result-file=${
|
|
198
|
+
path.parse(pathToMySQLDumpFile).base
|
|
199
|
+
}`
|
|
200
|
+
].join(' ')
|
|
201
|
+
},
|
|
202
202
|
{
|
|
203
203
|
callback: (t) => {
|
|
204
204
|
task.output = t
|
|
@@ -234,15 +234,7 @@ Please wait, this will take some time and do not restart the MySQL container unt
|
|
|
234
234
|
pullImages(),
|
|
235
235
|
dockerNetwork.tasks.createNetwork(),
|
|
236
236
|
createVolumes(),
|
|
237
|
-
|
|
238
|
-
task: (ctx, task) =>
|
|
239
|
-
task.newListr(
|
|
240
|
-
[buildProjectImage(), buildDebugProjectImage()],
|
|
241
|
-
{
|
|
242
|
-
concurrent: true
|
|
243
|
-
}
|
|
244
|
-
)
|
|
245
|
-
},
|
|
237
|
+
buildProjectImage(),
|
|
246
238
|
{
|
|
247
239
|
task: (ctx, subTask) =>
|
|
248
240
|
subTask.newListr(
|