@scandipwa/magento-scripts 2.4.0-alpha.0 → 2.4.0-alpha.2

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.
Files changed (100) hide show
  1. package/exec.js +2 -2
  2. package/index.js +1 -0
  3. package/lib/commands/cli.js +17 -19
  4. package/lib/commands/execute.js +8 -4
  5. package/lib/commands/start.js +0 -6
  6. package/lib/config/docker.js +196 -79
  7. package/lib/config/get-project-configuration.js +0 -5
  8. package/lib/config/php-config.js +4 -0
  9. package/lib/config/port-config.js +47 -10
  10. package/lib/config/services/composer/versions/composer-2.8.js +1 -1
  11. package/lib/config/services/elasticsearch/default-es-env.js +1 -1
  12. package/lib/config/services/elasticsearch/versions/elasticsearch-8.17.js +14 -0
  13. package/lib/config/services/elasticsearch/versions/index.js +3 -1
  14. package/lib/config/services/mariadb/versions/index.js +3 -1
  15. package/lib/config/services/mariadb/versions/mariadb-10.2.js +3 -1
  16. package/lib/config/services/mariadb/versions/mariadb-10.3.js +3 -1
  17. package/lib/config/services/mariadb/versions/mariadb-10.4.js +3 -1
  18. package/lib/config/services/mariadb/versions/mariadb-10.6.js +3 -1
  19. package/lib/config/services/mariadb/versions/mariadb-11.4.js +11 -0
  20. package/lib/config/services/mariadb/versions/mariadb-11.6.js +11 -0
  21. package/lib/config/services/opensearch/default-os-env.js +1 -1
  22. package/lib/config/services/opensearch/versions/index.js +3 -1
  23. package/lib/config/services/opensearch/versions/opensearch-2.19.js +14 -0
  24. package/lib/config/services/php/extensions/ftp.js +7 -0
  25. package/lib/config/services/php/extensions/xdebug.js +1 -0
  26. package/lib/config/services/php/versions/index.js +2 -1
  27. package/lib/config/services/php/versions/php-7.2.js +0 -1
  28. package/lib/config/services/php/versions/php-7.3.js +0 -1
  29. package/lib/config/services/php/versions/php-7.4.js +0 -1
  30. package/lib/config/services/php/versions/php-8.1.js +4 -2
  31. package/lib/config/services/php/versions/php-8.2.js +1 -2
  32. package/lib/config/services/php/versions/php-8.3.js +32 -0
  33. package/lib/config/services/redis/index.js +6 -1
  34. package/lib/config/services/redis/valkey-8.0.js +8 -0
  35. package/lib/config/services/redis/valkey-8.1.js +8 -0
  36. package/lib/config/services/varnish/varnish-6-0.js +1 -1
  37. package/lib/config/services/varnish/varnish-6-6.js +1 -1
  38. package/lib/config/services/varnish/varnish-7-0.js +1 -1
  39. package/lib/config/services/varnish/varnish-7-1.js +1 -1
  40. package/lib/config/services/varnish/varnish-7-3.js +1 -1
  41. package/lib/config/services/varnish/varnish-7-4.js +1 -1
  42. package/lib/config/services/varnish/varnish-7-5.js +1 -1
  43. package/lib/config/services/varnish/varnish-7-6.js +1 -1
  44. package/lib/config/templates/nginx.template.conf +32 -9
  45. package/lib/config/templates/php-fpm.template.conf +1 -1
  46. package/lib/config/templates/ssl-terminator.template.conf +3 -1
  47. package/lib/config/versions/magento-2.4.4-p13.js +40 -0
  48. package/lib/config/versions/magento-2.4.5-p12.js +40 -0
  49. package/lib/config/versions/magento-2.4.6-p10.js +40 -0
  50. package/lib/config/versions/magento-2.4.7-p4.js +0 -1
  51. package/lib/config/versions/magento-2.4.7-p5.js +41 -0
  52. package/lib/config/versions/magento-2.4.8.js +43 -0
  53. package/lib/tasks/database/create-magento-database.js +6 -4
  54. package/lib/tasks/database/import-remote-db/ssh/index.js +1 -1
  55. package/lib/tasks/database/import-remote-db/ssh/readymage.js +1 -1
  56. package/lib/tasks/database/import-remote-db/ssh/regular-server.js +1 -1
  57. package/lib/tasks/docker/containers/container-api.d.ts +14 -3
  58. package/lib/tasks/docker/containers/container-api.js +16 -9
  59. package/lib/tasks/docker/containers/tasks.js +99 -28
  60. package/lib/tasks/docker/convert-mysql-to-mariadb.js +14 -22
  61. package/lib/tasks/docker/project-image-builder.js +153 -91
  62. package/lib/tasks/docker/system/system-api.d.ts +66 -0
  63. package/lib/tasks/docker/system/system-api.js +28 -1
  64. package/lib/tasks/execute.js +10 -10
  65. package/lib/tasks/file-system/create-nginx-config.js +22 -8
  66. package/lib/tasks/file-system/create-php-debug-config.js +1 -2
  67. package/lib/tasks/file-system/create-php-fpm-debug-config.js +33 -0
  68. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +5 -5
  69. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +2 -2
  70. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +4 -3
  71. package/lib/tasks/file-system/create-ssl-terminator-config.js +46 -7
  72. package/lib/tasks/file-system/index.js +2 -0
  73. package/lib/tasks/magento/install-magento-project.js +40 -24
  74. package/lib/tasks/magento/setup-magento/check-file-permissions.php +32 -0
  75. package/lib/tasks/magento/setup-magento/index.js +2 -0
  76. package/lib/tasks/magento/setup-magento/make-magento-binaries-executable.js +44 -0
  77. package/lib/tasks/magento/setup-magento/setup-file-permissions.js +160 -0
  78. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +0 -1
  79. package/lib/tasks/php/php-container.d.ts +3 -3
  80. package/lib/tasks/php/php-container.js +22 -18
  81. package/lib/tasks/php/update-env-php.js +7 -14
  82. package/lib/tasks/project-config/index.js +0 -3
  83. package/lib/tasks/requirements/cgroup-version.js +69 -0
  84. package/lib/tasks/requirements/elasticsearch-version.js +23 -7
  85. package/lib/tasks/requirements/index.js +3 -0
  86. package/lib/tasks/requirements/opensearch-version.js +5 -5
  87. package/lib/tasks/requirements/searchengine-version.js +1 -2
  88. package/lib/tasks/start.js +2 -13
  89. package/lib/util/dockerfile-builder/build-instructions.js +5 -1
  90. package/lib/util/dockerfile-builder/types.d.ts +1 -1
  91. package/lib/util/execute-in-container.js +14 -8
  92. package/lib/util/get-installed-magento-version.js +60 -2
  93. package/lib/util/portscanner.js +3 -3
  94. package/lib/util/run-composer.js +1 -1
  95. package/lib/util/run-magento.js +2 -1
  96. package/lib/util/run-php.js +2 -1
  97. package/lib/util/set-config.js +4 -2
  98. package/package.json +16 -16
  99. package/typings/context.d.ts +13 -5
  100. package/typings/index.d.ts +10 -5
