@scandipwa/magento-scripts 2.0.0-alpha.1 → 2.0.0-alpha.12
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 +5 -0
- package/lib/commands/execute.js +2 -57
- package/lib/commands/start.js +17 -3
- package/lib/commands/status.js +9 -1
- package/lib/config/config.js +20 -2
- package/lib/config/docker.js +51 -49
- package/lib/config/index.js +1 -1
- package/lib/config/php/versions/php-7.2.js +1 -0
- package/lib/config/php/versions/php-7.3.js +1 -0
- package/lib/config/php/versions/php-7.4.js +1 -0
- package/lib/config/php/versions/php-8.1.js +1 -0
- package/lib/config/php-config.js +4 -3
- package/lib/config/services/composer/versions/composer-1.js +8 -0
- package/lib/config/services/composer/versions/composer-2.js +8 -0
- package/lib/config/services/composer/versions/index.js +4 -0
- package/lib/config/services/elasticsearch/default-es-env.js +6 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +2 -6
- package/lib/config/services/nginx/versions/index.js +3 -0
- package/lib/config/services/nginx/versions/nginx-1.18.js +11 -0
- package/lib/config/{ssl-terminator → services/ssl-terminator}/index.js +3 -0
- package/lib/config/templates/magentorc.template +6 -5
- package/lib/config/templates/php-debug.template.ini +31 -0
- package/lib/config/templates/php-fpm.template.conf +1 -2
- package/lib/config/templates/php.template.ini +6 -202
- package/lib/config/templates/ssl-terminator.template.conf +10 -3
- package/lib/config/templates/varnish.template.vcl +20 -13
- package/lib/config/varnish/varnish-6-0.js +4 -0
- package/lib/config/varnish/varnish-6-6.js +4 -0
- package/lib/config/varnish/varnish-7-0.js +4 -0
- package/lib/config/versions/magento-2.3.0.js +5 -9
- package/lib/config/versions/magento-2.3.1.js +5 -9
- package/lib/config/versions/magento-2.3.2-p1.js +5 -9
- package/lib/config/versions/magento-2.3.2-p2.js +5 -9
- package/lib/config/versions/magento-2.3.2.js +5 -9
- package/lib/config/versions/magento-2.3.3-p1.js +5 -9
- package/lib/config/versions/magento-2.3.3.js +5 -9
- package/lib/config/versions/magento-2.3.4-p1.js +5 -9
- package/lib/config/versions/magento-2.3.4-p2.js +5 -9
- package/lib/config/versions/magento-2.3.4.js +5 -9
- package/lib/config/versions/magento-2.3.5-p1.js +5 -9
- package/lib/config/versions/magento-2.3.5-p2.js +5 -9
- package/lib/config/versions/magento-2.3.5.js +5 -9
- package/lib/config/versions/magento-2.3.6-p1.js +5 -9
- package/lib/config/versions/magento-2.3.6.js +5 -9
- package/lib/config/versions/magento-2.3.7-p1.js +5 -9
- package/lib/config/versions/magento-2.3.7-p2.js +5 -9
- package/lib/config/versions/magento-2.3.7-p3.js +5 -9
- package/lib/config/versions/magento-2.3.7-p4.js +40 -0
- package/lib/config/versions/magento-2.3.7.js +5 -9
- package/lib/config/versions/magento-2.4.0-p1.js +5 -9
- package/lib/config/versions/magento-2.4.0.js +5 -9
- package/lib/config/versions/magento-2.4.1-p1.js +5 -9
- package/lib/config/versions/magento-2.4.1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p2.js +5 -9
- package/lib/config/versions/magento-2.4.2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p1.js +5 -9
- package/lib/config/versions/magento-2.4.3-p2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p3.js +42 -0
- package/lib/config/versions/magento-2.4.3.js +5 -9
- package/lib/config/versions/magento-2.4.4-p1.js +42 -0
- package/lib/config/versions/magento-2.4.4.js +5 -9
- package/lib/config/versions/magento-2.4.5.js +42 -0
- package/lib/tasks/composer/local-auth-json.js +1 -1
- package/lib/tasks/database/connect-to-database.js +6 -3
- package/lib/tasks/database/create-magento-database.js +5 -2
- package/lib/tasks/database/create-magento-user.js +50 -0
- package/lib/tasks/database/default-magento-database.js +3 -0
- package/lib/tasks/database/default-magento-user.js +7 -0
- package/lib/tasks/database/import-dump-to-database.js +3 -2
- package/lib/tasks/docker/api.d.ts +25 -1
- package/lib/tasks/docker/api.js +31 -1
- package/lib/tasks/docker/containers/container-api.d.ts +18 -0
- package/lib/tasks/docker/containers/container-api.js +76 -17
- package/lib/tasks/docker/containers/tasks.js +32 -1
- package/lib/tasks/docker/index.js +6 -1
- package/lib/tasks/docker/project-image-builder.js +6 -8
- package/lib/tasks/docker/volume/index.js +2 -1
- package/lib/tasks/docker/volume/tasks.js +54 -9
- package/lib/tasks/docker/volume/volume-api.d.ts +10 -0
- package/lib/tasks/docker/volume/volume-api.js +25 -1
- package/lib/tasks/execute.js +100 -0
- package/lib/tasks/file-system/create-nginx-config.js +3 -5
- package/lib/tasks/file-system/create-php-config.js +2 -23
- package/lib/tasks/file-system/create-php-debug-config.js +45 -0
- package/lib/tasks/file-system/create-php-fpm-config.js +2 -4
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +1 -1
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -7
- package/lib/tasks/file-system/create-varnish-config.js +4 -7
- package/lib/tasks/file-system/index.js +2 -0
- package/lib/tasks/magento/enable-magento-composer-plugins.js +85 -30
- package/lib/tasks/magento/install-magento-project.js +3 -2
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +2 -4
- package/lib/tasks/magento/setup-magento/flush-redis-config.js +3 -6
- package/lib/tasks/magento/setup-magento/install-magento.js +8 -10
- package/lib/tasks/magento/setup-magento/set-base-url.js +1 -1
- package/lib/tasks/magento/setup-magento/varnish-config.js +4 -9
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +17 -16
- package/lib/tasks/php/php-container.js +7 -3
- package/lib/tasks/php/update-env-php.js +3 -4
- package/lib/tasks/requirements/composer-credentials.js +7 -3
- package/lib/tasks/requirements/docker/context.js +88 -0
- package/lib/tasks/requirements/docker/index.js +110 -19
- package/lib/tasks/requirements/docker/install.js +21 -7
- package/lib/tasks/requirements/docker/permissions.js +2 -11
- package/lib/tasks/requirements/docker/running-status.js +94 -24
- package/lib/tasks/requirements/docker/version.js +1 -0
- package/lib/tasks/requirements/index.js +0 -2
- package/lib/tasks/requirements/php-version.js +4 -2
- package/lib/tasks/start.js +28 -7
- package/lib/tasks/status/index.js +13 -11
- package/lib/tasks/stop.js +2 -0
- package/lib/util/config-file-validator.js +2 -0
- package/lib/util/execute-in-container.js +63 -0
- package/lib/util/systemctl.js +62 -13
- package/package.json +4 -3
- package/typings/context.d.ts +7 -0
- package/typings/index.d.ts +38 -1
- package/lib/tasks/execute/index.js +0 -26
- package/lib/tasks/requirements/dependency/arch.js +0 -50
- package/lib/tasks/requirements/dependency/centos.js +0 -36
- package/lib/tasks/requirements/dependency/fedora.js +0 -36
- package/lib/tasks/requirements/dependency/index.js +0 -33
- package/lib/tasks/requirements/dependency/mac.js +0 -124
- package/lib/tasks/requirements/dependency/ubuntu.js +0 -83
- package/yarn-error.log +0 -9660
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
+
const { cmaGlobalConfig } = require('../../../config/cma-config');
|
|
2
3
|
const KnownError = require('../../../errors/known-error');
|
|
3
4
|
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
4
5
|
const openBrowser = require('../../../util/open-browser');
|
|
5
|
-
const
|
|
6
|
+
const checkDockerDesktopContext = require('./context');
|
|
7
|
+
const { installDockerEngine } = require('./install');
|
|
6
8
|
const installDockerOnMac = require('./install-on-mac');
|
|
7
9
|
const { checkDockerPerformance } = require('./performance');
|
|
8
10
|
const { checkDockerSocketPermissions } = require('./permissions');
|
|
9
|
-
const checkDockerStatus = require('./running-status');
|
|
11
|
+
const { checkDockerStatus, getDockerEngineAndDesktopServiceStatus } = require('./running-status');
|
|
10
12
|
const getDockerVersion = require('./version');
|
|
11
13
|
|
|
14
|
+
const USE_DOCKER_ENGINE_WITH_DOCKER_DESKTOP_ANSWER = 'useDockerEngineWithDockerDesktop';
|
|
15
|
+
|
|
12
16
|
const setVersionInContextTask = (task) => ({
|
|
13
17
|
task: (ctx) => {
|
|
14
18
|
if (ctx.platform === 'darwin' && ctx.dockerServerData && ctx.dockerServerData.Platform && ctx.dockerServerData.Platform.Name) {
|
|
@@ -19,32 +23,72 @@ const setVersionInContextTask = (task) => ({
|
|
|
19
23
|
}
|
|
20
24
|
});
|
|
21
25
|
|
|
22
|
-
const dockerInstallPromptLinux = async (task) => {
|
|
23
|
-
const automaticallyInstallDocker = await task.prompt({
|
|
24
|
-
type: '
|
|
26
|
+
const dockerInstallPromptLinux = async (task, { skipPrompt = false } = {}) => {
|
|
27
|
+
const automaticallyInstallDocker = skipPrompt ? 'yes' : await task.prompt({
|
|
28
|
+
type: 'Select',
|
|
25
29
|
message: `You don't have Docker installed!
|
|
26
30
|
Do you want to install it automatically?
|
|
27
|
-
|
|
31
|
+
`,
|
|
32
|
+
choices: [
|
|
33
|
+
{
|
|
34
|
+
name: 'yes',
|
|
35
|
+
message: 'Yes, I to install Docker automatically'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'no',
|
|
39
|
+
message: 'No, I want to install Docker myself'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'skip',
|
|
43
|
+
message: 'Skip installing Docker'
|
|
44
|
+
}
|
|
45
|
+
]
|
|
28
46
|
});
|
|
29
47
|
|
|
30
|
-
if (automaticallyInstallDocker) {
|
|
48
|
+
if (automaticallyInstallDocker === 'yes') {
|
|
31
49
|
return task.newListr([
|
|
32
|
-
|
|
50
|
+
installDockerEngine(),
|
|
51
|
+
checkDockerSocketPermissions(),
|
|
33
52
|
getDockerVersion(),
|
|
34
53
|
{
|
|
35
|
-
task: (ctx) => {
|
|
54
|
+
task: async (ctx) => {
|
|
36
55
|
task.title = `Using docker version ${ctx.dockerVersion}`;
|
|
37
56
|
|
|
57
|
+
const confirmLogOut = await task.prompt({
|
|
58
|
+
type: 'Select',
|
|
59
|
+
message: 'Docker installed successfully!\n',
|
|
60
|
+
choices: [
|
|
61
|
+
{
|
|
62
|
+
name: 'log-out',
|
|
63
|
+
message: `${logger.style.command('[Recommended]')} Now I will log out and log back it (or restart my system) to re-evaluate group membership`
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'skip',
|
|
67
|
+
message: 'Skip log out and proceed with installation'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (confirmLogOut === 'skip') {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
38
76
|
throw new KnownError(
|
|
39
77
|
`Docker is installed successfully!
|
|
40
|
-
Please log out and log back
|
|
78
|
+
Please log out and log back in (or restart your system) so your group membership is re-evaluated!
|
|
41
79
|
Learn more here: ${ logger.style.link('https://docs.docker.com/engine/install/linux-postinstall/') }`
|
|
42
80
|
);
|
|
43
81
|
}
|
|
44
|
-
}
|
|
82
|
+
},
|
|
83
|
+
checkDockerStatus(),
|
|
84
|
+
checkDockerDesktopContext()
|
|
45
85
|
]);
|
|
46
86
|
}
|
|
47
87
|
|
|
88
|
+
if (automaticallyInstallDocker === 'skip') {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
48
92
|
throw new KnownError('Docker is not installed!');
|
|
49
93
|
};
|
|
50
94
|
|
|
@@ -64,7 +108,8 @@ const dockerInstallPromptMacOS = async (task) => {
|
|
|
64
108
|
const confirmationToInstallDocker = await task.prompt({
|
|
65
109
|
type: 'Select',
|
|
66
110
|
message: `You don't have Docker installed!
|
|
67
|
-
Would you like to install it automatically using brew cask or you prefer to install it manually
|
|
111
|
+
Would you like to install it automatically using brew cask or you prefer to install it manually?
|
|
112
|
+
`,
|
|
68
113
|
choices: [
|
|
69
114
|
{
|
|
70
115
|
name: 'automatic',
|
|
@@ -80,6 +125,7 @@ Would you like to install it automatically using brew cask or you prefer to inst
|
|
|
80
125
|
if (confirmationToInstallDocker === 'automatic') {
|
|
81
126
|
return task.newListr([
|
|
82
127
|
installDockerOnMac(),
|
|
128
|
+
checkDockerSocketPermissions(),
|
|
83
129
|
checkDockerStatus(),
|
|
84
130
|
getDockerVersion(),
|
|
85
131
|
setVersionInContextTask(task)
|
|
@@ -106,24 +152,70 @@ const checkDocker = () => ({
|
|
|
106
152
|
});
|
|
107
153
|
|
|
108
154
|
if (code !== 0) {
|
|
109
|
-
if (ctx.platform === 'linux'
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
155
|
+
if (ctx.platform === 'linux') {
|
|
156
|
+
if (!ctx.isWsl) {
|
|
157
|
+
const { engine } = await getDockerEngineAndDesktopServiceStatus();
|
|
158
|
+
if (!engine.exists) {
|
|
159
|
+
const result = await dockerInstallPromptLinux(task);
|
|
160
|
+
if (result) {
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else if (ctx.isWsl) {
|
|
165
|
+
dockerInstallPromptWindows();
|
|
113
166
|
}
|
|
114
|
-
} else if (ctx.isWsl) {
|
|
115
|
-
dockerInstallPromptWindows();
|
|
116
167
|
} else {
|
|
117
168
|
const result = await dockerInstallPromptMacOS(task);
|
|
118
169
|
if (result) {
|
|
119
170
|
return result;
|
|
120
171
|
}
|
|
121
172
|
}
|
|
173
|
+
} else if (ctx.platform === 'linux') {
|
|
174
|
+
const { engine, desktop } = await getDockerEngineAndDesktopServiceStatus();
|
|
175
|
+
if (!engine.exists
|
|
176
|
+
&& desktop.exists
|
|
177
|
+
&& cmaGlobalConfig.get(USE_DOCKER_ENGINE_WITH_DOCKER_DESKTOP_ANSWER) !== false
|
|
178
|
+
) {
|
|
179
|
+
const confirmInstallingDockerEngine = await task.prompt({
|
|
180
|
+
type: 'Select',
|
|
181
|
+
message: `Looks like you have Docker Desktop installed on Linux system, but Docker Engine is not installed.
|
|
182
|
+
Do you want to install it and use it's context together with Docker Desktop?
|
|
183
|
+
`,
|
|
184
|
+
choices: [
|
|
185
|
+
{
|
|
186
|
+
name: 'yes',
|
|
187
|
+
message: 'Sure, if it means I will have less issues with my setup!'
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'no',
|
|
191
|
+
message: 'No. But you can ask me again later.'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'skip',
|
|
195
|
+
message: 'No. And don\'t ask me again.'
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
if (confirmInstallingDockerEngine === 'skip') {
|
|
201
|
+
cmaGlobalConfig.set(USE_DOCKER_ENGINE_WITH_DOCKER_DESKTOP_ANSWER, false);
|
|
202
|
+
} else if (confirmInstallingDockerEngine === 'yes') {
|
|
203
|
+
const result = await dockerInstallPromptLinux(task, {
|
|
204
|
+
skipPrompt: true
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
if (result) {
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
122
212
|
}
|
|
123
213
|
|
|
124
214
|
return task.newListr([
|
|
215
|
+
checkDockerSocketPermissions(),
|
|
125
216
|
checkDockerStatus(),
|
|
126
217
|
getDockerVersion(),
|
|
218
|
+
checkDockerDesktopContext(),
|
|
127
219
|
setVersionInContextTask(task)
|
|
128
220
|
]);
|
|
129
221
|
}
|
|
@@ -134,7 +226,6 @@ const checkDocker = () => ({
|
|
|
134
226
|
*/
|
|
135
227
|
module.exports = () => ({
|
|
136
228
|
task: (ctx, task) => task.newListr([
|
|
137
|
-
checkDockerSocketPermissions(),
|
|
138
229
|
checkDocker(),
|
|
139
230
|
checkDockerPerformance()
|
|
140
231
|
], {
|
|
@@ -17,8 +17,8 @@ const postInstallSteps = [
|
|
|
17
17
|
/**
|
|
18
18
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
19
19
|
*/
|
|
20
|
-
const
|
|
21
|
-
title: 'Installing Docker',
|
|
20
|
+
const installDockerEngine = () => ({
|
|
21
|
+
title: 'Installing Docker Engine',
|
|
22
22
|
task: async (ctx, task) => {
|
|
23
23
|
const distro = await osPlatform();
|
|
24
24
|
switch (distro) {
|
|
@@ -32,12 +32,21 @@ const installDocker = () => ({
|
|
|
32
32
|
...postInstallSteps
|
|
33
33
|
]);
|
|
34
34
|
}
|
|
35
|
-
case 'Fedora':
|
|
35
|
+
case 'Fedora': {
|
|
36
|
+
return task.newListr([
|
|
37
|
+
executeSudoCommand('sudo dnf -y install dnf-plugins-core'),
|
|
38
|
+
executeSudoCommand('sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo'),
|
|
39
|
+
executeSudoCommand('sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin'),
|
|
40
|
+
enableAndStartDockerCommand(),
|
|
41
|
+
...postInstallSteps
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
36
44
|
case 'CentOS': {
|
|
37
45
|
return task.newListr([
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
executeSudoCommand('sudo yum install -y yum-utils'),
|
|
47
|
+
executeSudoCommand('sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'),
|
|
48
|
+
executeSudoCommand('sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin'),
|
|
49
|
+
...postInstallSteps
|
|
41
50
|
]);
|
|
42
51
|
}
|
|
43
52
|
case 'Ubuntu': {
|
|
@@ -53,7 +62,12 @@ const installDocker = () => ({
|
|
|
53
62
|
Your distro ${distro} is not supported by automatic installation.`);
|
|
54
63
|
}
|
|
55
64
|
}
|
|
65
|
+
},
|
|
66
|
+
options: {
|
|
67
|
+
bottomBar: 10
|
|
56
68
|
}
|
|
57
69
|
});
|
|
58
70
|
|
|
59
|
-
module.exports =
|
|
71
|
+
module.exports = {
|
|
72
|
+
installDockerEngine
|
|
73
|
+
};
|
|
@@ -2,7 +2,7 @@ const os = require('os');
|
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
4
4
|
const pathExists = require('../../../util/path-exists');
|
|
5
|
-
const
|
|
5
|
+
const executeSudoCommand = require('../../../util/execute-sudo-command');
|
|
6
6
|
|
|
7
7
|
const dockerSocketPath = '/var/run/docker.sock';
|
|
8
8
|
|
|
@@ -33,16 +33,7 @@ Otherwise installation will likely fail.`
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
if (confirmPrompt) {
|
|
36
|
-
task.
|
|
37
|
-
task.output = logger.style.command(`>[sudo] password for ${ os.userInfo().username }:`);
|
|
38
|
-
return task.newListr(
|
|
39
|
-
execCommandTask(fixCommand, {
|
|
40
|
-
callback: (t) => {
|
|
41
|
-
task.output = t;
|
|
42
|
-
},
|
|
43
|
-
pipeInput: true
|
|
44
|
-
})
|
|
45
|
-
);
|
|
36
|
+
return task.newListr(executeSudoCommand(fixCommand));
|
|
46
37
|
}
|
|
47
38
|
task.skip(`Permission issue detected in ${ logger.style.file(dockerSocketPath) } but user decided not to fix it.`);
|
|
48
39
|
}
|
|
@@ -10,6 +10,41 @@ const getDockerVersion = () => execAsyncSpawn('docker version --format {{.Server
|
|
|
10
10
|
withCode: true
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
+
const getDockerEngineAndDesktopServiceStatus = async () => {
|
|
14
|
+
const dockerEngineService = systemctlControl('docker');
|
|
15
|
+
const dockerDesktopService = systemctlControl('docker-desktop', { user: true });
|
|
16
|
+
const [
|
|
17
|
+
dockerEngineServiceExists,
|
|
18
|
+
dockerDesktopServiceExists,
|
|
19
|
+
dockerEngineServiceIsRunning,
|
|
20
|
+
dockerDesktopServiceIsRunning,
|
|
21
|
+
dockerEngineServiceIsEnabled,
|
|
22
|
+
dockerDesktopServiceIsEnabled
|
|
23
|
+
] = await Promise.all([
|
|
24
|
+
dockerEngineService.exists(),
|
|
25
|
+
dockerDesktopService.exists(),
|
|
26
|
+
dockerEngineService.isRunning(),
|
|
27
|
+
dockerDesktopService.isRunning(),
|
|
28
|
+
dockerEngineService.isEnabled(),
|
|
29
|
+
dockerDesktopService.isEnabled()
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
engine: {
|
|
34
|
+
service: dockerEngineService,
|
|
35
|
+
exists: dockerEngineServiceExists,
|
|
36
|
+
isRunning: dockerEngineServiceIsRunning,
|
|
37
|
+
isEnabled: dockerEngineServiceIsEnabled
|
|
38
|
+
},
|
|
39
|
+
desktop: {
|
|
40
|
+
service: dockerDesktopService,
|
|
41
|
+
exists: dockerDesktopServiceExists,
|
|
42
|
+
isRunning: dockerDesktopServiceIsRunning,
|
|
43
|
+
isEnabled: dockerDesktopServiceIsEnabled
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
13
48
|
/**
|
|
14
49
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
15
50
|
*/
|
|
@@ -81,39 +116,71 @@ Please open Docker Desktop application for Windows and make sure that Docker is
|
|
|
81
116
|
const checkDockerStatusLinux = () => ({
|
|
82
117
|
title: 'Checking Docker status on Linux',
|
|
83
118
|
task: async (ctx, task) => {
|
|
84
|
-
const
|
|
119
|
+
const {
|
|
120
|
+
engine,
|
|
121
|
+
desktop
|
|
122
|
+
} = await getDockerEngineAndDesktopServiceStatus();
|
|
123
|
+
|
|
124
|
+
if (engine.exists) {
|
|
125
|
+
if (!engine.isEnabled && !engine.isRunning) {
|
|
126
|
+
const dockerStartConfirmation = await task.prompt({
|
|
127
|
+
type: 'Confirm',
|
|
128
|
+
message: `Looks like Docker Engine is not enabled and not running, would you like to enable and run it?
|
|
85
129
|
|
|
86
|
-
|
|
87
|
-
|
|
130
|
+
This action requires root privileges.`
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
if (dockerStartConfirmation) {
|
|
134
|
+
await engine.service.enableAndStart();
|
|
88
135
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
task.skip('User skipped running Docker');
|
|
139
|
+
} else if (!engine.isRunning) {
|
|
140
|
+
const dockerStartConfirmation = await task.prompt({
|
|
141
|
+
type: 'Confirm',
|
|
142
|
+
message: `Looks like Docker Engine is not running, would you like to run it?
|
|
93
143
|
|
|
94
|
-
This action requires root privileges.`
|
|
95
|
-
|
|
144
|
+
This action requires root privileges.`
|
|
145
|
+
});
|
|
96
146
|
|
|
97
|
-
|
|
98
|
-
|
|
147
|
+
if (dockerStartConfirmation) {
|
|
148
|
+
await engine.service.start();
|
|
99
149
|
|
|
100
|
-
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
task.skip('User skipped running Docker Engine');
|
|
101
153
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
154
|
+
} else if (desktop.exists) {
|
|
155
|
+
if (!desktop.isEnabled && !desktop.isRunning) {
|
|
156
|
+
const dockerStartConfirmation = await task.prompt({
|
|
157
|
+
type: 'Confirm',
|
|
158
|
+
message: `Looks like Docker Desktop is not enabled and not running, would you like to enable and run it?
|
|
159
|
+
|
|
160
|
+
This action requires root privileges.`
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
if (dockerStartConfirmation) {
|
|
164
|
+
await desktop.service.enableAndStart();
|
|
165
|
+
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
task.skip('User skipped running Docker');
|
|
169
|
+
} else if (!desktop.isRunning) {
|
|
170
|
+
const dockerStartConfirmation = await task.prompt({
|
|
171
|
+
type: 'Confirm',
|
|
172
|
+
message: `Looks like Docker Desktop is not running, would you like to run it?
|
|
107
173
|
|
|
108
|
-
This action requires root privileges.`
|
|
109
|
-
|
|
174
|
+
This action requires root privileges.`
|
|
175
|
+
});
|
|
110
176
|
|
|
111
|
-
|
|
112
|
-
|
|
177
|
+
if (dockerStartConfirmation) {
|
|
178
|
+
await desktop.service.start();
|
|
113
179
|
|
|
114
|
-
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
task.skip('User skipped running Docker Desktop');
|
|
115
183
|
}
|
|
116
|
-
task.skip('User skipped running Docker');
|
|
117
184
|
}
|
|
118
185
|
}
|
|
119
186
|
});
|
|
@@ -135,4 +202,7 @@ const checkDockerStatus = () => ({
|
|
|
135
202
|
}
|
|
136
203
|
});
|
|
137
204
|
|
|
138
|
-
module.exports =
|
|
205
|
+
module.exports = {
|
|
206
|
+
checkDockerStatus,
|
|
207
|
+
getDockerEngineAndDesktopServiceStatus
|
|
208
|
+
};
|
|
@@ -14,6 +14,7 @@ const getDockerVersion = () => ({
|
|
|
14
14
|
ctx.dockerServerData = dockerVersion.Server;
|
|
15
15
|
ctx.dockerClientData = dockerVersion.Client;
|
|
16
16
|
ctx.dockerVersion = dockerVersion.Server.Version;
|
|
17
|
+
ctx.isDockerDesktop = dockerVersion.Server.Platform.Name.includes('Desktop');
|
|
17
18
|
} else {
|
|
18
19
|
throw new UnknownError(`Got unexpected result during Docker version retrieval!\n\n${ dockerVersion }`);
|
|
19
20
|
}
|
|
@@ -7,8 +7,10 @@ const { runContainerImage } = require('../../util/run-container-image');
|
|
|
7
7
|
const checkPHPVersion = () => ({
|
|
8
8
|
title: 'Checking container PHP version',
|
|
9
9
|
task: async (ctx, task) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const phpVersionResponse = await runContainerImage(
|
|
11
|
+
ctx.config.overridenConfiguration.configuration.php.baseImage,
|
|
12
|
+
'php --version'
|
|
13
|
+
);
|
|
12
14
|
|
|
13
15
|
const phpVersionResponseResult = phpVersionResponse.match(/PHP\s(\d+\.\d+\.\d+)/i);
|
|
14
16
|
|
package/lib/tasks/start.js
CHANGED
|
@@ -28,6 +28,17 @@ const waitingForVarnish = require('./magento/setup-magento/waiting-for-varnish')
|
|
|
28
28
|
const checkPHPVersion = require('./requirements/php-version');
|
|
29
29
|
const volumes = require('./docker/volume/tasks');
|
|
30
30
|
const convertMySQLDatabaseToMariaDB = require('./docker/convert-mysql-to-mariadb');
|
|
31
|
+
const { cmaGlobalConfig } = require('../config/cma-config');
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
35
|
+
*/
|
|
36
|
+
const resetCmaGlobalConfig = () => ({
|
|
37
|
+
skip: (ctx) => !ctx.resetGlobalConfig,
|
|
38
|
+
task: () => {
|
|
39
|
+
cmaGlobalConfig.clear();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
31
42
|
|
|
32
43
|
/**
|
|
33
44
|
* @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
@@ -39,7 +50,6 @@ const retrieveProjectConfiguration = () => ({
|
|
|
39
50
|
checkConfigurationFile(),
|
|
40
51
|
getProjectConfiguration(),
|
|
41
52
|
convertLegacyVolumes(),
|
|
42
|
-
convertMySQLDatabaseToMariaDB(),
|
|
43
53
|
createCacheFolder(),
|
|
44
54
|
getSystemConfigTask(),
|
|
45
55
|
getCachedPorts()
|
|
@@ -59,7 +69,8 @@ const retrieveProjectConfiguration = () => ({
|
|
|
59
69
|
const stopProject = () => ({
|
|
60
70
|
title: 'Stopping project',
|
|
61
71
|
task: (ctx, task) => task.newListr([
|
|
62
|
-
stopContainers()
|
|
72
|
+
stopContainers(),
|
|
73
|
+
volumes.removeLocalVolumes()
|
|
63
74
|
]),
|
|
64
75
|
options: {
|
|
65
76
|
showTimer: false
|
|
@@ -93,9 +104,19 @@ const retrieveFreshProjectConfiguration = () => ({
|
|
|
93
104
|
const configureProject = () => ({
|
|
94
105
|
title: 'Configuring project',
|
|
95
106
|
task: (ctx, task) => task.newListr([
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
convertMySQLDatabaseToMariaDB(),
|
|
108
|
+
{
|
|
109
|
+
task: (ctx, task) => task.newListr([
|
|
110
|
+
pullImages(),
|
|
111
|
+
dockerNetwork.tasks.createNetwork()
|
|
112
|
+
], { concurrent: true })
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
task: (ctx, task) => task.newListr([
|
|
116
|
+
checkPHPVersion(),
|
|
117
|
+
getComposerVersionTask()
|
|
118
|
+
], { concurrent: true })
|
|
119
|
+
},
|
|
99
120
|
{
|
|
100
121
|
task: (ctx, task) => task.newListr([
|
|
101
122
|
buildProjectImage(),
|
|
@@ -104,9 +125,8 @@ const configureProject = () => ({
|
|
|
104
125
|
concurrent: true
|
|
105
126
|
})
|
|
106
127
|
},
|
|
107
|
-
checkPHPVersion(),
|
|
108
|
-
getComposerVersionTask(),
|
|
109
128
|
prepareFileSystem(),
|
|
129
|
+
volumes.createVolumes(),
|
|
110
130
|
installMagentoProject(),
|
|
111
131
|
enableMagentoComposerPlugins(),
|
|
112
132
|
startServices(),
|
|
@@ -138,6 +158,7 @@ const start = () => ({
|
|
|
138
158
|
task: (ctx, task) => {
|
|
139
159
|
task.title = `Starting project (magento-scripts@${pkg.version})`;
|
|
140
160
|
return task.newListr([
|
|
161
|
+
resetCmaGlobalConfig(),
|
|
141
162
|
checkRequirements(),
|
|
142
163
|
retrieveProjectConfiguration(),
|
|
143
164
|
stopProject(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
1
2
|
const path = require('path');
|
|
2
3
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
3
4
|
const { getProjectCreatedAt, getPrefix } = require('../../util/prefix');
|
|
@@ -5,7 +6,6 @@ const { getProjectCreatedAt, getPrefix } = require('../../util/prefix');
|
|
|
5
6
|
const { version: packageVersion } = require('../../../package.json');
|
|
6
7
|
const { getArchSync } = require('../../util/arch');
|
|
7
8
|
const ConsoleBlock = require('../../util/console-block');
|
|
8
|
-
const { getComposerVersion } = require('../composer');
|
|
9
9
|
const { getInstanceMetadata } = require('../../util/instance-metadata');
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -22,6 +22,9 @@ const parsePort = (port) => {
|
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* @param {import('../../../typings/context').ListrContext & { containers: ReturnType<Awaited<ReturnType<import('../../config/docker')>>['getContainers']> }} ctx
|
|
27
|
+
*/
|
|
25
28
|
const prettyStatus = async (ctx) => {
|
|
26
29
|
const {
|
|
27
30
|
config: {
|
|
@@ -31,10 +34,10 @@ const prettyStatus = async (ctx) => {
|
|
|
31
34
|
dockerVersion,
|
|
32
35
|
platform,
|
|
33
36
|
platformVersion,
|
|
34
|
-
containers
|
|
37
|
+
containers,
|
|
38
|
+
composerVersion
|
|
35
39
|
} = ctx;
|
|
36
40
|
const projectCreatedAt = getProjectCreatedAt();
|
|
37
|
-
const composerVersion = await getComposerVersion(ctx);
|
|
38
41
|
|
|
39
42
|
const prefix = getPrefix();
|
|
40
43
|
|
|
@@ -103,6 +106,13 @@ const prettyStatus = async (ctx) => {
|
|
|
103
106
|
block.addLine(`${' '.repeat(3)} ${logger.style.misc(envName)}=${logger.style.file(envValue)}`);
|
|
104
107
|
}
|
|
105
108
|
}
|
|
109
|
+
|
|
110
|
+
if (container.description) {
|
|
111
|
+
block.addLine('Description:');
|
|
112
|
+
container.description.split('\n').forEach((line) => {
|
|
113
|
+
block.addLine(line);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
106
116
|
});
|
|
107
117
|
|
|
108
118
|
const instanceMetadata = getInstanceMetadata(ctx);
|
|
@@ -123,14 +133,6 @@ const prettyStatus = async (ctx) => {
|
|
|
123
133
|
instanceMetadata.admin.forEach(({ title, text }) => {
|
|
124
134
|
block.addLine(` ${title}: ${text}`);
|
|
125
135
|
});
|
|
126
|
-
// block
|
|
127
|
-
// .addEmptyLine()
|
|
128
|
-
// .addSeparator('Magento status')
|
|
129
|
-
// .addEmptyLine()
|
|
130
|
-
// .addLine(`Web location: ${logger.style.link(`${ssl.enabled ? 'https' : 'http'}://${host}${ports.app === 80 ? '' : `:${ports.app}`}/`)}`)
|
|
131
|
-
// .addLine(`Magento Admin panel location: ${logger.style.link(`${ssl.enabled ? 'https' : 'http'}://${host}${ports.app === 80 ? '' : `:${ports.app}`}/${magentoConfiguration.adminuri}`)}`)
|
|
132
|
-
// .addLine(`Magento Admin panel credentials: ${logger.style.misc(magentoConfiguration.user)} - ${logger.style.misc(magentoConfiguration.password)}`)
|
|
133
|
-
// .addEmptyLine();
|
|
134
136
|
|
|
135
137
|
block.log();
|
|
136
138
|
};
|
package/lib/tasks/stop.js
CHANGED
|
@@ -2,6 +2,7 @@ const { stopServices } = require('./docker');
|
|
|
2
2
|
const getMagentoVersionConfig = require('../config/get-magento-version-config');
|
|
3
3
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
4
4
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
5
|
+
const getDockerVersion = require('./requirements/docker/version');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
@@ -9,6 +10,7 @@ const checkConfigurationFile = require('../config/check-configuration-file');
|
|
|
9
10
|
const stop = () => ({
|
|
10
11
|
title: 'Stopping project',
|
|
11
12
|
task: async (ctx, task) => task.newListr([
|
|
13
|
+
getDockerVersion(),
|
|
12
14
|
getMagentoVersionConfig(),
|
|
13
15
|
checkConfigurationFile(),
|
|
14
16
|
getProjectConfiguration(),
|
|
@@ -69,6 +69,7 @@ const phpConfigurationSchema = Joi.object({
|
|
|
69
69
|
debugImage: Joi.string().optional(),
|
|
70
70
|
fpmConfigTemplate: Joi.string().optional(),
|
|
71
71
|
configTemplate: Joi.string().optional().custom(fileExistsValidator),
|
|
72
|
+
debugTemplate: Joi.string().optional().custom(fileExistsValidator),
|
|
72
73
|
extensions: phpExtensionConfiguration.optional()
|
|
73
74
|
});
|
|
74
75
|
|
|
@@ -85,6 +86,7 @@ const nginxConfigurationSchema = Joi.object({
|
|
|
85
86
|
*/
|
|
86
87
|
const varnishConfigurationSchema = Joi.object({
|
|
87
88
|
enabled: Joi.boolean().optional(),
|
|
89
|
+
healthCheck: Joi.boolean().optional(),
|
|
88
90
|
image: Joi.string().optional(),
|
|
89
91
|
configTemplate: Joi.string().optional().custom(fileExistsValidator)
|
|
90
92
|
});
|