@scandipwa/magento-scripts 1.14.1-alpha.1 → 1.14.1-alpha.10
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/index.js +13 -0
- package/lib/commands/cli.js +28 -1
- package/lib/commands/execute.js +2 -1
- package/lib/config/docker.js +85 -12
- package/lib/config/get-port-config.js +7 -2
- package/lib/config/port-config.js +3 -1
- package/lib/config/scandipwa-versions.js +2 -1
- package/lib/config/ssl-terminator/index.js +10 -0
- package/lib/config/templates/magentorc.template +3 -5
- package/lib/config/templates/nginx.template.conf +0 -14
- package/lib/config/templates/php.template.ini +6 -4
- package/lib/config/templates/ssl-terminator.template.conf +27 -0
- package/lib/config/templates/varnish.template.vcl +250 -0
- package/lib/config/varnish/varnish-6-0.js +11 -0
- package/lib/config/varnish/varnish-6-6.js +11 -0
- package/lib/config/varnish/varnish-7-0.js +11 -0
- package/lib/config/versions/magento-2.3.0.js +9 -1
- package/lib/config/versions/magento-2.3.1.js +9 -1
- package/lib/config/versions/magento-2.3.2-p2.js +9 -1
- package/lib/config/versions/magento-2.3.2.js +9 -1
- package/lib/config/versions/magento-2.3.3-p1.js +9 -1
- package/lib/config/versions/magento-2.3.3.js +9 -1
- package/lib/config/versions/magento-2.3.4-p2.js +9 -1
- package/lib/config/versions/magento-2.3.4.js +9 -1
- package/lib/config/versions/magento-2.3.5-p1.js +9 -1
- package/lib/config/versions/magento-2.3.5-p2.js +9 -1
- package/lib/config/versions/magento-2.3.5.js +9 -1
- package/lib/config/versions/magento-2.3.6-p1.js +9 -1
- package/lib/config/versions/magento-2.3.6.js +9 -1
- package/lib/config/versions/magento-2.3.7-p1.js +9 -1
- package/lib/config/versions/magento-2.3.7-p2.js +9 -1
- package/lib/config/versions/magento-2.3.7-p3.js +9 -1
- package/lib/config/versions/magento-2.3.7.js +9 -1
- package/lib/config/versions/magento-2.4.0-p1.js +9 -1
- package/lib/config/versions/magento-2.4.0.js +9 -1
- package/lib/config/versions/magento-2.4.1-p1.js +9 -1
- package/lib/config/versions/magento-2.4.1.js +9 -1
- package/lib/config/versions/magento-2.4.2-p1.js +9 -1
- package/lib/config/versions/magento-2.4.2-p2.js +9 -1
- package/lib/config/versions/magento-2.4.2.js +9 -1
- package/lib/config/versions/magento-2.4.3-p1.js +9 -1
- package/lib/config/versions/magento-2.4.3-p2.js +9 -1
- package/lib/config/versions/magento-2.4.3.js +9 -1
- package/lib/config/versions/magento-2.4.4.js +9 -1
- package/lib/tasks/cli/create-bashrc-config.js +5 -2
- package/lib/tasks/docker/containers.js +13 -8
- package/lib/tasks/docker/volumes.js +4 -4
- package/lib/tasks/file-system/create-nginx-config.js +7 -39
- package/lib/tasks/file-system/create-php-storm-config.js +82 -0
- package/lib/tasks/file-system/create-ssl-terminator-config.js +94 -0
- package/lib/tasks/file-system/create-varnish-config.js +74 -0
- package/lib/tasks/file-system/index.js +6 -2
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +1 -1
- package/lib/tasks/magento/setup-magento/disable-2fa.js +4 -12
- package/lib/tasks/magento/setup-magento/disable-full-page-cache.js +20 -0
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +14 -16
- package/lib/tasks/magento/setup-magento/migrate-database.js +24 -11
- package/lib/tasks/magento/setup-magento/set-base-url.js +7 -2
- package/lib/tasks/magento/setup-magento/upgrade-magento.js +17 -3
- package/lib/tasks/magento/setup-magento/varnish-config.js +69 -0
- package/lib/tasks/mysql/fix-db.js +2 -2
- package/lib/tasks/php/index.js +1 -1
- package/lib/tasks/php/update-env-php.js +16 -1
- package/lib/tasks/php/update-env.php +56 -12
- package/lib/tasks/requirements/docker/index.js +2 -0
- package/lib/tasks/requirements/docker/install.js +11 -11
- package/lib/tasks/requirements/docker/running-status.js +137 -0
- package/lib/tasks/requirements/docker/version.js +2 -0
- package/lib/tasks/requirements/index.js +5 -5
- package/lib/tasks/requirements/php-version.js +3 -1
- package/lib/tasks/start.js +3 -8
- package/lib/tasks/status/index.js +25 -9
- package/lib/tasks/theme/build-theme.js +26 -8
- package/lib/tasks/theme/install-theme.js +16 -4
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/tasks/theme/setup-persisted-query.js +3 -3
- package/lib/tasks/theme/setup-themes.js +3 -2
- package/lib/tasks/theme/symlink-theme.js +18 -3
- package/lib/util/config-file-validator.js +12 -1
- package/lib/util/config-php-json.js +19 -0
- package/lib/util/instance-metadata.js +2 -2
- package/lib/util/is-running-root.js +3 -0
- package/lib/util/match-filesystem.js +2 -1
- package/lib/util/php-task.js +6 -2
- package/lib/util/run-php.js +7 -1
- package/lib/util/systemctl.js +46 -0
- package/package.json +2 -3
- package/typings/context.d.ts +5 -3
- package/typings/index.d.ts +32 -1
- package/lib/config/xml-parser.js +0 -61
- package/lib/tasks/file-system/create-phpstorm-config/database-config.js +0 -248
- package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +0 -83
- package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +0 -154
- package/lib/tasks/file-system/create-phpstorm-config/index.js +0 -27
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/coding-standard-config.js +0 -29
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/config.js +0 -54
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/custom-ruleset-path-config.js +0 -31
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/default-properties-config.js +0 -42
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/eslint-inspection-config.js +0 -37
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +0 -80
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/magento-coding-standard-config.js +0 -29
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/mess-detector-validation-inspection-config.js +0 -145
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/paths.js +0 -20
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-fixer-validation-inspection-config.js +0 -60
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-validation-inspection-config.js +0 -119
- package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/stylelint-inspection-config.js +0 -37
- package/lib/tasks/file-system/create-phpstorm-config/keys.js +0 -14
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +0 -67
- package/lib/tasks/file-system/create-phpstorm-config/php-config/mess-detector-config.js +0 -57
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-code-sniffer-config.js +0 -76
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-cs-fixer-config.js +0 -63
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-project-shared-configuration-config.js +0 -69
- package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +0 -77
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +0 -98
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/format-setting-config.js +0 -57
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +0 -66
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +0 -64
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +0 -60
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/properties-component-config.js +0 -51
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/run-manager-config.js +0 -74
- package/lib/tasks/file-system/create-phpstorm-config/xml-utils.js +0 -5
- package/lib/tasks/magento/setup-magento/adjust-magento-configuration.js +0 -27
- package/lib/tasks/magento/setup-magento/disable-page-cache.js +0 -11
- package/typings/phpstorm.d.ts +0 -33
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.2-p1',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.2'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish66({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.2-p2',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.2'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish66({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.2',
|
|
@@ -19,6 +21,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
19
21
|
fileinfo: {},
|
|
20
22
|
xdebug: {
|
|
21
23
|
version: '3.1.2'
|
|
24
|
+
},
|
|
25
|
+
apcu: {},
|
|
26
|
+
opcache: {
|
|
27
|
+
extensionName: 'Zend OPcache'
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
},
|
|
@@ -40,7 +46,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
40
46
|
},
|
|
41
47
|
composer: {
|
|
42
48
|
version: '2'
|
|
43
|
-
}
|
|
49
|
+
},
|
|
50
|
+
varnish: varnish66({ templateDir }),
|
|
51
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
44
52
|
},
|
|
45
53
|
magento: defaultMagentoConfig,
|
|
46
54
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.3-p1',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.2'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish66({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.3-p2',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.2'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish66({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish66 } = require('../varnish/varnish-6-6');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.3',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.2'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish66({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { defaultMagentoConfig } = require('../magento-config');
|
|
3
3
|
const { libsodium } = require('../php/extensions');
|
|
4
|
+
const { sslTerminator } = require('../ssl-terminator');
|
|
5
|
+
const { varnish70 } = require('../varnish/varnish-7-0');
|
|
4
6
|
|
|
5
7
|
module.exports = ({ templateDir } = {}) => ({
|
|
6
8
|
magentoVersion: '2.4.4',
|
|
@@ -20,6 +22,10 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
20
22
|
fileinfo: {},
|
|
21
23
|
xdebug: {
|
|
22
24
|
version: '3.1.4'
|
|
25
|
+
},
|
|
26
|
+
apcu: {},
|
|
27
|
+
opcache: {
|
|
28
|
+
extensionName: 'Zend OPcache'
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
},
|
|
@@ -41,7 +47,9 @@ module.exports = ({ templateDir } = {}) => ({
|
|
|
41
47
|
},
|
|
42
48
|
composer: {
|
|
43
49
|
version: '2'
|
|
44
|
-
}
|
|
50
|
+
},
|
|
51
|
+
varnish: varnish70({ templateDir }),
|
|
52
|
+
sslTerminator: sslTerminator({ templateDir })
|
|
45
53
|
},
|
|
46
54
|
magento: defaultMagentoConfig,
|
|
47
55
|
host: 'localhost',
|
|
@@ -6,14 +6,17 @@ const setConfigFile = require('../../util/set-config');
|
|
|
6
6
|
*/
|
|
7
7
|
const createBashrcConfigFile = () => ({
|
|
8
8
|
title: 'Setting Bashrc config',
|
|
9
|
-
task: async (
|
|
9
|
+
task: async (ctx) => {
|
|
10
|
+
const { config: { php, baseConfig, overridenConfiguration } } = ctx;
|
|
11
|
+
const varnishEnabled = overridenConfiguration.configuration.varnish.enabled;
|
|
10
12
|
try {
|
|
11
13
|
await setConfigFile({
|
|
12
14
|
configPathname: path.join(baseConfig.cacheDir, '.magentorc'),
|
|
13
15
|
template: path.join(baseConfig.templateDir, 'magentorc.template'),
|
|
14
16
|
overwrite: true,
|
|
15
17
|
templateArgs: {
|
|
16
|
-
php
|
|
18
|
+
php,
|
|
19
|
+
varnishEnabled
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
22
|
} catch (e) {
|
|
@@ -14,6 +14,7 @@ const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
|
14
14
|
* @param {string} [options.command] Container command
|
|
15
15
|
* @param {Record<"cmd" | "interval" | "retries" | "start-period" | "timeout", string>} [options.healthCheck] Container heathcheck properties
|
|
16
16
|
* @param {string[]} [options.securityOptions] Security options [docs](https://docs.docker.com/engine/reference/commandline/run/#optional-security-options---security-opt)
|
|
17
|
+
* @param {string[]} [options.tmpfs]
|
|
17
18
|
*/
|
|
18
19
|
const run = (options) => {
|
|
19
20
|
const {
|
|
@@ -28,9 +29,12 @@ const run = (options) => {
|
|
|
28
29
|
entrypoint,
|
|
29
30
|
command = '',
|
|
30
31
|
healthCheck,
|
|
31
|
-
securityOptions = []
|
|
32
|
+
securityOptions = [],
|
|
33
|
+
tmpfs = [],
|
|
34
|
+
expose = []
|
|
32
35
|
} = options;
|
|
33
36
|
|
|
37
|
+
const exposeArg = expose && expose.map((e) => `--expose=${ e }`);
|
|
34
38
|
const restartArg = restart && `--restart ${ restart }`;
|
|
35
39
|
const networkArg = network && `--network ${ network }`;
|
|
36
40
|
const portsArgs = ports.map((port) => `-p ${ port }`).join(' ');
|
|
@@ -41,6 +45,7 @@ const run = (options) => {
|
|
|
41
45
|
const entrypointArg = entrypoint && `--entrypoint "${entrypoint}"`;
|
|
42
46
|
const healthCheckArg = healthCheck && Object.entries(healthCheck).map(([key, value]) => `--health-${key} '${value}'`).join(' ');
|
|
43
47
|
const securityArg = securityOptions.length > 0 && securityOptions.map((opt) => `--security-opt ${opt}`).join(' ');
|
|
48
|
+
const tmpfsArg = tmpfs.length > 0 && tmpfs.map((t) => `--tmpfs ${t}`).join(' ');
|
|
44
49
|
|
|
45
50
|
const dockerCommand = [
|
|
46
51
|
'docker',
|
|
@@ -50,12 +55,14 @@ const run = (options) => {
|
|
|
50
55
|
networkArg,
|
|
51
56
|
restartArg,
|
|
52
57
|
portsArgs,
|
|
58
|
+
exposeArg,
|
|
53
59
|
mountsArgs,
|
|
54
60
|
mountVolumesArgs,
|
|
55
61
|
envArgs,
|
|
56
62
|
entrypointArg,
|
|
57
63
|
healthCheckArg,
|
|
58
64
|
securityArg,
|
|
65
|
+
tmpfsArg,
|
|
59
66
|
image,
|
|
60
67
|
command
|
|
61
68
|
].filter(Boolean).join(' ');
|
|
@@ -107,7 +114,7 @@ const pullContainers = () => ({
|
|
|
107
114
|
const startContainers = () => ({
|
|
108
115
|
title: 'Starting containers',
|
|
109
116
|
task: async ({ ports, config: { docker } }, task) => {
|
|
110
|
-
const containerList = await execAsyncSpawn('docker container ls');
|
|
117
|
+
const containerList = (await execAsyncSpawn('docker container ls --all --format="{{.Names}}"')).split('\n');
|
|
111
118
|
|
|
112
119
|
const missingContainers = Object.values(docker.getContainers(ports)).filter(
|
|
113
120
|
({ name }) => !containerList.includes(name)
|
|
@@ -133,19 +140,17 @@ const startContainers = () => ({
|
|
|
133
140
|
*/
|
|
134
141
|
const stopContainers = () => ({
|
|
135
142
|
title: 'Stopping Docker containers',
|
|
136
|
-
task: async ({
|
|
137
|
-
const containerList = await execAsyncSpawn('docker container ls
|
|
143
|
+
task: async ({ config: { baseConfig: { prefix } } }, task) => {
|
|
144
|
+
const containerList = (await execAsyncSpawn('docker container ls --all --format="{{.Names}}"')).split('\n');
|
|
138
145
|
|
|
139
|
-
const runningContainers =
|
|
140
|
-
({ name }) => containerList.includes(name)
|
|
141
|
-
);
|
|
146
|
+
const runningContainers = containerList.filter((containerName) => containerName.startsWith(prefix));
|
|
142
147
|
|
|
143
148
|
if (runningContainers.length === 0) {
|
|
144
149
|
task.skip();
|
|
145
150
|
return;
|
|
146
151
|
}
|
|
147
152
|
|
|
148
|
-
await stop(runningContainers
|
|
153
|
+
await stop(runningContainers);
|
|
149
154
|
}
|
|
150
155
|
});
|
|
151
156
|
|
|
@@ -20,10 +20,10 @@ const create = ({
|
|
|
20
20
|
const createVolumes = () => ({
|
|
21
21
|
title: 'Creating volumes',
|
|
22
22
|
task: async ({ config: { docker } }, task) => {
|
|
23
|
-
const volumeList = (await execAsyncSpawn('docker volume ls
|
|
23
|
+
const volumeList = (await execAsyncSpawn('docker volume ls --format "{{.Name}}"')).split('\n');
|
|
24
24
|
|
|
25
25
|
const missingVolumes = Object.values(docker.volumes).filter(
|
|
26
|
-
({ name }) => !volumeList.
|
|
26
|
+
({ name }) => !volumeList.includes(name)
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
if (missingVolumes.length === 0) {
|
|
@@ -41,10 +41,10 @@ const createVolumes = () => ({
|
|
|
41
41
|
const removeVolumes = () => ({
|
|
42
42
|
title: 'Removing volumes',
|
|
43
43
|
task: async ({ config: { docker } }, task) => {
|
|
44
|
-
const volumeList = (await execAsyncSpawn('docker volume ls
|
|
44
|
+
const volumeList = (await execAsyncSpawn('docker volume ls --format "{{.Name}}"')).split('\n');
|
|
45
45
|
|
|
46
46
|
const deployedVolumes = Object.values(docker.volumes).filter(
|
|
47
|
-
({ name }) => volumeList.
|
|
47
|
+
({ name }) => volumeList.includes(name)
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
if (deployedVolumes.length === 0) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
const os = require('os');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
3
|
const setConfigFile = require('../../util/set-config');
|
|
5
|
-
const pathExists = require('../../util/path-exists');
|
|
6
|
-
const { isIpAddress } = require('../../util/ip');
|
|
7
4
|
|
|
8
5
|
/**
|
|
9
6
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
@@ -23,41 +20,13 @@ const createNginxConfig = () => ({
|
|
|
23
20
|
const {
|
|
24
21
|
configuration: {
|
|
25
22
|
nginx
|
|
26
|
-
},
|
|
27
|
-
ssl,
|
|
28
|
-
host
|
|
29
|
-
} = overridenConfiguration;
|
|
30
|
-
|
|
31
|
-
if (ssl.enabled) {
|
|
32
|
-
if (!(await pathExists(ssl.ssl_certificate))) {
|
|
33
|
-
throw new Error('ssl.ssl_certificate file does not exist!');
|
|
34
|
-
}
|
|
35
|
-
if (!(await pathExists(ssl.ssl_certificate_key))) {
|
|
36
|
-
throw new Error('ssl.ssl_certificate_key file does not exist!');
|
|
37
23
|
}
|
|
24
|
+
} = overridenConfiguration;
|
|
38
25
|
|
|
39
|
-
await fs.promises.copyFile(
|
|
40
|
-
ssl.ssl_certificate,
|
|
41
|
-
path.join(
|
|
42
|
-
baseConfig.cacheDir,
|
|
43
|
-
'nginx',
|
|
44
|
-
'conf.d',
|
|
45
|
-
'ssl_certificate.pem'
|
|
46
|
-
)
|
|
47
|
-
);
|
|
48
|
-
await fs.promises.copyFile(
|
|
49
|
-
ssl.ssl_certificate_key,
|
|
50
|
-
path.join(
|
|
51
|
-
baseConfig.cacheDir,
|
|
52
|
-
'nginx',
|
|
53
|
-
'conf.d',
|
|
54
|
-
'ssl_certificate-key.pem'
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const networkToBindTo = isIpAddress(host) ? host : '127.0.0.1';
|
|
60
26
|
const isLinux = os.platform() === 'linux';
|
|
27
|
+
const isNativeLinux = isLinux && !isWsl;
|
|
28
|
+
const hostMachine = isNativeLinux ? '127.0.0.1' : 'host.docker.internal';
|
|
29
|
+
const hostPort = isNativeLinux ? ports.app : 80;
|
|
61
30
|
|
|
62
31
|
try {
|
|
63
32
|
await setConfigFile({
|
|
@@ -72,10 +41,9 @@ const createNginxConfig = () => ({
|
|
|
72
41
|
templateArgs: {
|
|
73
42
|
ports,
|
|
74
43
|
mageRoot: baseConfig.magentoDir,
|
|
75
|
-
hostMachine
|
|
76
|
-
hostPort
|
|
77
|
-
config: overridenConfiguration
|
|
78
|
-
networkToBindTo
|
|
44
|
+
hostMachine,
|
|
45
|
+
hostPort,
|
|
46
|
+
config: overridenConfiguration
|
|
79
47
|
}
|
|
80
48
|
});
|
|
81
49
|
} catch (e) {
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const setConfigFile = require('../../util/set-config');
|
|
2
|
+
const pathExists = require('../../util/path-exists');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const createPhpStormConfig = () => ({
|
|
7
|
+
title: 'Setting PHPStorm config',
|
|
8
|
+
task: async ({ config: { phpStorm }, ports }) => {
|
|
9
|
+
const { phpLanguageLevel } = phpStorm.php;
|
|
10
|
+
const jdbcUrl = `jdbc:mysql://localhost:${ports.mysql}/magento`;
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
await setConfigFile({
|
|
14
|
+
configPathname: phpStorm.xdebug.path,
|
|
15
|
+
template: phpStorm.xdebug.templatePath,
|
|
16
|
+
overwrite: true,
|
|
17
|
+
templateArgs: {
|
|
18
|
+
phpStorm
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
} catch (e) {
|
|
22
|
+
throw new Error(`Unexpected error accrued during workspace.xml config creation\n\n${e}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
await setConfigFile({
|
|
27
|
+
configPathname: phpStorm.php.path,
|
|
28
|
+
template: phpStorm.php.templatePath,
|
|
29
|
+
overwrite: true,
|
|
30
|
+
templateArgs: {
|
|
31
|
+
phpLanguageLevel
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw new Error(`Unexpected error accrued during php.xml config creation\n\n${e}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
await setConfigFile({
|
|
40
|
+
configPathname: phpStorm.database.dataSourcesLocal.path,
|
|
41
|
+
template: phpStorm.database.dataSourcesLocal.templatePath,
|
|
42
|
+
overwrite: true,
|
|
43
|
+
templateArgs: {
|
|
44
|
+
phpStorm
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
} catch (e) {
|
|
48
|
+
throw new Error(`Unexpected error accrued during dataSources.local.xml config creation\n\n${e}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
await setConfigFile({
|
|
53
|
+
configPathname: phpStorm.database.dataSources.path,
|
|
54
|
+
template: phpStorm.database.dataSources.templatePath,
|
|
55
|
+
overwrite: true,
|
|
56
|
+
templateArgs: {
|
|
57
|
+
phpStorm,
|
|
58
|
+
jdbcUrl
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} catch (e) {
|
|
62
|
+
throw new Error(`Unexpected error accrued during dataSources.xml config creation\n\n${e}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!await pathExists(path.resolve('./.idea/dataSources'))) {
|
|
66
|
+
await fs.promises.mkdir(path.resolve('./.idea/dataSources'));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
await setConfigFile({
|
|
71
|
+
configPathname: phpStorm.inspectionTools.path,
|
|
72
|
+
template: phpStorm.inspectionTools.templatePath,
|
|
73
|
+
overwrite: true,
|
|
74
|
+
templateArgs: {}
|
|
75
|
+
});
|
|
76
|
+
} catch (e) {
|
|
77
|
+
throw new Error(`Unexpected error accrued during Project_Default.xml config creation\n\n${e}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
module.exports = createPhpStormConfig;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const setConfigFile = require('../../util/set-config');
|
|
5
|
+
const pathExists = require('../../util/path-exists');
|
|
6
|
+
const { isIpAddress } = require('../../util/ip');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
10
|
+
*/
|
|
11
|
+
const createSSLTerminatorConfig = () => ({
|
|
12
|
+
title: 'Setting ssl terminator config',
|
|
13
|
+
task: async (ctx) => {
|
|
14
|
+
const {
|
|
15
|
+
ports,
|
|
16
|
+
config: {
|
|
17
|
+
overridenConfiguration,
|
|
18
|
+
baseConfig
|
|
19
|
+
},
|
|
20
|
+
isWsl
|
|
21
|
+
} = ctx;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
configuration: {
|
|
25
|
+
sslTerminator
|
|
26
|
+
},
|
|
27
|
+
ssl,
|
|
28
|
+
host
|
|
29
|
+
} = overridenConfiguration;
|
|
30
|
+
|
|
31
|
+
if (ssl.enabled) {
|
|
32
|
+
if (!(await pathExists(ssl.ssl_certificate))) {
|
|
33
|
+
throw new Error('ssl.ssl_certificate file does not exist!');
|
|
34
|
+
}
|
|
35
|
+
if (!(await pathExists(ssl.ssl_certificate_key))) {
|
|
36
|
+
throw new Error('ssl.ssl_certificate_key file does not exist!');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const nginxCacheDir = path.join(baseConfig.cacheDir, 'nginx', 'conf.d');
|
|
40
|
+
if (!await pathExists(nginxCacheDir)) {
|
|
41
|
+
await fs.promises.mkdir(nginxCacheDir, { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
await fs.promises.copyFile(
|
|
45
|
+
ssl.ssl_certificate,
|
|
46
|
+
path.join(
|
|
47
|
+
baseConfig.cacheDir,
|
|
48
|
+
'ssl-terminator',
|
|
49
|
+
'conf.d',
|
|
50
|
+
'ssl_certificate.pem'
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
await fs.promises.copyFile(
|
|
54
|
+
ssl.ssl_certificate_key,
|
|
55
|
+
path.join(
|
|
56
|
+
baseConfig.cacheDir,
|
|
57
|
+
'ssl-terminator',
|
|
58
|
+
'conf.d',
|
|
59
|
+
'ssl_certificate-key.pem'
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const networkToBindTo = isIpAddress(host) ? host : '127.0.0.1';
|
|
65
|
+
const isLinux = os.platform() === 'linux';
|
|
66
|
+
const isNativeLinux = isLinux && !isWsl;
|
|
67
|
+
const hostMachine = isNativeLinux ? '127.0.0.1' : 'host.docker.internal';
|
|
68
|
+
const hostPort = isNativeLinux ? ports.sslTerminator : 80;
|
|
69
|
+
|
|
70
|
+
try {
|
|
71
|
+
await setConfigFile({
|
|
72
|
+
configPathname: path.join(
|
|
73
|
+
baseConfig.cacheDir,
|
|
74
|
+
'ssl-terminator',
|
|
75
|
+
'conf.d',
|
|
76
|
+
'default.conf'
|
|
77
|
+
),
|
|
78
|
+
template: sslTerminator.configTemplate,
|
|
79
|
+
overwrite: true,
|
|
80
|
+
templateArgs: {
|
|
81
|
+
ports,
|
|
82
|
+
hostMachine,
|
|
83
|
+
hostPort,
|
|
84
|
+
config: overridenConfiguration,
|
|
85
|
+
networkToBindTo
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
} catch (e) {
|
|
89
|
+
throw new Error(`Unexpected error accrued during ssl terminator config creation\n\n${e}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
module.exports = createSSLTerminatorConfig;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const setConfigFile = require('../../util/set-config');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
6
|
+
*/
|
|
7
|
+
const createVarnishConfig = () => ({
|
|
8
|
+
title: 'Setting Varnish config',
|
|
9
|
+
skip: (ctx) => !ctx.config.overridenConfiguration.configuration.varnish.enabled,
|
|
10
|
+
task: async (ctx) => {
|
|
11
|
+
const {
|
|
12
|
+
ports,
|
|
13
|
+
config: {
|
|
14
|
+
overridenConfiguration,
|
|
15
|
+
baseConfig: {
|
|
16
|
+
cacheDir
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
isWsl,
|
|
20
|
+
platform
|
|
21
|
+
} = ctx;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
configuration: {
|
|
25
|
+
varnish
|
|
26
|
+
}
|
|
27
|
+
} = overridenConfiguration;
|
|
28
|
+
|
|
29
|
+
const isLinux = platform === 'linux';
|
|
30
|
+
const isNativeLinux = isLinux && !isWsl;
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await setConfigFile({
|
|
34
|
+
configPathname: path.join(
|
|
35
|
+
cacheDir,
|
|
36
|
+
'varnish',
|
|
37
|
+
'default.vcl'
|
|
38
|
+
),
|
|
39
|
+
template: varnish.configTemplate,
|
|
40
|
+
overwrite: true,
|
|
41
|
+
templateArgs: {
|
|
42
|
+
hostMachine: isNativeLinux ? '127.0.0.1' : 'host.docker.internal',
|
|
43
|
+
nginxPort: ports.app
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw new Error(`Unexpected error accrued during varnish config creation\n\n${e}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// try {
|
|
51
|
+
// await setConfigFile({
|
|
52
|
+
// configPathname: path.join(
|
|
53
|
+
// cacheDir,
|
|
54
|
+
// 'nginx-cache-router',
|
|
55
|
+
// 'conf.d',
|
|
56
|
+
// 'default.conf'
|
|
57
|
+
// ),
|
|
58
|
+
// template: path.join(templateDir, 'nginx-cache-router.template.conf'),
|
|
59
|
+
// overwrite: true,
|
|
60
|
+
// templateArgs: {
|
|
61
|
+
// ports,
|
|
62
|
+
// hostMachine,
|
|
63
|
+
// hostPort,
|
|
64
|
+
// config: overridenConfiguration,
|
|
65
|
+
// networkToBindTo
|
|
66
|
+
// }
|
|
67
|
+
// });
|
|
68
|
+
// } catch (e) {
|
|
69
|
+
// throw new Error(`Unexpected error accrued during nginx-cache-router config creation\n\n${e}`);
|
|
70
|
+
// }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
module.exports = createVarnishConfig;
|