package/exec.js CHANGED
@@ -98,10 +98,10 @@ const newVersionIsAPatch = (latestVersion, currentVersion) => {
98
98
  logger.log() // add empty line
99
99
  }
100
100
 
101
- const [containername, ...commands] = process.argv.slice(2)
101
+ const [containerName, ...commands] = process.argv.slice(2)
102
102
 
103
103
  return executeTask({
104
- containername,
104
+ containerName,
105
105
  commands
106
106
  })
107
107
  })()
package/index.js CHANGED
@@ -121,6 +121,7 @@ const newVersionIsAPatch = (latestVersion, currentVersion) => {
121
121
  }
122
122
 
123
123
  yargs.scriptName('magento-scripts')
124
+ yargs.version(false)
124
125
 
125
126
  // Initialize program commands
126
127
  commands.forEach((command) => command(yargs))
@@ -98,7 +98,7 @@ module.exports = (yargs) => {
98
98
 
99
99
  block
100
100
  .addLine(
101
- `Clear Magento cache: ${logger.style.command('m c:c')}`
101
+ `Clear Magento cache: ${logger.style.command('m c:f')}`
102
102
  )
103
103
  .addLine(
104
104
  `Magento setup upgrade: ${logger.style.command('m se:up')}`
@@ -127,24 +127,22 @@ module.exports = (yargs) => {
127
127
  )
128
128
  .addEmptyLine()
129
129
 
130
- if (ctx.debug) {
131
- block
132
- .addLine('Debug PHP in CLI:')
133
- .addLine('1. Start debugger in VSCode or PHPStorm')
134
- .addLine(
135
- `2. Go to PHP container: ${logger.style.command(
136
- 'exec php'
137
- )}`
138
- )
139
- .addLine(
140
- `3. Run CLI command with ${logger.style.code(
141
- 'XDEBUG_SESSION=phpstorm'
142
- )} environmental variable: ${logger.style.command(
143
- 'XDEBUG_SESSION=phpstorm magento <command>'
144
- )}`
145
- )
146
- .addLine('4. Enjoy')
147
- }
130
+ block
131
+ .addLine('Debug PHP in CLI:')
132
+ .addLine('1. Start debugger in VSCode or PHPStorm')
133
+ .addLine(
134
+ `2. Go to PHP container: ${logger.style.command(
135
+ 'exec phpWithDebug'
136
+ )}`
137
+ )
138
+ .addLine(
139
+ `3. Run CLI command with ${logger.style.code(
140
+ 'XDEBUG_SESSION=PHPSTORM'
141
+ )} environmental variable: ${logger.style.command(
142
+ 'XDEBUG_SESSION=PHPSTORM magento <command>'
143
+ )}`
144
+ )
145
+ .addLine('4. Enjoy')
148
146
 
149
147
  block.log()
150
148
 
@@ -5,10 +5,10 @@ const { executeTask } = require('../tasks/execute')
5
5
  */
6
6
  module.exports = (yargs) => {
7
7
  yargs.command(
8
- 'exec <container name> [commands...]',
8
+ 'exec <container name> [command...]',
9
9
  'Execute command in docker container',
10
10
  (yargs) => {
11
- yargs.usage(`Usage: npm run exec <container name> [commands...]
11
+ yargs.usage(`Usage: npm run exec <container name> [command...]
12
12
 
13
13
  Available containers:
14
14
  - mariadb
@@ -18,8 +18,12 @@ Available containers:
18
18
  - varnish (if enabled)
19
19
  - sslTerminator`)
20
20
  },
21
- async (argv) => {
22
- await executeTask(argv)
21
+ async () => {
22
+ const [containerName, ...commands] = process.argv.slice(3)
23
+ await executeTask({
24
+ containerName,
25
+ commands
26
+ })
23
27
  }
24
28
  )
25
29
  }
@@ -70,12 +70,6 @@ module.exports = (yargs) => {
70
70
  type: 'boolean',
71
71
  default: false
72
72
  })
73
- .option('debug', {
74
- alias: 'd',
75
- describe: 'Enable PHP xdebug.',
76
- type: 'boolean',
77
- default: false
78
- })
79
73
  .option('skip-setup', {
80
74
  alias: 's',
81
75
  describe: 'Skip Magento setup',
@@ -10,6 +10,27 @@ const logger = require('@scandipwa/scandipwa-dev-utils/logger')
10
10
  const defaultMagentoUser = require('../tasks/database/default-magento-user')
11
11
  const defaultOsEnv = require('./services/opensearch/default-os-env')
12
12
 
13
+ /**
14
+ * @param {Partial<Record<'rw' | 'ro' | 'cached', boolean>>} directives
15
+ */
16
+ const volumeDirectives = (directives) => {
17
+ const directivesResult = Object.entries(directives)
18
+ .filter(([name, value]) => value === true)
19
+ .map(([name]) => name)
20
+ .join(',')
21
+
22
+ return directivesResult ? `:${directivesResult}` : ''
23
+ }
24
+
25
+ /**
26
+ * @param {{source: string, target: string, rw?: boolean, ro?: boolean, cached?: boolean}} options
27
+ */
28
+ const containerVolume = (options) => {
29
+ const { source, target, ...directives } = options
30
+
31
+ return `${source}:${target}${volumeDirectives(directives)}`
32
+ }
33
+
13
34
  /**
14
35
  * @param {import('../../typings/context').ListrContext} ctx
15
36
  * @param {import('../../typings/context').ListrContext['config']['overridenConfiguration']} overridenConfiguration
@@ -68,6 +89,17 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
68
89
 
69
90
  const { isDockerDesktop } = ctx
70
91
 
92
+ if (isDockerDesktop) {
93
+ volumes.php = {
94
+ name: `${prefix}_project-data`,
95
+ driver: 'local',
96
+ opt: {
97
+ type: 'none',
98
+ device: path.join(magentoDir),
99
+ o: 'bind'
100
+ }
101
+ }
102
+ }
71
103
  /**
72
104
  * @param {Record<string, number>} ports
73
105
  */
@@ -83,7 +115,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
83
115
  : {}
84
116
 
85
117
  /**
86
- * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], debugImage?: string, remoteImages?: string[], connectCommand?: string[], description?: string }>}
118
+ * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], remoteImages?: string[], connectCommand?: string[], description?: string, pullImage?: boolean, dependsOn?: string[] }>}
87
119
  */
88
120
  const dockerConfig = {
89
121
  php: {
@@ -102,39 +134,96 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
102
134
  ],
103
135
  network: isDockerDesktop ? network.name : 'host',
104
136
  mountVolumes: [
105
- `${magentoDir}:${containerMagentoDir}${
106
- isDockerDesktop ? ':cached' : ''
107
- }`,
108
- `${volumes.composer_cache.name}:/composer/home/cache`,
109
- `${php.iniPath}:/usr/local/etc/php/php.ini${
110
- isDockerDesktop ? ':cached' : ''
111
- }`,
112
- `${
113
- php.fpmConfPath
114
- }:/usr/local/etc/php-fpm.d/zz-docker.conf${
115
- isDockerDesktop ? ':cached' : ''
116
- }`
117
- ].concat(
118
- ctx.debug
119
- ? [
120
- `${
121
- php.debugIniPath
122
- }:/usr/local/etc/php/conf.d/00-xdebug.ini${
123
- isDockerDesktop ? ':cached' : ''
124
- }`
125
- ]
126
- : []
127
- ),
137
+ containerVolume({
138
+ source: isDockerDesktop ? volumes.php.name : magentoDir,
139
+ target: containerMagentoDir,
140
+ rw: true,
141
+ cached: isDockerDesktop
142
+ }),
143
+ containerVolume({
144
+ source: volumes.composer_cache.name,
145
+ target: '/composer/home/cache',
146
+ rw: true
147
+ }),
148
+ containerVolume({
149
+ source: php.iniPath,
150
+ target: '/usr/local/etc/php/php.ini',
151
+ ro: true,
152
+ cached: isDockerDesktop
153
+ }),
154
+ containerVolume({
155
+ source: php.fpmConfPath,
156
+ target: '/usr/local/etc/php-fpm.d/zz-docker.conf',
157
+ ro: true,
158
+ cached: isDockerDesktop
159
+ })
160
+ ],
128
161
  env: deepmerge(composerAuthEnv, php.env || {}),
129
162
  restart: 'on-failure:5',
130
163
  image: `local-cma-project:${prefix}`,
131
- debugImage: `local-cma-project:${prefix}.debug`,
132
- remoteImages: [
133
- configuration.php.baseImage,
134
- configuration.php.debugImage
135
- ],
164
+ remoteImages: [configuration.php.baseImage],
136
165
  name: `${prefix}_php`,
137
166
  connectCommand: ['/bin/sh'],
167
+ dependsOn: ['mariadb', 'redis', 'elasticsearch'],
168
+ user:
169
+ (ctx.platform === 'linux' && isDockerDesktop) ||
170
+ !isDockerDesktop
171
+ ? `${os.userInfo().uid}:${os.userInfo().gid}`
172
+ : ''
173
+ },
174
+ phpWithXdebug: {
175
+ _: 'PHP with Xdebug',
176
+ ports: isDockerDesktop
177
+ ? [
178
+ `${isIpAddress(host) ? host : '127.0.0.1'}:${
179
+ ports.fpmXdebug
180
+ }:9000`
181
+ ]
182
+ : [],
183
+ forwardedPorts: [
184
+ isDockerDesktop
185
+ ? `127.0.0.1:${ports.fpmXdebug}:9000`
186
+ : `127.0.0.1:${ports.fpmXdebug}`
187
+ ],
188
+ network: isDockerDesktop ? network.name : 'host',
189
+ mountVolumes: [
190
+ containerVolume({
191
+ source: isDockerDesktop ? volumes.php.name : magentoDir,
192
+ target: containerMagentoDir,
193
+ rw: true,
194
+ cached: isDockerDesktop
195
+ }),
196
+ containerVolume({
197
+ source: volumes.composer_cache.name,
198
+ target: '/composer/home/cache',
199
+ rw: true
200
+ }),
201
+ containerVolume({
202
+ source: php.iniPath,
203
+ target: '/usr/local/etc/php/php.ini',
204
+ ro: true,
205
+ cached: isDockerDesktop
206
+ }),
207
+ containerVolume({
208
+ source: php.debugFpmConfPath,
209
+ target: '/usr/local/etc/php-fpm.d/zz-docker.conf',
210
+ ro: true,
211
+ cached: isDockerDesktop
212
+ }),
213
+ containerVolume({
214
+ source: php.debugIniPath,
215
+ target: '/usr/local/etc/php/conf.d/00-xdebug.ini',
216
+ ro: true,
217
+ cached: isDockerDesktop
218
+ })
219
+ ],
220
+ env: deepmerge(composerAuthEnv, php.env || {}),
221
+ restart: 'on-failure:5',
222
+ image: `local-cma-project:${prefix}.debug`,
223
+ pullImage: false,
224
+ name: `${prefix}_php_with_xdebug`,
225
+ connectCommand: ['/bin/sh'],
226
+ dependsOn: ['mariadb', 'redis', 'elasticsearch'],
138
227
  user:
139
228
  (ctx.platform === 'linux' && isDockerDesktop) ||
140
229
  !isDockerDesktop
@@ -158,22 +247,23 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
158
247
  healthCheck: {
159
248
  cmd: 'service nginx status'
160
249
  },
161
- /**
162
- * Mount volumes directly on linux
163
- */
164
250
  mountVolumes: [
165
- `${path.join(
166
- cacheDir,
167
- 'ssl-terminator',
168
- 'conf.d'
169
- )}:/etc/nginx/conf.d${isDockerDesktop ? ':cached' : ''}`,
170
- `${path.join(
171
- cacheDir,
172
- 'ssl-terminator',
173
- 'fastcgi_params'
174
- )}:/etc/nginx/fastcgi_params${
175
- isDockerDesktop ? ':cached' : ''
176
- }`
251
+ containerVolume({
252
+ source: path.join(cacheDir, 'ssl-terminator', 'conf.d'),
253
+ target: '/etc/nginx/conf.d',
254
+ ro: true,
255
+ cached: isDockerDesktop
256
+ }),
257
+ containerVolume({
258
+ source: path.join(
259
+ cacheDir,
260
+ 'ssl-terminator',
261
+ 'fastcgi_params'
262
+ ),
263
+ target: '/etc/nginx/fastcgi_params',
264
+ ro: true,
265
+ cached: isDockerDesktop
266
+ })
177
267
  ],
178
268
  restart: 'on-failure:5',
179
269
  network: isDockerDesktop ? network.name : 'host',
@@ -181,7 +271,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
181
271
  nginx.version ? `nginx:${nginx.version}` : nginx.image
182
272
  }`,
183
273
  name: `${prefix}_ssl-terminator`,
184
- command: "nginx -g 'daemon off;'"
274
+ command: "nginx -g 'daemon off;'",
275
+ dependsOn: ['nginx']
185
276
  },
186
277
  nginx: {
187
278
  _: 'Nginx',
@@ -200,25 +291,29 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
200
291
  healthCheck: {
201
292
  cmd: 'service nginx status'
202
293
  },
203
- /**
204
- * Mount volumes directly on linux
205
- */
206
294
  mountVolumes: [
207
- `${path.join(
208
- cacheDir,
209
- 'nginx',
210
- 'conf.d'
211
- )}:/etc/nginx/conf.d${isDockerDesktop ? ':cached' : ''}`,
212
- `${magentoDir}:${containerMagentoDir}${
213
- isDockerDesktop ? ':cached' : ''
214
- }`,
215
- `${path.join(
216
- cacheDir,
217
- 'ssl-terminator',
218
- 'fastcgi_params'
219
- )}:/etc/nginx/fastcgi_params${
220
- isDockerDesktop ? ':cached' : ''
221
- }`
295
+ containerVolume({
296
+ source: path.join(cacheDir, 'nginx', 'conf.d'),
297
+ target: '/etc/nginx/conf.d',
298
+ ro: true,
299
+ cached: isDockerDesktop
300
+ }),
301
+ containerVolume({
302
+ source: isDockerDesktop ? volumes.php.name : magentoDir,
303
+ target: containerMagentoDir,
304
+ rw: true,
305
+ cached: isDockerDesktop
306
+ }),
307
+ containerVolume({
308
+ source: path.join(
309
+ cacheDir,
310
+ 'ssl-terminator',
311
+ 'fastcgi_params'
312
+ ),
313
+ target: '/etc/nginx/fastcgi_params',
314
+ ro: true,
315
+ cached: isDockerDesktop
316
+ })
222
317
  ],
223
318
  restart: 'on-failure:5',
224
319
  network: isDockerDesktop ? network.name : 'host',
@@ -226,7 +321,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
226
321
  nginx.version ? `nginx:${nginx.version}` : nginx.image
227
322
  }`,
228
323
  name: `${prefix}_nginx`,
229
- command: "nginx -g 'daemon off;'"
324
+ command: "nginx -g 'daemon off;'",
325
+ dependsOn: ['php', 'phpWithXdebug']
230
326
  },
231
327
  redis: {
232
328
  _: 'Redis',
@@ -246,16 +342,21 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
246
342
  mariadb: {
247
343
  _: 'MariaDB',
248
344
  healthCheck: {
249
- cmd: 'mysqladmin ping --silent'
345
+ cmd: `${mariadb.binAdminFileName} ping --silent`
250
346
  },
251
347
  ports: [`127.0.0.1:${ports.mariadb}:3306`],
252
348
  forwardedPorts: [`127.0.0.1:${ports.mariadb}:3306`],
253
349
  mountVolumes: [
254
- `${volumes.mariadb.name}:/var/lib/mysql`,
255
- `${path.join(
256
- baseConfig.cacheDir,
257
- 'mariadb.cnf'
258
- )}:/etc/mysql/my.cnf${isDockerDesktop ? ':cached' : ''}`
350
+ containerVolume({
351
+ source: volumes.mariadb.name,
352
+ target: '/var/lib/mysql'
353
+ }),
354
+ containerVolume({
355
+ source: path.join(baseConfig.cacheDir, 'mariadb.cnf'),
356
+ target: '/etc/mysql/my.cnf',
357
+ ro: true,
358
+ cached: isDockerDesktop
359
+ })
259
360
  ],
260
361
  env: {
261
362
  MARIADB_ROOT_PASSWORD: 'scandipwa'
@@ -289,10 +390,16 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
289
390
  },
290
391
  ports: [`127.0.0.1:${ports.elasticsearch}:9200`],
291
392
  forwardedPorts: [`127.0.0.1:${ports.elasticsearch}:9200`],
292
- mounts: [
393
+ mountVolumes: [
293
394
  searchengine === 'elasticsearch'
294
- ? `source=${volumes.elasticsearch.name},target=/usr/share/elasticsearch/data`
295
- : `source=${volumes.opensearch.name},target=/usr/share/opensearch/data`
395
+ ? containerVolume({
396
+ source: volumes.elasticsearch.name,
397
+ target: '/usr/share/elasticsearch/data'
398
+ })
399
+ : containerVolume({
400
+ source: volumes.opensearch.name,
401
+ target: '/usr/share/opensearch/data'
402
+ })
296
403
  ],
297
404
  env:
298
405
  searchengine === 'elasticsearch'
@@ -335,7 +442,12 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
335
442
  `127.0.0.1:${ports.maildevWeb}`,
336
443
  `127.0.0.1:${ports.maildevSMTP}`
337
444
  ],
338
- mountVolumes: [`${volumes.maildev.name}:/tmp/maildev`],
445
+ mountVolumes: [
446
+ containerVolume({
447
+ source: volumes.maildev.name,
448
+ target: '/tmp/maildev'
449
+ })
450
+ ],
339
451
  env: {
340
452
  MAILDEV_SMTP_PORT: isDockerDesktop
341
453
  ? '1025'
@@ -366,7 +478,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
366
478
  )
367
479
  }
368
480
 
369
- if (!ctx.debug && varnish.enabled) {
481
+ if (varnish.enabled) {
370
482
  dockerConfig.varnish = {
371
483
  _: 'Varnish',
372
484
  image: `${
@@ -376,9 +488,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
376
488
  }`,
377
489
  name: `${prefix}_varnish`,
378
490
  mountVolumes: [
379
- `${path.join(cacheDir, 'varnish')}:/etc/varnish${
380
- isDockerDesktop ? ':cached' : ''
381
- }`
491
+ containerVolume({
492
+ source: path.join(cacheDir, 'varnish'),
493
+ target: '/etc/varnish',
494
+ ro: true
495
+ })
382
496
  ],
383
497
  ports: isDockerDesktop
384
498
  ? [
@@ -404,8 +518,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
404
518
  tmpfs: ['/var/lib/varnish/varnishd:exec'],
405
519
  description: `Varnish HealthCheck status: ${logger.style.command(
406
520
  varnish.healthCheck ? 'enabled' : 'disabled'
407
- )}`
521
+ )}`,
522
+ dependsOn: ['nginx']
408
523
  }
524
+
525
+ dockerConfig.sslTerminator.dependsOn.push('varnish')
409
526
  }
410
527
 
411
528
  if (newRelic.enabled) {
@@ -1,4 +1,3 @@
1
- const { getProjectConfig } = require('./config')
2
1
  const { getConfigFromMagentoVersion } = require('./index')
3
2
 
4
3
  /**
@@ -9,10 +8,6 @@ const getProjectConfiguration = () => ({
9
8
  task: async (ctx) => {
10
9
  const { magentoVersion } = ctx
11
10
 
12
- if (typeof ctx.debug !== 'boolean') {
13
- ctx.debug = getProjectConfig().debug
14
- }
15
-
16
11
  ctx.config = await getConfigFromMagentoVersion(ctx, {
17
12
  magentoVersion
18
13
  })
@@ -11,6 +11,9 @@ module.exports = (overridenConfiguration, baseConfig) => {
11
11
 
12
12
  const { cacheDir } = baseConfig
13
13
 
14
+ /**
15
+ * @type {import('../../typings/context').ListrContext['config']['php']}
16
+ */
14
17
  const phpConfiguration = {
15
18
  iniPath: path.join(cacheDir, 'php.ini'),
16
19
  iniTemplatePath: php.configTemplate,
@@ -18,6 +21,7 @@ module.exports = (overridenConfiguration, baseConfig) => {
18
21
  debugTemplatePath: php.debugTemplate,
19
22
  fpmTemplatePath: php.fpmConfigTemplate,
20
23
  fpmConfPath: path.join(cacheDir, 'php-fpm.conf'),
24
+ debugFpmConfPath: path.join(cacheDir, 'php-fpm-debug.conf'),
21
25
  extensions: php.extensions,
22
26
  env: php.env
23
27
  }
@@ -72,6 +72,7 @@ const defaultPorts = {
72
72
  varnish: 8080,
73
73
  sslTerminator: 80,
74
74
  fpm: 9000,
75
+ fpmXdebug: 9001,
75
76
  mariadb: 3306,
76
77
  redis: 6379,
77
78
  elasticsearch: 9200,
@@ -97,18 +98,54 @@ const getPortsConfig = async (ports, options = {}) => {
97
98
  if (useNonOverlappingPorts) {
98
99
  p = p.concat(await getUsedByOtherCMAProjectsPorts())
99
100
  }
100
- const availablePorts = Object.fromEntries(
101
- await Promise.all(
102
- Object.entries(mergedPorts).map(async ([name, port]) => {
103
- const availablePort = await getPort(port, {
104
- portIgnoreList: p
105
- })
106
-
107
- return [name, availablePort]
108
- })
109
- )
101
+
102
+ /**
103
+ * @type {Record<string, string>}
104
+ */
105
+ const portsToCheck = Object.entries(mergedPorts).reduce(
106
+ (acc, [name, port]) => {
107
+ if (acc[port]) {
108
+ let i = 0
109
+ while (acc[port + i]) {
110
+ i++
111
+ }
112
+
113
+ return {
114
+ ...acc,
115
+ [port + i]: name
116
+ }
117
+ } else {
118
+ return {
119
+ ...acc,
120
+ [port]: name
121
+ }
122
+ }
123
+ },
124
+ {}
110
125
  )
111
126
 
127
+ /**
128
+ * @type {Record<string, number>}
129
+ */
130
+ const availablePorts = {}
131
+
132
+ for (const [port, name] of Object.entries(portsToCheck)) {
133
+ const portInt = Number.parseInt(port)
134
+ const portIgnoreList = p.concat(
135
+ Object.keys(availablePorts).map((item) => Number.parseInt(item))
136
+ )
137
+
138
+ const getPortResult = await getPort(portInt, {
139
+ portIgnoreList
140
+ })
141
+
142
+ if (typeof getPortResult === 'number') {
143
+ availablePorts[name] = getPortResult
144
+ } else {
145
+ throw new Error(`No available port found for ${name} (${portInt})`)
146
+ }
147
+ }
148
+
112
149
  return availablePorts
113
150
  }
114
151
 
@@ -2,7 +2,7 @@
2
2
  * @returns {import('../../../../../typings/index').ComposerConfiguration}
3
3
  */
4
4
  const composer28 = () => ({
5
- version: '2.8.5'
5
+ version: '2.8.8'
6
6
  })
7
7
 
8
8
  module.exports = composer28
@@ -5,5 +5,5 @@ module.exports = {
5
5
  'bootstrap.memory_lock': true,
6
6
  'xpack.security.enabled': false,
7
7
  'discovery.type': 'single-node',
8
- ES_JAVA_OPTS: '-Xms512m -Xmx512m'
8
+ ES_JAVA_OPTS: '-Xms2g -Xmx2g'
9
9
  }
@@ -0,0 +1,14 @@
1
+ const defaultEnv = require('../default-es-env')
2
+
3
+ /**
4
+ * @returns {import('../../../../../typings/index').ElasticSearchConfiguration}
5
+ */
6
+ const elasticsearch817 = () => ({
7
+ image: 'elasticsearch:8.17.4',
8
+ env: {
9
+ ...defaultEnv,
10
+ 'indices.id_field_data.enabled': true
11
+ }
12
+ })
13
+
14
+ module.exports = elasticsearch817
@@ -11,6 +11,7 @@ const elasticsearch85 = require('./elasticsearch-8.5')
11
11
  const elasticsearch87 = require('./elasticsearch-8.7')
12
12
  const elasticsearch811 = require('./elasticsearch-8.11')
13
13
  const elasticsearch816 = require('./elasticsearch-8.16')
14
+ const elasticsearch817 = require('./elasticsearch-8.17')
14
15
 
15
16
  module.exports = {
16
17
  elasticsearch68,
@@ -25,5 +26,6 @@ module.exports = {
25
26
  elasticsearch85,
26
27
  elasticsearch87,
27
28
  elasticsearch811,
28
- elasticsearch816
29
+ elasticsearch816,
30
+ elasticsearch817
29
31
  }
@@ -2,5 +2,7 @@ module.exports = {
2
2
  mariadb102: require('./mariadb-10.2'),
3
3
  mariadb103: require('./mariadb-10.3'),
4
4
  mariadb104: require('./mariadb-10.4'),
5
- mariadb106: require('./mariadb-10.6')
5
+ mariadb106: require('./mariadb-10.6'),
6
+ mariadb114: require('./mariadb-11.4'),
7
+ mariadb116: require('./mariadb-11.6')
6
8
  }