@scandipwa/magento-scripts 1.16.1 → 2.0.0-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/exec.js +71 -0
- package/index.js +1 -1
- package/lib/commands/cli.js +4 -6
- package/lib/commands/execute.js +3 -33
- package/lib/commands/import-db.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/start.js +38 -20
- package/lib/commands/status.js +2 -0
- package/lib/config/docker.js +103 -85
- package/lib/config/get-project-configuration.js +3 -1
- package/lib/config/index.js +10 -7
- package/lib/config/magento/required-php-extensions/index.js +29 -0
- package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
- package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
- package/lib/config/php/base-repo.js +3 -0
- package/lib/config/php/extensions/apcu.js +12 -0
- package/lib/config/php/extensions/bcmath.js +7 -0
- package/lib/config/php/extensions/curl.js +11 -0
- package/lib/config/php/extensions/gd.js +14 -0
- package/lib/config/php/extensions/index.js +18 -2
- package/lib/config/php/extensions/intl.js +10 -0
- package/lib/config/php/extensions/opcache.js +10 -0
- package/lib/config/php/extensions/pdo_mysql.js +7 -0
- package/lib/config/php/extensions/soap.js +10 -0
- package/lib/config/php/extensions/sodium.js +10 -0
- package/lib/config/php/extensions/xdebug.js +8 -5
- package/lib/config/php/extensions/xsl.js +10 -0
- package/lib/config/php/extensions/zip.js +10 -0
- package/lib/config/php/{releases → versions}/index.js +0 -0
- package/lib/config/php/versions/php-7.2.js +23 -0
- package/lib/config/php/versions/php-7.3.js +23 -0
- package/lib/config/php/versions/php-7.4.js +23 -0
- package/lib/config/php/versions/php-8.1.js +23 -0
- package/lib/config/php-config.js +8 -12
- package/lib/config/port-config.js +2 -6
- package/lib/config/services/elasticsearch/base-repo.js +3 -0
- package/lib/config/services/elasticsearch/default-es-env.js +6 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
- package/lib/config/services/elasticsearch/versions/index.js +5 -0
- package/lib/config/templates/magentorc.template +6 -6
- package/lib/config/templates/mariadb.template.cnf +191 -0
- package/lib/config/templates/php-fpm.template.conf +3 -3
- package/lib/config/templates/php.template.ini +12 -6
- package/lib/config/templates/ssl-terminator.template.conf +9 -4
- package/lib/config/templates/vscode-launch.template.json +3 -1
- package/lib/config/versions/magento-2.3.0.js +10 -5
- package/lib/config/versions/magento-2.3.1.js +10 -5
- package/lib/config/versions/magento-2.3.2-p1.js +43 -0
- package/lib/config/versions/magento-2.3.2-p2.js +10 -5
- package/lib/config/versions/magento-2.3.2.js +10 -5
- package/lib/config/versions/magento-2.3.3-p1.js +10 -5
- package/lib/config/versions/magento-2.3.3.js +10 -5
- package/lib/config/versions/magento-2.3.4-p1.js +43 -0
- package/lib/config/versions/magento-2.3.4-p2.js +10 -5
- package/lib/config/versions/magento-2.3.4.js +10 -5
- package/lib/config/versions/magento-2.3.5-p1.js +8 -2
- package/lib/config/versions/magento-2.3.5-p2.js +8 -2
- package/lib/config/versions/magento-2.3.5.js +8 -2
- package/lib/config/versions/magento-2.3.6-p1.js +8 -2
- package/lib/config/versions/magento-2.3.6.js +8 -2
- package/lib/config/versions/magento-2.3.7-p1.js +8 -2
- package/lib/config/versions/magento-2.3.7-p2.js +8 -2
- package/lib/config/versions/magento-2.3.7-p3.js +8 -2
- package/lib/config/versions/magento-2.3.7-p4.js +44 -0
- package/lib/config/versions/magento-2.3.7.js +8 -2
- package/lib/config/versions/magento-2.4.0-p1.js +9 -3
- package/lib/config/versions/magento-2.4.0.js +9 -3
- package/lib/config/versions/magento-2.4.1-p1.js +6 -5
- package/lib/config/versions/magento-2.4.1.js +9 -2
- package/lib/config/versions/magento-2.4.2-p1.js +6 -5
- package/lib/config/versions/magento-2.4.2-p2.js +6 -6
- package/lib/config/versions/magento-2.4.2.js +6 -6
- package/lib/config/versions/magento-2.4.3-p1.js +7 -7
- package/lib/config/versions/magento-2.4.3-p2.js +7 -7
- package/lib/config/versions/magento-2.4.3-p3.js +46 -0
- package/lib/config/versions/magento-2.4.3.js +7 -7
- package/lib/config/versions/magento-2.4.4-p1.js +46 -0
- package/lib/config/versions/magento-2.4.4.js +9 -2
- package/lib/config/versions/magento-2.4.5.js +46 -0
- package/lib/tasks/cleanup.js +3 -3
- package/lib/tasks/composer/index.js +14 -104
- package/lib/tasks/database/connect-to-database.js +117 -0
- package/lib/tasks/database/create-magento-database.js +18 -0
- package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
- package/lib/tasks/{mysql → database}/fix-db.js +2 -2
- package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +65 -22
- package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
- package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
- package/lib/tasks/{mysql → database}/index.js +2 -2
- package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
- package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
- package/lib/tasks/docker/api.d.ts +71 -0
- package/lib/tasks/docker/api.js +30 -0
- package/lib/tasks/docker/containers/container-api.d.ts +132 -0
- package/lib/tasks/docker/containers/container-api.js +163 -0
- package/lib/tasks/docker/containers/index.js +19 -0
- package/lib/tasks/docker/containers/tasks.js +215 -0
- package/lib/tasks/docker/convert-legacy-volumes.js +15 -10
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
- package/lib/tasks/docker/image/image-api.d.ts +34 -0
- package/lib/tasks/docker/image/image-api.js +49 -0
- package/lib/tasks/docker/image/index.js +5 -0
- package/lib/tasks/docker/index.js +1 -13
- package/lib/tasks/docker/network/index.js +7 -0
- package/lib/tasks/docker/network/network-api.d.ts +103 -0
- package/lib/tasks/docker/network/network-api.js +99 -0
- package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
- package/lib/tasks/docker/project-image-builder.js +167 -0
- package/lib/tasks/docker/volume/index.js +8 -0
- package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
- package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
- package/lib/tasks/docker/volume/volume-api.js +66 -0
- package/lib/tasks/execute.js +97 -0
- package/lib/tasks/file-system/create-mariadb-config.js +23 -0
- package/lib/tasks/file-system/create-nginx-config.js +2 -3
- package/lib/tasks/file-system/create-php-config.js +20 -5
- package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
- package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
- package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
- package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
- package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
- package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
- package/lib/tasks/file-system/create-vscode-config.js +57 -42
- package/lib/tasks/file-system/index.js +5 -2
- package/lib/tasks/import-dump.js +6 -6
- package/lib/tasks/link.js +5 -4
- package/lib/tasks/magento/enable-magento-composer-plugins.js +85 -30
- package/lib/tasks/magento/install-magento-project.js +32 -63
- package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +7 -3
- package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
- package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
- package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
- package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
- package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
- package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/install-magento.js +21 -20
- package/lib/tasks/magento/setup-magento/migrate-database.js +7 -14
- package/lib/tasks/magento/setup-magento/set-base-url.js +3 -3
- package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
- package/lib/tasks/magento/setup-magento/varnish-config.js +10 -8
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +130 -3
- package/lib/tasks/php/php-container.js +112 -0
- package/lib/tasks/php/update-env-php.js +39 -21
- package/lib/tasks/php/update-env.php +66 -61
- package/lib/tasks/php/working_health_check.php +85 -0
- package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
- package/lib/tasks/requirements/docker/index.js +18 -13
- package/lib/tasks/requirements/docker/performance.js +54 -0
- package/lib/tasks/requirements/docker/version.js +8 -8
- package/lib/tasks/requirements/index.js +5 -8
- package/lib/tasks/requirements/php-version.js +8 -116
- package/lib/tasks/requirements/platform.js +12 -25
- package/lib/tasks/start.js +21 -50
- package/lib/tasks/status/index.js +8 -12
- package/lib/tasks/stop.js +0 -2
- package/lib/tasks/theme/install-theme.js +1 -1
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/tasks/theme/symlink-theme.js +2 -3
- package/lib/util/config-file-validator.js +27 -13
- package/lib/util/config-php-json.js +13 -4
- package/lib/util/database.js +7 -7
- package/lib/util/dockerfile-builder/build-instructions.js +197 -0
- package/lib/util/dockerfile-builder/index.js +276 -0
- package/lib/util/dockerfile-builder/types.d.ts +123 -0
- package/lib/util/env-php-json.js +10 -6
- package/lib/util/exec-async-command.js +3 -9
- package/lib/util/execute-in-container.js +63 -0
- package/lib/util/macos-version.js +20 -0
- package/lib/util/magento-task.js +3 -4
- package/lib/util/nginx-logs-parser.js +122 -0
- package/lib/util/php-task.js +3 -6
- package/lib/util/run-composer.js +6 -14
- package/lib/util/run-container-image.js +17 -0
- package/lib/util/run-magento.js +6 -14
- package/lib/util/run-php.js +6 -17
- package/package.json +11 -10
- package/typings/context.d.ts +7 -13
- package/typings/index.d.ts +67 -85
- package/lib/config/composer.js +0 -11
- package/lib/config/php/extensions/libsodium.js +0 -36
- package/lib/config/php/releases/php-7.2.js +0 -25
- package/lib/config/php/releases/php-7.3.js +0 -25
- package/lib/config/php/releases/php-7.4.js +0 -23
- package/lib/config/php/releases/php-8.1.js +0 -25
- package/lib/config/phpbrew.js +0 -12
- package/lib/tasks/composer/install-prestissimo.js +0 -103
- package/lib/tasks/docker/containers.js +0 -231
- package/lib/tasks/execute/index.js +0 -23
- package/lib/tasks/mysql/connect-to-mysql.js +0 -114
- package/lib/tasks/mysql/create-magento-database.js +0 -18
- package/lib/tasks/php/bundled-extensions.js +0 -27
- package/lib/tasks/php/compile-options.js +0 -56
- package/lib/tasks/php/compile.js +0 -55
- package/lib/tasks/php/configure.js +0 -89
- package/lib/tasks/php/extensions/disable.js +0 -49
- package/lib/tasks/php/extensions/enable.js +0 -52
- package/lib/tasks/php/extensions/index.js +0 -80
- package/lib/tasks/php/extensions/install.js +0 -54
- package/lib/tasks/php/index.js +0 -79
- package/lib/tasks/php/install-sodium.js +0 -93
- package/lib/tasks/php/update-phpbrew.js +0 -45
- package/lib/tasks/php/validate-php.js +0 -67
- package/lib/tasks/php-fpm/get-process-id.js +0 -14
- package/lib/tasks/php-fpm/index.js +0 -4
- package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
- package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
- package/lib/tasks/requirements/phpbrew/index.js +0 -61
- package/lib/tasks/requirements/phpbrew/install.js +0 -159
- package/lib/tasks/requirements/phpbrew/version.js +0 -28
|
@@ -24,15 +24,19 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
24
24
|
magentoConfiguration
|
|
25
25
|
},
|
|
26
26
|
ports,
|
|
27
|
-
|
|
27
|
+
databaseConnection
|
|
28
28
|
} = ctx;
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const isLinux = ctx.platform === 'linux';
|
|
31
|
+
const isNativeLinux = isLinux && !ctx.isWsl;
|
|
32
|
+
const hostMachine = isNativeLinux ? '127.0.0.1' : 'host.docker.internal';
|
|
33
|
+
|
|
34
|
+
const [tableResponse] = await databaseConnection.query(
|
|
31
35
|
'SELECT * FROM information_schema.tables WHERE table_schema = \'magento\' AND table_name = \'admin_user\' LIMIT 1;'
|
|
32
36
|
);
|
|
33
37
|
|
|
34
38
|
if (tableResponse.length > 0) {
|
|
35
|
-
const response = await
|
|
39
|
+
const response = await databaseConnection.query(
|
|
36
40
|
'select * from admin_user where username=\'admin\';'
|
|
37
41
|
);
|
|
38
42
|
|
|
@@ -54,26 +58,24 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
54
58
|
]
|
|
55
59
|
});
|
|
56
60
|
|
|
57
|
-
await
|
|
61
|
+
await databaseConnection.query('SET FOREIGN_KEY_CHECKS = 0;');
|
|
58
62
|
|
|
59
63
|
if (confirmDeleteAdminUsers === 'delete-all') {
|
|
60
|
-
await
|
|
64
|
+
await databaseConnection.query(`
|
|
61
65
|
TRUNCATE TABLE admin_user;
|
|
62
66
|
`);
|
|
63
67
|
} else {
|
|
64
|
-
await
|
|
68
|
+
await databaseConnection.query(`
|
|
65
69
|
DELETE FROM admin_user WHERE username='admin';
|
|
66
70
|
`);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
|
-
await
|
|
73
|
+
await databaseConnection.query('SET FOREIGN_KEY_CHECKS = 1;');
|
|
70
74
|
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
const {
|
|
74
|
-
const envPhpData = await envPhpToJson(
|
|
75
|
-
magentoVersion: ctx.magentoVersion
|
|
76
|
-
});
|
|
77
|
+
const { mariadb: { env } } = docker.getContainers(ports);
|
|
78
|
+
const envPhpData = await envPhpToJson(ctx);
|
|
77
79
|
|
|
78
80
|
const envPhpHaveEncryptionKey = envPhpData && envPhpData.crypt && envPhpData.crypt.key && envPhpData.crypt.key;
|
|
79
81
|
|
|
@@ -95,7 +97,7 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
95
97
|
|
|
96
98
|
const elasticsearchConfiguration = ` \
|
|
97
99
|
--search-engine='elasticsearch7' \
|
|
98
|
-
--elasticsearch-host='
|
|
100
|
+
--elasticsearch-host='${ hostMachine }' \
|
|
99
101
|
--elasticsearch-port='${ ports.elasticsearch }'`;
|
|
100
102
|
|
|
101
103
|
/**
|
|
@@ -114,25 +116,24 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
|
114
116
|
${ !isMagento23 ? elasticsearchConfiguration : '' } \
|
|
115
117
|
${encryptionKeyOption || ''} \
|
|
116
118
|
--session-save=redis \
|
|
117
|
-
--session-save-redis-host='
|
|
119
|
+
--session-save-redis-host='${ hostMachine }' \
|
|
118
120
|
--session-save-redis-port='${ ports.redis }' \
|
|
119
121
|
--session-save-redis-log-level='3' \
|
|
120
122
|
--session-save-redis-max-concurrency='30' \
|
|
121
123
|
--session-save-redis-db='1' \
|
|
122
124
|
--session-save-redis-disable-locking='1' \
|
|
123
125
|
--cache-backend='redis' \
|
|
124
|
-
--cache-backend-redis-server='
|
|
126
|
+
--cache-backend-redis-server='${ hostMachine }' \
|
|
125
127
|
--cache-backend-redis-port='${ ports.redis }' \
|
|
126
128
|
--cache-backend-redis-db='0't \
|
|
127
|
-
--db-host='
|
|
128
|
-
--db-name='${ env.
|
|
129
|
-
--db-user='${ env.
|
|
130
|
-
--db-password='${ env.
|
|
129
|
+
--db-host='${ hostMachine }:${ ports.mariadb }' \
|
|
130
|
+
--db-name='${ env.MARIADB_DATABASE }' \
|
|
131
|
+
--db-user='${ env.MARIADB_USER }' \
|
|
132
|
+
--db-password='${ env.MARIADB_PASSWORD }' \
|
|
131
133
|
--backend-frontname='${ magentoConfiguration.adminuri }' \
|
|
132
134
|
--no-interaction`;
|
|
133
135
|
|
|
134
|
-
await runMagentoCommand(command, {
|
|
135
|
-
magentoVersion,
|
|
136
|
+
await runMagentoCommand(ctx, command, {
|
|
136
137
|
throwNonZeroCode: true,
|
|
137
138
|
callback: !ctx.verbose ? undefined : (t) => {
|
|
138
139
|
task.output = t;
|
|
@@ -8,6 +8,7 @@ const upgradeMagento = require('./upgrade-magento');
|
|
|
8
8
|
const varnishConfigSetup = require('./varnish-config');
|
|
9
9
|
const pathExists = require('../../../util/path-exists');
|
|
10
10
|
const updateEnvPHP = require('../../php/update-env-php');
|
|
11
|
+
const UnknownError = require('../../../errors/unknown-error');
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* @param {Object} [options]
|
|
@@ -17,12 +18,9 @@ const updateEnvPHP = require('../../php/update-env-php');
|
|
|
17
18
|
const migrateDatabase = (options = {}) => ({
|
|
18
19
|
title: 'Migrating database',
|
|
19
20
|
task: async (ctx, task) => {
|
|
20
|
-
const {
|
|
21
|
-
magentoVersion,
|
|
22
|
-
mysqlConnection
|
|
23
|
-
} = ctx;
|
|
21
|
+
const { databaseConnection } = ctx;
|
|
24
22
|
|
|
25
|
-
const [[{ tableCount }]] = await
|
|
23
|
+
const [[{ tableCount }]] = await databaseConnection.query(`
|
|
26
24
|
SELECT count(*) AS tableCount
|
|
27
25
|
FROM INFORMATION_SCHEMA.TABLES
|
|
28
26
|
WHERE TABLE_SCHEMA = 'magento';
|
|
@@ -35,9 +33,9 @@ const migrateDatabase = (options = {}) => ({
|
|
|
35
33
|
) {
|
|
36
34
|
if (options.onlyInstallMagento) {
|
|
37
35
|
ctx.isSetupUpgradeNeeded = false;
|
|
38
|
-
return task.newListr(
|
|
36
|
+
return task.newListr([
|
|
39
37
|
installMagento({ isDbEmpty: true })
|
|
40
|
-
);
|
|
38
|
+
]);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
return task.newListr([
|
|
@@ -57,8 +55,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
57
55
|
});
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
const { code } = await runMagentoCommand('setup:db:status', {
|
|
61
|
-
magentoVersion,
|
|
58
|
+
const { code, result } = await runMagentoCommand(ctx, 'setup:db:status', {
|
|
62
59
|
throwNonZeroCode: false
|
|
63
60
|
});
|
|
64
61
|
|
|
@@ -67,7 +64,6 @@ const migrateDatabase = (options = {}) => ({
|
|
|
67
64
|
ctx.isSetupUpgradeNeeded = false;
|
|
68
65
|
// no setup is needed, but still to be sure configure ES
|
|
69
66
|
return task.newListr([
|
|
70
|
-
updateEnvPHP(),
|
|
71
67
|
varnishConfigSetup(),
|
|
72
68
|
configureElasticsearch()
|
|
73
69
|
], {
|
|
@@ -107,7 +103,6 @@ const migrateDatabase = (options = {}) => ({
|
|
|
107
103
|
}
|
|
108
104
|
case 2: {
|
|
109
105
|
return task.newListr([
|
|
110
|
-
updateEnvPHP(),
|
|
111
106
|
varnishConfigSetup(),
|
|
112
107
|
configureElasticsearch(),
|
|
113
108
|
upgradeMagento()
|
|
@@ -121,9 +116,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
121
116
|
});
|
|
122
117
|
}
|
|
123
118
|
default: {
|
|
124
|
-
|
|
125
|
-
task.title = 'Migrating database failed: manual action is required!';
|
|
126
|
-
break;
|
|
119
|
+
throw new UnknownError(`Migrating database failed: manual action is required!\n\n${result}`);
|
|
127
120
|
}
|
|
128
121
|
}
|
|
129
122
|
},
|
|
@@ -14,10 +14,10 @@ module.exports = () => ({
|
|
|
14
14
|
ssl
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
databaseConnection
|
|
18
18
|
} = ctx;
|
|
19
19
|
const isNgrok = host.endsWith('ngrok.io');
|
|
20
|
-
const enableSecureFrontend = ssl.enabled ? '1' : '0';
|
|
20
|
+
const enableSecureFrontend = (ctx.config.overridenConfiguration.configuration.varnish.enabled && ssl.enabled) ? '1' : '0';
|
|
21
21
|
const location = `${host}${ !isNgrok && ports.sslTerminator !== 80 ? `:${ports.sslTerminator }` : '' }/`;
|
|
22
22
|
const secureLocation = `${host}/`; // SSL will work only on port 443, so you cannot run multiple projects with SSL at the same time.
|
|
23
23
|
const httpUrl = `http://${location}`;
|
|
@@ -29,6 +29,6 @@ module.exports = () => ({
|
|
|
29
29
|
{ path: 'web/secure/use_in_frontend', value: enableSecureFrontend },
|
|
30
30
|
{ path: 'web/secure/use_in_adminhtml', value: enableSecureFrontend },
|
|
31
31
|
{ path: 'web/cookie/cookie_domain', value: null }
|
|
32
|
-
], {
|
|
32
|
+
], { databaseConnection, task });
|
|
33
33
|
}
|
|
34
34
|
});
|
|
@@ -6,10 +6,10 @@ const runMagentoCommand = require('../../../util/run-magento');
|
|
|
6
6
|
*/
|
|
7
7
|
module.exports = () => ({
|
|
8
8
|
title: 'Switching Magento mode',
|
|
9
|
-
task: async (
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
task: async (ctx, task) => {
|
|
10
|
+
const { config: { magentoConfiguration: { mode } } } = ctx;
|
|
11
|
+
const { result } = await runMagentoCommand(ctx, 'deploy:mode:show', {
|
|
12
|
+
throwNonZeroCode: false
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
if (result.includes(mode)) {
|
|
@@ -5,13 +5,13 @@ const { updateTableValues } = require('../../../util/database');
|
|
|
5
5
|
*/
|
|
6
6
|
const setUrlRewrite = () => ({
|
|
7
7
|
title: 'Setting up url-rewrites',
|
|
8
|
-
task: async ({
|
|
8
|
+
task: async ({ databaseConnection }, task) => {
|
|
9
9
|
await updateTableValues('core_config_data', [
|
|
10
10
|
{
|
|
11
11
|
path: 'web/seo/use_rewrites',
|
|
12
12
|
value: '1'
|
|
13
13
|
}
|
|
14
|
-
], {
|
|
14
|
+
], { databaseConnection, task });
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -18,18 +18,20 @@ const varnishConfigSetup = () => ({
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
ports
|
|
21
|
+
databaseConnection,
|
|
22
|
+
ports,
|
|
23
|
+
debug
|
|
23
24
|
} = ctx;
|
|
24
25
|
|
|
25
26
|
const isLinux = os.platform() === 'linux';
|
|
26
27
|
const isWsl = await getIsWsl();
|
|
28
|
+
const isNativeLinux = isLinux && !isWsl;
|
|
27
29
|
|
|
28
|
-
if (varnishEnabled) {
|
|
30
|
+
if (!debug && varnishEnabled) {
|
|
29
31
|
await updateTableValues('core_config_data', [
|
|
30
32
|
{
|
|
31
33
|
path: 'system/full_page_cache/varnish/backend_host',
|
|
32
|
-
value: 'localhost'
|
|
34
|
+
value: !isNativeLinux ? 'host.docker.internal' : 'localhost'
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
path: 'system/full_page_cache/varnish/backend_port',
|
|
@@ -37,16 +39,16 @@ const varnishConfigSetup = () => ({
|
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
path: 'system/full_page_cache/varnish/access_list',
|
|
40
|
-
value:
|
|
42
|
+
value: !isNativeLinux ? 'host.docker.internal,localhost' : 'localhost'
|
|
41
43
|
},
|
|
42
44
|
{
|
|
43
45
|
path: 'system/full_page_cache/caching_application',
|
|
44
46
|
value: '2'
|
|
45
47
|
}
|
|
46
|
-
], {
|
|
48
|
+
], { databaseConnection, task });
|
|
47
49
|
} else {
|
|
48
50
|
// delete varnish configuration if exists
|
|
49
|
-
await
|
|
51
|
+
await databaseConnection.query(`
|
|
50
52
|
DELETE FROM core_config_data WHERE path LIKE '%varnish%';
|
|
51
53
|
`);
|
|
52
54
|
|
|
@@ -57,7 +59,7 @@ const varnishConfigSetup = () => ({
|
|
|
57
59
|
path: 'system/full_page_cache/caching_application',
|
|
58
60
|
value: '0'
|
|
59
61
|
}
|
|
60
|
-
], {
|
|
62
|
+
], { databaseConnection, task });
|
|
61
63
|
}
|
|
62
64
|
},
|
|
63
65
|
options: {
|
|
@@ -1,14 +1,50 @@
|
|
|
1
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
+
const semver = require('semver');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
1
5
|
const { request } = require('smol-request');
|
|
2
6
|
const KnownError = require('../../../errors/known-error');
|
|
7
|
+
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
8
|
+
const { NginxParser } = require('../../../util/nginx-logs-parser');
|
|
3
9
|
const sleep = require('../../../util/sleep');
|
|
4
10
|
|
|
11
|
+
const pathToWorkingHealthCheckPhp = path.join(__dirname, '..', '..', 'php', 'working_health_check.php');
|
|
12
|
+
const pathToProjectsHealthCheckPhp = path.join(process.cwd(), 'pub', 'health_check.php');
|
|
13
|
+
const pathToHealthCheckBackupPhp = path.join(process.cwd(), 'pub', 'health_check-super-backup-file.php');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('../../../../typings/context').ListrContext} ctx
|
|
17
|
+
*/
|
|
18
|
+
const getIsHealthCheckRequestBroken = async (ctx) => {
|
|
19
|
+
const { nginx } = ctx.config.docker.getContainers(ctx.ports);
|
|
20
|
+
|
|
21
|
+
const nginxLogs = await execAsyncSpawn(`docker logs ${nginx.name}`);
|
|
22
|
+
|
|
23
|
+
const healthCheckRequests = nginxLogs
|
|
24
|
+
.split('\n')
|
|
25
|
+
.filter((line) => line.includes('"GET /health_check.php HTTP/1.1"'));
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line max-len
|
|
28
|
+
const parser = new NginxParser('$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"');
|
|
29
|
+
|
|
30
|
+
const parsedRequests = healthCheckRequests.map((line) => parser.parseLine(line));
|
|
31
|
+
|
|
32
|
+
return parsedRequests.every((parsedRequest) => parsedRequest.status !== '200');
|
|
33
|
+
};
|
|
34
|
+
|
|
5
35
|
/**
|
|
6
36
|
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
37
|
*/
|
|
8
38
|
const waitingForVarnish = () => ({
|
|
9
39
|
title: 'Waiting for Varnish to return code 200',
|
|
10
|
-
skip: (ctx) =>
|
|
11
|
-
|
|
40
|
+
skip: (ctx) => ctx.debug
|
|
41
|
+
|| !ctx.config.overridenConfiguration.configuration.varnish.enabled
|
|
42
|
+
|| ctx.config.overridenConfiguration.ssl.enabled,
|
|
43
|
+
task: async (ctx, task) => {
|
|
44
|
+
const pureMagentoVersion = ctx.magentoVersion.match(/^([0-9]+\.[0-9]+\.[0-9]+)/)[1];
|
|
45
|
+
|
|
46
|
+
const isMagento23 = semver.satisfies(pureMagentoVersion, '<2.4');
|
|
47
|
+
|
|
12
48
|
let tries = 0;
|
|
13
49
|
while (tries < 10) {
|
|
14
50
|
try {
|
|
@@ -28,6 +64,94 @@ const waitingForVarnish = () => ({
|
|
|
28
64
|
}
|
|
29
65
|
}
|
|
30
66
|
|
|
67
|
+
if (tries === 10 && isMagento23) {
|
|
68
|
+
const isHealthCheckRequestBroken = await getIsHealthCheckRequestBroken(ctx);
|
|
69
|
+
if (isHealthCheckRequestBroken) {
|
|
70
|
+
const confirm = await task.prompt({
|
|
71
|
+
type: 'Select',
|
|
72
|
+
message: `We detected that your Magento instance is experiencing problems with Varnish server.
|
|
73
|
+
Health Check request is returning status 500.
|
|
74
|
+
|
|
75
|
+
Do you want to try resolving this issue by replacing ${logger.style.file('./pub/health_check.php')} file content with content from newer Magento version (2.4.4)?`,
|
|
76
|
+
choices: [
|
|
77
|
+
{
|
|
78
|
+
name: 'yes',
|
|
79
|
+
message: 'Okay, let\'s try that'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'no',
|
|
83
|
+
message: 'I will try to fix this myself, thanks for the info!'
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (confirm === 'yes') {
|
|
89
|
+
await fs.promises.writeFile(
|
|
90
|
+
pathToHealthCheckBackupPhp,
|
|
91
|
+
await fs.promises.readFile(pathToProjectsHealthCheckPhp, 'utf-8'),
|
|
92
|
+
'utf-8'
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
task.output = `Backup made! Available at ${logger.style.file(pathToHealthCheckBackupPhp)}`;
|
|
96
|
+
|
|
97
|
+
await fs.promises.writeFile(
|
|
98
|
+
pathToProjectsHealthCheckPhp,
|
|
99
|
+
await fs.promises.readFile(pathToWorkingHealthCheckPhp, 'utf-8'),
|
|
100
|
+
'utf-8'
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
task.output = `${logger.style.file('./pub/health_check.php')} content is replaced, waiting for nginx logs...`;
|
|
104
|
+
|
|
105
|
+
let connectionFixed = false;
|
|
106
|
+
|
|
107
|
+
for (let i = 0; i < 10; i++) {
|
|
108
|
+
try {
|
|
109
|
+
const response = await request(`http://localhost:${ctx.ports.sslTerminator}/`, {
|
|
110
|
+
responseType: 'headers'
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
if (response.status !== 200) {
|
|
114
|
+
await sleep(2000);
|
|
115
|
+
} else {
|
|
116
|
+
connectionFixed = true;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
} catch (e) {
|
|
120
|
+
await sleep(200);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (connectionFixed) {
|
|
125
|
+
task.output = 'Connection looks good!';
|
|
126
|
+
const secondConfirm = await task.prompt({
|
|
127
|
+
type: 'Select',
|
|
128
|
+
message: `Okay, looks like it helped!
|
|
129
|
+
Do you want to keep backed up ${logger.style.file('health_check.php')} file?`,
|
|
130
|
+
choices: [
|
|
131
|
+
{
|
|
132
|
+
name: 'no',
|
|
133
|
+
message: 'I don\'t think I will need it anymore, thanks'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'yes',
|
|
137
|
+
message: 'I will keep it, maybe it will be useful (X to doubt)'
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (secondConfirm === 'no') {
|
|
143
|
+
await fs.promises.rm(pathToHealthCheckBackupPhp);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
task.skip('User choose to fix issue himself');
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
31
155
|
if (tries === 10) {
|
|
32
156
|
throw new KnownError(`After 20 seconds website is still responding with non-200 code, which might indicate issue with setup.
|
|
33
157
|
Or Varnish is still loading...
|
|
@@ -35,7 +159,10 @@ Or Varnish is still loading...
|
|
|
35
159
|
Please check the logs!`);
|
|
36
160
|
}
|
|
37
161
|
},
|
|
38
|
-
exitOnError: false
|
|
162
|
+
exitOnError: false,
|
|
163
|
+
options: {
|
|
164
|
+
bottomBar: 10
|
|
165
|
+
}
|
|
39
166
|
});
|
|
40
167
|
|
|
41
168
|
module.exports = waitingForVarnish;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
const { deepmerge } = require('../../util/deepmerge');
|
|
3
|
+
const { containerApi } = require('../docker/containers');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {import('../../../typings/context').ListrContext} ctx
|
|
7
|
+
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & { useXDebugContainer?: boolean }} [options]
|
|
8
|
+
* @param {string} command
|
|
9
|
+
*/
|
|
10
|
+
const runPHPContainerCommand = async (ctx, command, options = {}) => {
|
|
11
|
+
const { php } = ctx.config.docker.getContainers(ctx.ports);
|
|
12
|
+
|
|
13
|
+
const containers = await containerApi.ls({
|
|
14
|
+
formatToJSON: true,
|
|
15
|
+
all: true,
|
|
16
|
+
filter: `name=${php.name}`
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (containers.length > 0) {
|
|
20
|
+
return execPHPContainerCommand(ctx, command, options);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return containerApi.run(
|
|
24
|
+
deepmerge(
|
|
25
|
+
php,
|
|
26
|
+
{
|
|
27
|
+
detach: false,
|
|
28
|
+
rm: true
|
|
29
|
+
},
|
|
30
|
+
options.useXDebugContainer
|
|
31
|
+
? {
|
|
32
|
+
image: `${ php.image }.xdebug`
|
|
33
|
+
}
|
|
34
|
+
: {},
|
|
35
|
+
{
|
|
36
|
+
command
|
|
37
|
+
},
|
|
38
|
+
),
|
|
39
|
+
options
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {string} command
|
|
45
|
+
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & { useXDebugContainer?: boolean }} [options]
|
|
46
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
47
|
+
*/
|
|
48
|
+
const runPHPContainerCommandTask = (command, options = {}) => ({
|
|
49
|
+
title: `Running command "${command}"`,
|
|
50
|
+
task: (ctx, task) => runPHPContainerCommand(ctx, command, {
|
|
51
|
+
callback: !ctx.verbose ? undefined : (t) => {
|
|
52
|
+
task.output = t;
|
|
53
|
+
},
|
|
54
|
+
...options
|
|
55
|
+
}),
|
|
56
|
+
option: {
|
|
57
|
+
bottomBar: 10
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {import('../../../typings/context').ListrContext} ctx
|
|
64
|
+
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & { useXDebugContainer?: boolean }} [options]
|
|
65
|
+
* @param {string} command
|
|
66
|
+
*/
|
|
67
|
+
const execPHPContainerCommand = async (ctx, command, options = {}) => {
|
|
68
|
+
const { php } = ctx.config.docker.getContainers(ctx.ports);
|
|
69
|
+
|
|
70
|
+
const containers = await containerApi.ls({ formatToJSON: true, all: true });
|
|
71
|
+
|
|
72
|
+
if (!containers.some((c) => c.Names === php.name)) {
|
|
73
|
+
return runPHPContainerCommand(ctx, command, options);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return containerApi.exec(
|
|
77
|
+
command,
|
|
78
|
+
php.name,
|
|
79
|
+
deepmerge(
|
|
80
|
+
php,
|
|
81
|
+
options.env ? {
|
|
82
|
+
env: options.env
|
|
83
|
+
} : {}
|
|
84
|
+
),
|
|
85
|
+
options
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {string} command
|
|
91
|
+
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & { useXDebugContainer?: boolean, title?: string }} [options]
|
|
92
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
93
|
+
*/
|
|
94
|
+
const execPHPContainerCommandTask = (command, options = {}) => ({
|
|
95
|
+
title: typeof options.title === 'string' && options.title === '' ? undefined : options.title || `Running command "${command}"`,
|
|
96
|
+
task: (ctx, task) => execPHPContainerCommand(ctx, command, {
|
|
97
|
+
callback: !ctx.verbose ? undefined : (t) => {
|
|
98
|
+
task.output = t;
|
|
99
|
+
},
|
|
100
|
+
...options
|
|
101
|
+
}),
|
|
102
|
+
option: {
|
|
103
|
+
bottomBar: 10
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
module.exports = {
|
|
108
|
+
runPHPContainerCommand,
|
|
109
|
+
runPHPContainerCommandTask,
|
|
110
|
+
execPHPContainerCommand,
|
|
111
|
+
execPHPContainerCommandTask
|
|
112
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const os = require('os');
|
|
2
3
|
const envPhpToJson = require('../../util/env-php-json');
|
|
3
4
|
const getJsonfileData = require('../../util/get-jsonfile-data');
|
|
4
5
|
const pathExists = require('../../util/path-exists');
|
|
5
|
-
const
|
|
6
|
+
const { containerApi } = require('../docker/containers');
|
|
6
7
|
|
|
7
8
|
const composerLockPath = path.join(process.cwd(), 'composer.lock');
|
|
9
|
+
const envPhpPath = path.join(process.cwd(), 'app', 'etc', 'env.php');
|
|
8
10
|
/**
|
|
9
11
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
10
12
|
*/
|
|
@@ -12,13 +14,19 @@ const updateEnvPHP = () => ({
|
|
|
12
14
|
title: 'Updating env.php',
|
|
13
15
|
task: async (ctx, task) => {
|
|
14
16
|
// update env.php only if it's exist
|
|
15
|
-
if (!await pathExists(
|
|
17
|
+
if (!await pathExists(envPhpPath)) {
|
|
16
18
|
task.skip();
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
+
const { php } = ctx.config.docker.getContainers(ctx.ports);
|
|
23
|
+
|
|
24
|
+
const isLinux = ctx.platform === 'linux';
|
|
25
|
+
const isNativeLinux = isLinux && !ctx.isWsl;
|
|
26
|
+
const hostMachine = isNativeLinux ? '127.0.0.1' : 'host.docker.internal';
|
|
27
|
+
|
|
28
|
+
const useVarnish = (!ctx.debug && ctx.config.overridenConfiguration.configuration.varnish.enabled) ? '1' : '';
|
|
29
|
+
const varnishHost = hostMachine;
|
|
22
30
|
const varnishPort = ctx.ports.varnish;
|
|
23
31
|
const previousVarnishPort = ctx.cachedPorts
|
|
24
32
|
? ctx.cachedPorts.varnish
|
|
@@ -34,15 +42,15 @@ const updateEnvPHP = () => ({
|
|
|
34
42
|
ctx.CSAThemeInstalled = true;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
const envPhp = await envPhpToJson(
|
|
45
|
+
const envPhp = await envPhpToJson(ctx);
|
|
38
46
|
|
|
39
47
|
const persistedQueryConfig = envPhp.cache && envPhp.cache['persisted-query'];
|
|
40
48
|
|
|
41
49
|
if (
|
|
42
50
|
persistedQueryConfig
|
|
43
51
|
&& persistedQueryConfig.redis
|
|
44
|
-
&& persistedQueryConfig.redis.port
|
|
45
|
-
|
|
52
|
+
&& (persistedQueryConfig.redis.port !== `${ ctx.ports.redis }`
|
|
53
|
+
|| persistedQueryConfig.redis.host === hostMachine)
|
|
46
54
|
) {
|
|
47
55
|
SETUP_PQ = '';
|
|
48
56
|
return;
|
|
@@ -50,20 +58,30 @@ const updateEnvPHP = () => ({
|
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
const result = await containerApi.run({
|
|
62
|
+
env: {
|
|
63
|
+
USE_VARNISH: useVarnish,
|
|
64
|
+
VARNISH_PORT: `${ varnishPort }`,
|
|
65
|
+
VARNISH_HOST: varnishHost,
|
|
66
|
+
PREVIOUS_VARNISH_PORT: `${ previousVarnishPort }`,
|
|
67
|
+
SETUP_PQ,
|
|
68
|
+
REDIS_PORT: ctx.ports.redis,
|
|
69
|
+
ADMIN_URI: ctx.config.overridenConfiguration.magento.adminuri,
|
|
70
|
+
HOST_MACHINE: hostMachine,
|
|
71
|
+
PORTS: JSON.stringify(ctx.ports)
|
|
72
|
+
},
|
|
73
|
+
command: 'php ./update-env-php.php',
|
|
74
|
+
mountVolumes: [
|
|
75
|
+
`${path.join(__dirname, 'update-env.php')}:${ctx.config.baseConfig.containerMagentoDir}/update-env-php.php`,
|
|
76
|
+
`${envPhpPath}:/${ctx.config.baseConfig.containerMagentoDir}/env.php`
|
|
77
|
+
],
|
|
78
|
+
image: php.image,
|
|
79
|
+
detach: false,
|
|
80
|
+
rm: true,
|
|
81
|
+
user: isLinux ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
task.output = result;
|
|
67
85
|
}
|
|
68
86
|
});
|
|
69
87
|
|