Skip to content

Commit 8381229

Browse files
committed
move configuration elasticsearch, adjustment of db and magento upgrade tasks to db migration task
1 parent 3eb7e7b commit 8381229

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const adjustMagentoConfiguration = {
2+
title: 'Adjusting Magento Database Configuration',
3+
task: async (ctx) => {
4+
const { mysqlConnection } = ctx;
5+
6+
// delete varnish configuration if exists
7+
await mysqlConnection.query(`
8+
DELETE FROM core_config_data WHERE path LIKE '%varnish%';
9+
`);
10+
11+
// update cache policy to not use varnish
12+
await mysqlConnection.query(`
13+
UPDATE core_config_data
14+
SET value = ?
15+
WHERE path = ?;
16+
`, ['0', 'system/full_page_cache/caching_application']);
17+
}
18+
};
19+
20+
module.exports = adjustMagentoConfiguration;

build-packages/magento-scripts/lib/tasks/magento/setup-magento/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const flushRedisConfig = require('./flush-redis-config');
22
const waitingForRedis = require('./waiting-for-redis');
33
const migrateDatabase = require('./migrate-database');
4-
const configureElasticsearch = require('./configure-elasticsearch');
54
const createAdmin = require('./create-admin');
65
const setDeploymentMode = require('./set-deployment-mode');
76
const setBaseUrl = require('./set-base-url');
@@ -16,11 +15,10 @@ const setupMagento = {
1615
flushRedisConfig,
1716
waitingForRedis,
1817
migrateDatabase,
19-
configureElasticsearch,
20-
createAdmin,
21-
setDeploymentMode,
2218
setBaseUrl,
2319
setUrlRewrite,
20+
createAdmin,
21+
setDeploymentMode,
2422
postDeploy,
2523
disable2fa
2624
], {

build-packages/magento-scripts/lib/tasks/magento/setup-magento/migrate-database.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/* eslint-disable no-param-reassign */
33
// const runComposerCommand = require('../../../util/run-composer');
44
const runMagentoCommand = require('../../../util/run-magento');
5+
const adjustMagentoConfiguration = require('./adjust-magento-configuration');
6+
const configureElasticsearch = require('./configure-elasticsearch');
57
const installMagento = require('./install-magento');
8+
const upgradeMagento = require('./upgrade-magento');
69

710
const migrateDatabase = {
811
title: 'Migrating database',
@@ -19,7 +22,8 @@ const migrateDatabase = {
1922
task.output = 'No Magento is installed in DB!\nInstalling...';
2023

2124
return task.newListr([
22-
installMagento
25+
installMagento,
26+
configureElasticsearch
2327
], {
2428
concurrent: false,
2529
exitOnError: true,
@@ -39,23 +43,25 @@ const migrateDatabase = {
3943
}
4044
case 1: {
4145
return task.newListr([
42-
installMagento
46+
installMagento,
47+
configureElasticsearch
4348
], {
4449
concurrent: false,
4550
exitOnError: true,
4651
ctx
4752
});
4853
}
4954
case 2: {
50-
task.output = 'Upgrading magento';
51-
await runMagentoCommand('setup:upgrade', {
52-
magentoVersion,
53-
callback: (t) => {
54-
task.output = t;
55-
}
55+
task.output = 'Migrating database: upgrade magento';
56+
return task.newListr([
57+
adjustMagentoConfiguration,
58+
configureElasticsearch,
59+
upgradeMagento
60+
], {
61+
concurrent: false,
62+
exitOnError: true,
63+
ctx
5664
});
57-
task.title = 'Migrating database: upgraded!';
58-
break;
5965
}
6066
default: {
6167
// TODO: handle these statuses ?

build-packages/magento-scripts/lib/tasks/theme/link-theme/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { getCachedPorts } = require('../../../config/get-port-config');
44
const themeSymlink = require('./theme-symlink');
55
const installTheme = require('./install-theme');
66
const themeSubtask = require('./theme-subtask');
7-
const upgradeMagento = require('./upgrade-magento');
7+
const upgradeMagento = require('../../magento/setup-magento/upgrade-magento');
88
const disablePageCache = require('./disable-page-cache');
99
const checkThemeFolder = require('./check-theme-folder');
1010

0 commit comments

Comments
 (0)