@scandipwa/magento-scripts 2.3.7 → 2.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/exec.js +2 -2
- package/index.js +1 -0
- package/lib/commands/cli.js +17 -19
- package/lib/commands/execute.js +8 -4
- package/lib/commands/start.js +0 -6
- package/lib/config/docker.js +67 -128
- package/lib/config/get-project-configuration.js +0 -5
- package/lib/config/php-config.js +4 -0
- package/lib/config/port-config.js +1 -0
- package/lib/config/services/composer/versions/composer-2.8.js +1 -1
- package/lib/config/services/elasticsearch/versions/elasticsearch-8.17.js +14 -0
- package/lib/config/services/elasticsearch/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/index.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-11.4.js +9 -0
- package/lib/config/services/mariadb/versions/mariadb-11.6.js +9 -0
- package/lib/config/services/opensearch/versions/index.js +3 -1
- package/lib/config/services/opensearch/versions/opensearch-2.19.js +14 -0
- package/lib/config/services/php/extensions/ftp.js +7 -0
- package/lib/config/services/php/versions/index.js +2 -1
- package/lib/config/services/php/versions/php-7.2.js +0 -1
- package/lib/config/services/php/versions/php-7.3.js +0 -1
- package/lib/config/services/php/versions/php-7.4.js +0 -1
- package/lib/config/services/php/versions/php-8.1.js +4 -2
- package/lib/config/services/php/versions/php-8.2.js +1 -2
- package/lib/config/services/php/versions/php-8.3.js +32 -0
- package/lib/config/services/redis/index.js +6 -1
- package/lib/config/services/redis/valkey-8.0.js +8 -0
- package/lib/config/services/redis/valkey-8.1.js +8 -0
- package/lib/config/services/varnish/varnish-6-0.js +1 -1
- package/lib/config/services/varnish/varnish-6-6.js +1 -1
- package/lib/config/services/varnish/varnish-7-0.js +1 -1
- package/lib/config/services/varnish/varnish-7-1.js +1 -1
- package/lib/config/services/varnish/varnish-7-3.js +1 -1
- package/lib/config/services/varnish/varnish-7-4.js +1 -1
- package/lib/config/services/varnish/varnish-7-5.js +1 -1
- package/lib/config/services/varnish/varnish-7-6.js +1 -1
- package/lib/config/templates/nginx.template.conf +31 -8
- package/lib/config/templates/ssl-terminator.template.conf +2 -0
- package/lib/config/versions/magento-2.4.4-p13.js +40 -0
- package/lib/config/versions/magento-2.4.5-p12.js +40 -0
- package/lib/config/versions/magento-2.4.6-p10.js +40 -0
- package/lib/config/versions/magento-2.4.7-p4.js +0 -1
- package/lib/config/versions/magento-2.4.7-p5.js +41 -0
- package/lib/config/versions/magento-2.4.8.js +43 -0
- package/lib/tasks/database/create-magento-database.js +5 -4
- package/lib/tasks/docker/containers/container-api.d.ts +9 -3
- package/lib/tasks/docker/containers/container-api.js +14 -9
- package/lib/tasks/docker/containers/tasks.js +18 -12
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +14 -22
- package/lib/tasks/docker/project-image-builder.js +113 -61
- package/lib/tasks/execute.js +9 -9
- package/lib/tasks/file-system/create-php-debug-config.js +1 -2
- package/lib/tasks/file-system/create-php-fpm-debug-config.js +33 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +5 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +2 -2
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +4 -3
- package/lib/tasks/file-system/create-ssl-terminator-config.js +27 -1
- package/lib/tasks/file-system/index.js +2 -0
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +0 -1
- package/lib/tasks/php/php-container.d.ts +3 -3
- package/lib/tasks/php/php-container.js +6 -16
- package/lib/tasks/php/update-env-php.js +4 -5
- package/lib/tasks/project-config/index.js +0 -3
- package/lib/tasks/requirements/elasticsearch-version.js +4 -4
- package/lib/tasks/requirements/opensearch-version.js +4 -4
- package/lib/tasks/start.js +2 -13
- package/lib/util/execute-in-container.js +12 -8
- package/package.json +2 -2
- package/typings/context.d.ts +9 -3
- package/typings/index.d.ts +0 -5
|
@@ -35,36 +35,41 @@ const getEnabledExtensionsFromImage = async (imageWithTag) => {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* @type {(builder: DockerFileBuilder, ctx: import('../../../typings/context').ListrContext
|
|
38
|
+
* @type {(builder: DockerFileBuilder, ctx: import('../../../typings/context').ListrContext, [extensionName, extensionInstructions]: [string, import('../../../typings').PHPExtensionInstallationInstruction]) => Promise<void>}
|
|
39
39
|
*/
|
|
40
|
-
const addExtensionToBuilder =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.comment(`extension ${extensionName} installation command`)
|
|
59
|
-
.run(runCommand.trim())
|
|
40
|
+
const addExtensionToBuilder = async (
|
|
41
|
+
builder,
|
|
42
|
+
ctx,
|
|
43
|
+
[extensionName, extensionInstructions]
|
|
44
|
+
) => {
|
|
45
|
+
const { command, ...extensionInstructionsWithoutCommand } =
|
|
46
|
+
extensionInstructions
|
|
47
|
+
let runCommand = ''
|
|
48
|
+
if (typeof command === 'string') {
|
|
49
|
+
runCommand += ` ${command}`
|
|
50
|
+
} else if (typeof command === 'function') {
|
|
51
|
+
runCommand += ` ${await Promise.resolve(
|
|
52
|
+
command({ ...extensionInstructionsWithoutCommand, ctx })
|
|
53
|
+
)}`
|
|
54
|
+
} else {
|
|
55
|
+
runCommand += ` docker-php-ext-install ${
|
|
56
|
+
extensionInstructionsWithoutCommand.name || extensionName
|
|
57
|
+
}`
|
|
60
58
|
}
|
|
59
|
+
builder
|
|
60
|
+
.comment(`extension ${extensionName} installation command`)
|
|
61
|
+
.run(runCommand.trim())
|
|
62
|
+
}
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* @param {import('../../../typings/context').ListrContext} ctx
|
|
64
|
-
* @param {{ image: string, tag: string}} param1
|
|
66
|
+
* @param {{ image: string, tag: string, ignorePHPExtensions?: string[] }} param1
|
|
65
67
|
*/
|
|
66
|
-
const buildDockerFileInstructions = async (
|
|
67
|
-
|
|
68
|
+
const buildDockerFileInstructions = async (
|
|
69
|
+
ctx,
|
|
70
|
+
{ image, tag, ignorePHPExtensions = [] }
|
|
71
|
+
) => {
|
|
72
|
+
const { composer, php } = ctx.config.overridenConfiguration.configuration
|
|
68
73
|
const existingPHPExtensions = await getEnabledExtensionsFromImage(
|
|
69
74
|
`${image}:${tag}`
|
|
70
75
|
)
|
|
@@ -73,9 +78,11 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
73
78
|
formatToJSON: true
|
|
74
79
|
})
|
|
75
80
|
|
|
76
|
-
const missingExtensions = Object.entries(
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
const missingExtensions = Object.entries(php.extensions)
|
|
82
|
+
.filter(
|
|
83
|
+
([extensionName]) =>
|
|
84
|
+
!ignorePHPExtensions.includes(extensionName.toLowerCase())
|
|
85
|
+
)
|
|
79
86
|
.filter(
|
|
80
87
|
([extensionName, extensionInstructions]) =>
|
|
81
88
|
!Object.entries(existingPHPExtensions)
|
|
@@ -89,7 +96,6 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
89
96
|
.includes(n))
|
|
90
97
|
)
|
|
91
98
|
)
|
|
92
|
-
.filter(([extensionName]) => extensionName.toLowerCase() !== 'xdebug')
|
|
93
99
|
|
|
94
100
|
const dockerFileInstructions = new DockerFileBuilder()
|
|
95
101
|
.comment('project image')
|
|
@@ -112,8 +118,9 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
112
118
|
for (const missingExtensionInstructions of missingExtensions) {
|
|
113
119
|
await addExtensionToBuilder(
|
|
114
120
|
dockerFileInstructions,
|
|
115
|
-
ctx
|
|
116
|
-
|
|
121
|
+
ctx,
|
|
122
|
+
missingExtensionInstructions
|
|
123
|
+
)
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
|
|
@@ -191,9 +198,10 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
191
198
|
})
|
|
192
199
|
}
|
|
193
200
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
const { newRelic } = ctx.config.overridenConfiguration.configuration
|
|
202
|
+
|
|
203
|
+
if (newRelic && newRelic.enabled) {
|
|
204
|
+
const { agentVersion, licenseKey } = newRelic
|
|
197
205
|
|
|
198
206
|
// eslint-disable-next-line max-len
|
|
199
207
|
dockerFileInstructions.run('apk add --no-cache gcompat')
|
|
@@ -212,14 +220,70 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
212
220
|
\\$PHP_INI_DIR/conf.d/newrelic.ini`)
|
|
213
221
|
}
|
|
214
222
|
|
|
215
|
-
return dockerFileInstructions
|
|
223
|
+
return dockerFileInstructions.build()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @param {import('../../../typings/context').ListrContext} ctx
|
|
228
|
+
* @param {{ image: string, tag: string }} param1
|
|
229
|
+
*/
|
|
230
|
+
const buildDebugDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
231
|
+
const { php } = ctx.config.overridenConfiguration.configuration
|
|
232
|
+
const existingPHPExtensions = await getEnabledExtensionsFromImage(
|
|
233
|
+
`${image}:${tag}`
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
const missingExtensions = Object.entries(php.extensions)
|
|
237
|
+
.filter(([extensionName]) => extensionName.toLowerCase() === 'xdebug')
|
|
238
|
+
.filter(
|
|
239
|
+
([extensionName, extensionInstructions]) =>
|
|
240
|
+
!Object.entries(existingPHPExtensions)
|
|
241
|
+
.map(([n, i]) => [n.toLowerCase(), i])
|
|
242
|
+
.some(
|
|
243
|
+
([n]) =>
|
|
244
|
+
extensionName === n ||
|
|
245
|
+
(extensionInstructions.alternativeName &&
|
|
246
|
+
extensionInstructions.alternativeName
|
|
247
|
+
.map((s) => s.toLowerCase())
|
|
248
|
+
.includes(n))
|
|
249
|
+
)
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
const dockerFileInstructions = new DockerFileBuilder()
|
|
253
|
+
.comment('project image')
|
|
254
|
+
.from({ image, tag })
|
|
255
|
+
|
|
256
|
+
if (missingExtensions.length > 0) {
|
|
257
|
+
const allDependencies = missingExtensions
|
|
258
|
+
.map(
|
|
259
|
+
([_extensionName, extensionInstructions]) =>
|
|
260
|
+
extensionInstructions.dependencies || []
|
|
261
|
+
)
|
|
262
|
+
.reduce(
|
|
263
|
+
(acc, val) => acc.concat(val.filter((ex) => !acc.includes(ex))),
|
|
264
|
+
[]
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
dockerFileInstructions.run(
|
|
268
|
+
`apk add --no-cache ${allDependencies.join(' ')}`
|
|
269
|
+
)
|
|
270
|
+
for (const missingExtensionInstructions of missingExtensions) {
|
|
271
|
+
await addExtensionToBuilder(
|
|
272
|
+
dockerFileInstructions,
|
|
273
|
+
ctx,
|
|
274
|
+
missingExtensionInstructions
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return dockerFileInstructions.build()
|
|
216
280
|
}
|
|
217
281
|
|
|
218
282
|
/**
|
|
219
283
|
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
220
284
|
*/
|
|
221
285
|
const buildProjectImage = () => ({
|
|
222
|
-
title: 'Building Project
|
|
286
|
+
title: 'Building Project Images',
|
|
223
287
|
task: async (ctx, task) => {
|
|
224
288
|
const containers = ctx.config.docker.getContainers(ctx.ports)
|
|
225
289
|
const [image, tag = 'latest'] =
|
|
@@ -228,13 +292,14 @@ const buildProjectImage = () => ({
|
|
|
228
292
|
)
|
|
229
293
|
const dockerFileInstructions = await buildDockerFileInstructions(ctx, {
|
|
230
294
|
image,
|
|
231
|
-
tag
|
|
295
|
+
tag,
|
|
296
|
+
ignorePHPExtensions: ['xdebug']
|
|
232
297
|
})
|
|
233
298
|
|
|
234
299
|
try {
|
|
235
300
|
await execAsyncSpawn(
|
|
236
301
|
`docker build -t ${containers.php.image} -<<EOF
|
|
237
|
-
${dockerFileInstructions
|
|
302
|
+
${dockerFileInstructions}
|
|
238
303
|
EOF`,
|
|
239
304
|
{
|
|
240
305
|
callback: (r) => {
|
|
@@ -247,32 +312,20 @@ EOF`,
|
|
|
247
312
|
`Unexpected error during project image building!\n\n${e}`
|
|
248
313
|
)
|
|
249
314
|
}
|
|
250
|
-
},
|
|
251
|
-
options: {
|
|
252
|
-
bottomBar: 10
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
315
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
ctx.config.overridenConfiguration.configuration.php.debugImage.split(
|
|
265
|
-
':'
|
|
266
|
-
)
|
|
267
|
-
const dockerFileInstructions = await buildDockerFileInstructions(ctx, {
|
|
268
|
-
image,
|
|
269
|
-
tag
|
|
270
|
-
})
|
|
316
|
+
const [phpImage, phpTag] = containers.php.image.split(':')
|
|
317
|
+
const debugImageInstructions = await buildDebugDockerFileInstructions(
|
|
318
|
+
ctx,
|
|
319
|
+
{
|
|
320
|
+
image: phpImage,
|
|
321
|
+
tag: phpTag
|
|
322
|
+
}
|
|
323
|
+
)
|
|
271
324
|
|
|
272
325
|
try {
|
|
273
326
|
await execAsyncSpawn(
|
|
274
|
-
`docker build -t ${containers.
|
|
275
|
-
${
|
|
327
|
+
`docker build -t ${containers.phpWithXdebug.image} -<<EOF
|
|
328
|
+
${debugImageInstructions}
|
|
276
329
|
EOF`,
|
|
277
330
|
{
|
|
278
331
|
callback: (r) => {
|
|
@@ -282,7 +335,7 @@ EOF`,
|
|
|
282
335
|
)
|
|
283
336
|
} catch (e) {
|
|
284
337
|
throw new KnownError(
|
|
285
|
-
`Unexpected error during
|
|
338
|
+
`Unexpected error during project image building!\n\n${e}`
|
|
286
339
|
)
|
|
287
340
|
}
|
|
288
341
|
},
|
|
@@ -293,6 +346,5 @@ EOF`,
|
|
|
293
346
|
|
|
294
347
|
module.exports = {
|
|
295
348
|
buildProjectImage,
|
|
296
|
-
buildDebugProjectImage,
|
|
297
349
|
getEnabledExtensionsFromImage
|
|
298
350
|
}
|
package/lib/tasks/execute.js
CHANGED
|
@@ -15,7 +15,7 @@ const KnownError = require('../errors/known-error')
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
|
-
* @param {{
|
|
18
|
+
* @param {{ containerName: string, commands: string[] }} argv
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
21
|
const executeTask = async (argv) => {
|
|
@@ -47,17 +47,17 @@ const executeTask = async (argv) => {
|
|
|
47
47
|
const services = Object.keys(containers)
|
|
48
48
|
|
|
49
49
|
if (
|
|
50
|
-
services.includes(argv.
|
|
51
|
-
services.some((service) => service.includes(argv.
|
|
50
|
+
services.includes(argv.containerName) ||
|
|
51
|
+
services.some((service) => service.includes(argv.containerName))
|
|
52
52
|
) {
|
|
53
|
-
const containerResult = containers[argv.
|
|
54
|
-
? containers[argv.
|
|
53
|
+
const containerResult = containers[argv.containerName]
|
|
54
|
+
? containers[argv.containerName]
|
|
55
55
|
: Object.entries(containers).find(([key]) =>
|
|
56
|
-
key.includes(argv.
|
|
56
|
+
key.includes(argv.containerName)
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
if (!containerResult) {
|
|
60
|
-
logger.error(`No container found "${argv.
|
|
60
|
+
logger.error(`No container found "${argv.containerName}"`)
|
|
61
61
|
process.exit(1)
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -95,7 +95,7 @@ const executeTask = async (argv) => {
|
|
|
95
95
|
|
|
96
96
|
const result = await executeInContainer({
|
|
97
97
|
containerName: container.name,
|
|
98
|
-
|
|
98
|
+
command: argv.commands.join(' '),
|
|
99
99
|
user: container.user
|
|
100
100
|
})
|
|
101
101
|
|
|
@@ -127,7 +127,7 @@ const executeTask = async (argv) => {
|
|
|
127
127
|
throw new KnownError(`Container ${container.name} is not running!`)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
logger.error(`No container found "${argv.
|
|
130
|
+
logger.error(`No container found "${argv.containerName}"`)
|
|
131
131
|
process.exit(1)
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -10,7 +10,6 @@ const {
|
|
|
10
10
|
*/
|
|
11
11
|
const createPhpDebugConfig = () => ({
|
|
12
12
|
title: 'Setting PHP XDebug config',
|
|
13
|
-
skip: (ctx) => !ctx.debug,
|
|
14
13
|
task: async (ctx) => {
|
|
15
14
|
const {
|
|
16
15
|
config: { php, baseConfig },
|
|
@@ -19,7 +18,7 @@ const createPhpDebugConfig = () => ({
|
|
|
19
18
|
} = ctx
|
|
20
19
|
const containers = ctx.config.docker.getContainers(ctx.ports)
|
|
21
20
|
const phpExtensions = await getEnabledExtensionsFromImage(
|
|
22
|
-
containers.
|
|
21
|
+
containers.phpWithXdebug.image
|
|
23
22
|
)
|
|
24
23
|
const isXDebug2 = semver.satisfies(phpExtensions.xdebug, '2')
|
|
25
24
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const UnknownError = require('../../errors/unknown-error')
|
|
2
|
+
const setConfigFile = require('../../util/set-config')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
6
|
+
*/
|
|
7
|
+
const createPhpFpmDebugConfig = () => ({
|
|
8
|
+
title: 'Setting php-fpm debug config',
|
|
9
|
+
task: async (ctx) => {
|
|
10
|
+
const {
|
|
11
|
+
config: { php },
|
|
12
|
+
isDockerDesktop
|
|
13
|
+
} = ctx
|
|
14
|
+
const port = !isDockerDesktop ? ctx.ports.fpmXdebug : 9000
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
await setConfigFile({
|
|
18
|
+
configPathname: php.debugFpmConfPath,
|
|
19
|
+
template: php.fpmTemplatePath,
|
|
20
|
+
overwrite: true,
|
|
21
|
+
templateArgs: {
|
|
22
|
+
port
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
} catch (e) {
|
|
26
|
+
throw new UnknownError(
|
|
27
|
+
`Unexpected error accrued during php-fpm config creation\n\n${e}`
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
module.exports = createPhpFpmDebugConfig
|
|
@@ -3,7 +3,7 @@ const { nameKey, propertyKey } = require('../keys')
|
|
|
3
3
|
const PHP_INTERPRETERS_COMPONENT_NAME = 'PhpInterpreters'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @param {Array} phpConfigs
|
|
6
|
+
* @param {Array<Record<string, any>>} phpConfigs
|
|
7
7
|
* @param {import('../../../../../typings/context').ListrContext} ctx
|
|
8
8
|
* @returns {Promise<Boolean>}
|
|
9
9
|
*/
|
|
@@ -13,8 +13,9 @@ const setupPHPInterpreters = async (phpConfigs, ctx) => {
|
|
|
13
13
|
(phpConfig) => phpConfig[nameKey] === PHP_INTERPRETERS_COMPONENT_NAME
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
const {
|
|
17
|
-
|
|
16
|
+
const {
|
|
17
|
+
phpWithXdebug: { image: currentInterpreterImage }
|
|
18
|
+
} = ctx.config.docker.getContainers(ctx.ports)
|
|
18
19
|
|
|
19
20
|
const defaultPhpInterpreterConfiguration = {
|
|
20
21
|
[nameKey]: currentInterpreterImage,
|
|
@@ -49,8 +50,7 @@ const setupPHPInterpreters = async (phpConfigs, ctx) => {
|
|
|
49
50
|
const phpInterpreterConfiguration =
|
|
50
51
|
phpInterpretersComponent.interpreters.interpreter.find(
|
|
51
52
|
(interpreter) =>
|
|
52
|
-
interpreter[nameKey] ===
|
|
53
|
-
interpreter[nameKey] === php.debugImage
|
|
53
|
+
interpreter[nameKey] === currentInterpreterImage
|
|
54
54
|
)
|
|
55
55
|
|
|
56
56
|
if (!phpInterpreterConfiguration) {
|
package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js
CHANGED
|
@@ -18,7 +18,7 @@ const defaultComposerSettingsProperties = {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @param {Array} workspaceConfigs
|
|
21
|
+
* @param {Array<Record<string, any>>} workspaceConfigs
|
|
22
22
|
* @param {import('../../../../../typings/context').ListrContext} ctx
|
|
23
23
|
* @returns {Promise<Boolean>}
|
|
24
24
|
*/
|
|
@@ -32,7 +32,7 @@ const setupComposerSettings = async (workspaceConfigs, ctx) => {
|
|
|
32
32
|
const isComposerJsonExists = await pathExists(composerJsonPath)
|
|
33
33
|
const { php } = ctx.config.docker.getContainers(ctx.ports)
|
|
34
34
|
const defaultInterpreterConfig = {
|
|
35
|
-
[nameKey]:
|
|
35
|
+
[nameKey]: php.image,
|
|
36
36
|
[composerKey]: 'composer'
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -6,7 +6,7 @@ const PHP_WORKSPACE_PROJECT_CONFIGURATION_COMPONENT_NAME =
|
|
|
6
6
|
const interpreterNameKey = '@_interpreter_name'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @param {Array} workspaceConfigs
|
|
9
|
+
* @param {Array<Record<string, any>>} workspaceConfigs
|
|
10
10
|
* @param {import('../../../../../typings/context').ListrContext} ctx
|
|
11
11
|
* @returns {Promise<Boolean>}
|
|
12
12
|
*/
|
|
@@ -17,8 +17,9 @@ const setupPHPWorkspaceProjectConfiguration = async (workspaceConfigs, ctx) => {
|
|
|
17
17
|
workspaceConfig[nameKey] ===
|
|
18
18
|
PHP_WORKSPACE_PROJECT_CONFIGURATION_COMPONENT_NAME
|
|
19
19
|
)
|
|
20
|
-
const {
|
|
21
|
-
|
|
20
|
+
const {
|
|
21
|
+
php: { image: currentInterpreterImage }
|
|
22
|
+
} = ctx.config.docker.getContainers(ctx.ports)
|
|
22
23
|
|
|
23
24
|
if (phpWorkspaceProjectConfigurationComponent) {
|
|
24
25
|
if (
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const fs = require('fs')
|
|
3
|
+
const semver = require('semver')
|
|
3
4
|
const setConfigFile = require('../../util/set-config')
|
|
4
5
|
const pathExists = require('../../util/path-exists')
|
|
5
6
|
const KnownError = require('../../errors/known-error')
|
|
6
7
|
const UnknownError = require('../../errors/unknown-error')
|
|
8
|
+
const { run } = require('../docker/containers/container-api')
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
@@ -75,6 +77,29 @@ const createSSLTerminatorConfig = () => ({
|
|
|
75
77
|
: 'host.docker.internal'
|
|
76
78
|
const hostPort = !isDockerDesktop ? ports.sslTerminator : 80
|
|
77
79
|
|
|
80
|
+
const nginxVersionOutput = await run({
|
|
81
|
+
image: sslTerminator.image,
|
|
82
|
+
command: 'nginx -v',
|
|
83
|
+
detach: false,
|
|
84
|
+
rm: true
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const nginxVersionMatch = nginxVersionOutput.match(
|
|
88
|
+
/nginx version: nginx\/(\d+\.\d+\.\d+)/
|
|
89
|
+
)
|
|
90
|
+
if (!nginxVersionMatch) {
|
|
91
|
+
throw new UnknownError(
|
|
92
|
+
`Unexpected error appeared during ssl terminator config creation\n\n${nginxVersionOutput}`
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const nginxVersion = nginxVersionMatch[1]
|
|
97
|
+
|
|
98
|
+
const isSSLDirectiveDeprecated = semver.satisfies(
|
|
99
|
+
nginxVersion,
|
|
100
|
+
'>=1.25.0'
|
|
101
|
+
)
|
|
102
|
+
|
|
78
103
|
try {
|
|
79
104
|
await setConfigFile({
|
|
80
105
|
configPathname: path.join(
|
|
@@ -90,7 +115,8 @@ const createSSLTerminatorConfig = () => ({
|
|
|
90
115
|
hostMachine,
|
|
91
116
|
hostPort,
|
|
92
117
|
config: overridenConfiguration,
|
|
93
|
-
debug
|
|
118
|
+
debug,
|
|
119
|
+
isSSLDirectiveDeprecated
|
|
94
120
|
}
|
|
95
121
|
})
|
|
96
122
|
} catch (e) {
|
|
@@ -3,6 +3,7 @@ const createNginxConfig = require('./create-nginx-config')
|
|
|
3
3
|
const createPhpConfig = require('./create-php-config')
|
|
4
4
|
const createPhpDebugConfig = require('./create-php-debug-config')
|
|
5
5
|
const createPhpFpmConfig = require('./create-php-fpm-config')
|
|
6
|
+
const createPhpFpmDebugConfig = require('./create-php-fpm-debug-config')
|
|
6
7
|
const createPhpStormConfig = require('./create-phpstorm-config')
|
|
7
8
|
const createSSLTerminatorConfig = require('./create-ssl-terminator-config')
|
|
8
9
|
const createVarnishConfig = require('./create-varnish-config')
|
|
@@ -19,6 +20,7 @@ const prepareFileSystem = () => ({
|
|
|
19
20
|
createSSLTerminatorConfig(),
|
|
20
21
|
createNginxConfig(),
|
|
21
22
|
createPhpFpmConfig(),
|
|
23
|
+
createPhpFpmDebugConfig(),
|
|
22
24
|
createPhpConfig(),
|
|
23
25
|
createPhpDebugConfig(),
|
|
24
26
|
createPhpStormConfig(),
|
|
@@ -55,7 +55,6 @@ const getIsHealthCheckRequestBroken = async (ctx) => {
|
|
|
55
55
|
const waitingForVarnish = () => ({
|
|
56
56
|
title: 'Waiting for Varnish to return code 200',
|
|
57
57
|
skip: (ctx) =>
|
|
58
|
-
ctx.debug ||
|
|
59
58
|
!ctx.config.overridenConfiguration.configuration.varnish.enabled ||
|
|
60
59
|
ctx.config.overridenConfiguration.ssl.enabled ||
|
|
61
60
|
!ctx.config.overridenConfiguration.configuration.varnish.healthCheck,
|
|
@@ -4,16 +4,16 @@ import { ExecAsyncSpawnOptions } from "../../util/exec-async-command";
|
|
|
4
4
|
export function runPHPContainerCommand<T>(
|
|
5
5
|
ctx: ListrContext,
|
|
6
6
|
command: string,
|
|
7
|
-
options?: ExecAsyncSpawnOptions<T>
|
|
7
|
+
options?: ExecAsyncSpawnOptions<T>
|
|
8
8
|
): Promise<any>
|
|
9
9
|
|
|
10
10
|
export function runPHPContainerCommandTask<T>(
|
|
11
11
|
command: string,
|
|
12
|
-
options?: ExecAsyncSpawnOptions<T>
|
|
12
|
+
options?: ExecAsyncSpawnOptions<T>
|
|
13
13
|
): import('listr2').ListrTask<import('../../../typings/context').ListrContext>
|
|
14
14
|
|
|
15
15
|
export function execPHPContainerCommand<T>(
|
|
16
16
|
ctx: ListrContext,
|
|
17
17
|
command: string,
|
|
18
|
-
options?: ExecAsyncSpawnOptions<T>
|
|
18
|
+
options?: ExecAsyncSpawnOptions<T>
|
|
19
19
|
): Promise<any>
|
|
@@ -25,11 +25,6 @@ const runPHPContainerCommand = async (ctx, command, options = {}) => {
|
|
|
25
25
|
detach: false,
|
|
26
26
|
rm: true
|
|
27
27
|
},
|
|
28
|
-
options.useXDebugContainer
|
|
29
|
-
? {
|
|
30
|
-
image: php.debugImage
|
|
31
|
-
}
|
|
32
|
-
: {},
|
|
33
28
|
{
|
|
34
29
|
command
|
|
35
30
|
}
|
|
@@ -70,23 +65,18 @@ const execPHPContainerCommand = async (ctx, command, options = {}) => {
|
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
return containerApi.exec(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
? {
|
|
79
|
-
env: options.env
|
|
80
|
-
}
|
|
81
|
-
: {}
|
|
82
|
-
),
|
|
68
|
+
{
|
|
69
|
+
container: php.name,
|
|
70
|
+
...deepmerge(php, options.env ? { env: options.env } : {}),
|
|
71
|
+
command
|
|
72
|
+
},
|
|
83
73
|
options
|
|
84
74
|
)
|
|
85
75
|
}
|
|
86
76
|
|
|
87
77
|
/**
|
|
88
78
|
* @param {string} command
|
|
89
|
-
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & {
|
|
79
|
+
* @param {import('../../util/exec-async-command').ExecAsyncSpawnOptions<false> & { title?: string }} [options]
|
|
90
80
|
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
91
81
|
*/
|
|
92
82
|
const execPHPContainerCommandTask = (command, options = {}) => ({
|
|
@@ -25,11 +25,10 @@ const updateEnvPHP = () => ({
|
|
|
25
25
|
? '127.0.0.1'
|
|
26
26
|
: 'host.docker.internal'
|
|
27
27
|
|
|
28
|
-
const useVarnish =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
: ''
|
|
28
|
+
const useVarnish = ctx.config.overridenConfiguration.configuration
|
|
29
|
+
.varnish.enabled
|
|
30
|
+
? '1'
|
|
31
|
+
: ''
|
|
33
32
|
const varnishHost = hostMachine
|
|
34
33
|
const varnishPort = ctx.ports.varnish
|
|
35
34
|
const previousVarnishPort = ctx.cachedPorts
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
const { setProjectConfig } = require('../../config/config')
|
|
2
1
|
const { setPrefix: setPrefixUtil } = require('../../util/prefix')
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -14,8 +13,6 @@ const setProjectConfigTask = () => ({
|
|
|
14
13
|
} = ctx
|
|
15
14
|
|
|
16
15
|
setPrefixUtil(prefix)
|
|
17
|
-
|
|
18
|
-
setProjectConfig('debug', ctx.debug)
|
|
19
16
|
},
|
|
20
17
|
options: {
|
|
21
18
|
showTimer: false
|
|
@@ -26,10 +26,10 @@ const checkElasticSearchVersion = () => ({
|
|
|
26
26
|
elasticSearchContainerRunning.length !== 0 &&
|
|
27
27
|
elasticSearchContainerRunning[0].State === 'running'
|
|
28
28
|
) {
|
|
29
|
-
elasticSearchVersionResponse = await containerApi.exec(
|
|
30
|
-
'elasticsearch --version',
|
|
31
|
-
elasticSearchContainer.name
|
|
32
|
-
)
|
|
29
|
+
elasticSearchVersionResponse = await containerApi.exec({
|
|
30
|
+
command: 'elasticsearch --version',
|
|
31
|
+
container: elasticSearchContainer.name
|
|
32
|
+
})
|
|
33
33
|
} else {
|
|
34
34
|
try {
|
|
35
35
|
const availableElasticSearchPort = await getPort(
|
|
@@ -25,10 +25,10 @@ const checkOpenSearchVersion = () => ({
|
|
|
25
25
|
openSearchContainerRunning.length !== 0 &&
|
|
26
26
|
openSearchContainerRunning[0].State === 'running'
|
|
27
27
|
) {
|
|
28
|
-
openSearchVersionResponse = await containerApi.exec(
|
|
29
|
-
'opensearch --version',
|
|
30
|
-
openSearchContainer.name
|
|
31
|
-
)
|
|
28
|
+
openSearchVersionResponse = await containerApi.exec({
|
|
29
|
+
command: 'opensearch --version',
|
|
30
|
+
container: openSearchContainer.name
|
|
31
|
+
})
|
|
32
32
|
} else {
|
|
33
33
|
try {
|
|
34
34
|
const availableOpenSearchPort = await getPort(
|
package/lib/tasks/start.js
CHANGED
|
@@ -15,10 +15,7 @@ const { installMagentoProject, setupMagento } = require('./magento')
|
|
|
15
15
|
const { pullImages, stopContainers } = require('./docker/containers')
|
|
16
16
|
const dockerNetwork = require('./docker/network')
|
|
17
17
|
const { connectToDatabase } = require('./database')
|
|
18
|
-
const {
|
|
19
|
-
buildProjectImage,
|
|
20
|
-
buildDebugProjectImage
|
|
21
|
-
} = require('./docker/project-image-builder')
|
|
18
|
+
const { buildProjectImage } = require('./docker/project-image-builder')
|
|
22
19
|
const getProjectConfiguration = require('../config/get-project-configuration')
|
|
23
20
|
const { getSystemConfigTask } = require('../config/system-config')
|
|
24
21
|
const setupThemes = require('./theme/setup-themes')
|
|
@@ -141,15 +138,7 @@ const configureProject = () => ({
|
|
|
141
138
|
}
|
|
142
139
|
)
|
|
143
140
|
},
|
|
144
|
-
|
|
145
|
-
task: (ctx, subTask) =>
|
|
146
|
-
subTask.newListr(
|
|
147
|
-
[buildProjectImage(), buildDebugProjectImage()],
|
|
148
|
-
{
|
|
149
|
-
concurrent: true
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
},
|
|
141
|
+
buildProjectImage(),
|
|
153
142
|
getComposerVersionTask(),
|
|
154
143
|
prepareFileSystem(),
|
|
155
144
|
volumes.createVolumes(),
|