@scandipwa/magento-scripts 2.4.0-alpha.1 → 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 (51) hide show
  1. package/lib/config/docker.js +164 -56
  2. package/lib/config/port-config.js +46 -10
  3. package/lib/config/services/elasticsearch/default-es-env.js +1 -1
  4. package/lib/config/services/mariadb/versions/mariadb-10.2.js +3 -1
  5. package/lib/config/services/mariadb/versions/mariadb-10.3.js +3 -1
  6. package/lib/config/services/mariadb/versions/mariadb-10.4.js +3 -1
  7. package/lib/config/services/mariadb/versions/mariadb-10.6.js +3 -1
  8. package/lib/config/services/mariadb/versions/mariadb-11.4.js +3 -1
  9. package/lib/config/services/mariadb/versions/mariadb-11.6.js +3 -1
  10. package/lib/config/services/opensearch/default-os-env.js +1 -1
  11. package/lib/config/services/php/extensions/xdebug.js +1 -0
  12. package/lib/config/templates/nginx.template.conf +2 -2
  13. package/lib/config/templates/php-fpm.template.conf +1 -1
  14. package/lib/config/templates/ssl-terminator.template.conf +1 -1
  15. package/lib/tasks/database/create-magento-database.js +2 -1
  16. package/lib/tasks/database/import-remote-db/ssh/index.js +1 -1
  17. package/lib/tasks/database/import-remote-db/ssh/readymage.js +1 -1
  18. package/lib/tasks/database/import-remote-db/ssh/regular-server.js +1 -1
  19. package/lib/tasks/docker/containers/container-api.d.ts +5 -0
  20. package/lib/tasks/docker/containers/container-api.js +3 -1
  21. package/lib/tasks/docker/containers/tasks.js +86 -21
  22. package/lib/tasks/docker/project-image-builder.js +55 -45
  23. package/lib/tasks/docker/system/system-api.d.ts +66 -0
  24. package/lib/tasks/docker/system/system-api.js +28 -1
  25. package/lib/tasks/execute.js +1 -1
  26. package/lib/tasks/file-system/create-nginx-config.js +22 -8
  27. package/lib/tasks/file-system/create-ssl-terminator-config.js +20 -7
  28. package/lib/tasks/magento/install-magento-project.js +40 -24
  29. package/lib/tasks/magento/setup-magento/check-file-permissions.php +32 -0
  30. package/lib/tasks/magento/setup-magento/index.js +2 -0
  31. package/lib/tasks/magento/setup-magento/make-magento-binaries-executable.js +44 -0
  32. package/lib/tasks/magento/setup-magento/setup-file-permissions.js +160 -0
  33. package/lib/tasks/php/php-container.js +20 -6
  34. package/lib/tasks/php/update-env-php.js +3 -9
  35. package/lib/tasks/requirements/cgroup-version.js +69 -0
  36. package/lib/tasks/requirements/elasticsearch-version.js +19 -3
  37. package/lib/tasks/requirements/index.js +3 -0
  38. package/lib/tasks/requirements/opensearch-version.js +1 -1
  39. package/lib/tasks/requirements/searchengine-version.js +1 -2
  40. package/lib/util/dockerfile-builder/build-instructions.js +5 -1
  41. package/lib/util/dockerfile-builder/types.d.ts +1 -1
  42. package/lib/util/execute-in-container.js +3 -1
  43. package/lib/util/get-installed-magento-version.js +60 -2
  44. package/lib/util/portscanner.js +3 -3
  45. package/lib/util/run-composer.js +1 -1
  46. package/lib/util/run-magento.js +2 -1
  47. package/lib/util/run-php.js +2 -1
  48. package/lib/util/set-config.js +4 -2
  49. package/package.json +16 -16
  50. package/typings/context.d.ts +4 -2
  51. package/typings/index.d.ts +10 -0
@@ -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,8 +89,17 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
68
89
 
69
90
  const { isDockerDesktop } = ctx
70
91
 
71
- const volumeDirective = isDockerDesktop ? ':cached' : ''
72
-
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
+ }
73
103
  /**
74
104
  * @param {Record<string, number>} ports
75
105
  */
@@ -85,7 +115,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
85
115
  : {}
86
116
 
87
117
  /**
88
- * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], remoteImages?: string[], connectCommand?: string[], description?: string, pullImage?: boolean }>}
118
+ * @type {Record<string, import('../tasks/docker/containers/container-api').ContainerRunOptions & { _?: string, forwardedPorts?: string[], remoteImages?: string[], connectCommand?: string[], description?: string, pullImage?: boolean, dependsOn?: string[] }>}
89
119
  */
90
120
  const dockerConfig = {
91
121
  php: {
@@ -104,10 +134,29 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
104
134
  ],
105
135
  network: isDockerDesktop ? network.name : 'host',
106
136
  mountVolumes: [
107
- `${magentoDir}:${containerMagentoDir}${volumeDirective}`,
108
- `${volumes.composer_cache.name}:/composer/home/cache`,
109
- `${php.iniPath}:/usr/local/etc/php/php.ini${volumeDirective}`,
110
- `${php.fpmConfPath}:/usr/local/etc/php-fpm.d/zz-docker.conf${volumeDirective}`
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
+ })
111
160
  ],
112
161
  env: deepmerge(composerAuthEnv, php.env || {}),
113
162
  restart: 'on-failure:5',
@@ -115,6 +164,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
115
164
  remoteImages: [configuration.php.baseImage],
116
165
  name: `${prefix}_php`,
117
166
  connectCommand: ['/bin/sh'],
167
+ dependsOn: ['mariadb', 'redis', 'elasticsearch'],
118
168
  user:
119
169
  (ctx.platform === 'linux' && isDockerDesktop) ||
120
170
  !isDockerDesktop
@@ -137,11 +187,35 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
137
187
  ],
138
188
  network: isDockerDesktop ? network.name : 'host',
139
189
  mountVolumes: [
140
- `${magentoDir}:${containerMagentoDir}${volumeDirective}`,
141
- `${volumes.composer_cache.name}:/composer/home/cache`,
142
- `${php.iniPath}:/usr/local/etc/php/php.ini${volumeDirective}`,
143
- `${php.debugFpmConfPath}:/usr/local/etc/php-fpm.d/zz-docker.conf${volumeDirective}`,
144
- `${php.debugIniPath}:/usr/local/etc/php/conf.d/00-xdebug.ini${volumeDirective}`
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
+ })
145
219
  ],
146
220
  env: deepmerge(composerAuthEnv, php.env || {}),
147
221
  restart: 'on-failure:5',
@@ -149,6 +223,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
149
223
  pullImage: false,
150
224
  name: `${prefix}_php_with_xdebug`,
151
225
  connectCommand: ['/bin/sh'],
226
+ dependsOn: ['mariadb', 'redis', 'elasticsearch'],
152
227
  user:
153
228
  (ctx.platform === 'linux' && isDockerDesktop) ||
154
229
  !isDockerDesktop
@@ -172,20 +247,23 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
172
247
  healthCheck: {
173
248
  cmd: 'service nginx status'
174
249
  },
175
- /**
176
- * Mount volumes directly on linux
177
- */
178
250
  mountVolumes: [
179
- `${path.join(
180
- cacheDir,
181
- 'ssl-terminator',
182
- 'conf.d'
183
- )}:/etc/nginx/conf.d${volumeDirective}`,
184
- `${path.join(
185
- cacheDir,
186
- 'ssl-terminator',
187
- 'fastcgi_params'
188
- )}:/etc/nginx/fastcgi_params${volumeDirective}`
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
+ })
189
267
  ],
190
268
  restart: 'on-failure:5',
191
269
  network: isDockerDesktop ? network.name : 'host',
@@ -193,7 +271,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
193
271
  nginx.version ? `nginx:${nginx.version}` : nginx.image
194
272
  }`,
195
273
  name: `${prefix}_ssl-terminator`,
196
- command: "nginx -g 'daemon off;'"
274
+ command: "nginx -g 'daemon off;'",
275
+ dependsOn: ['nginx']
197
276
  },
198
277
  nginx: {
199
278
  _: 'Nginx',
@@ -212,21 +291,29 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
212
291
  healthCheck: {
213
292
  cmd: 'service nginx status'
214
293
  },
215
- /**
216
- * Mount volumes directly on linux
217
- */
218
294
  mountVolumes: [
219
- `${path.join(
220
- cacheDir,
221
- 'nginx',
222
- 'conf.d'
223
- )}:/etc/nginx/conf.d${volumeDirective}`,
224
- `${magentoDir}:${containerMagentoDir}${volumeDirective}`,
225
- `${path.join(
226
- cacheDir,
227
- 'ssl-terminator',
228
- 'fastcgi_params'
229
- )}:/etc/nginx/fastcgi_params${volumeDirective}`
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
+ })
230
317
  ],
231
318
  restart: 'on-failure:5',
232
319
  network: isDockerDesktop ? network.name : 'host',
@@ -234,7 +321,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
234
321
  nginx.version ? `nginx:${nginx.version}` : nginx.image
235
322
  }`,
236
323
  name: `${prefix}_nginx`,
237
- command: "nginx -g 'daemon off;'"
324
+ command: "nginx -g 'daemon off;'",
325
+ dependsOn: ['php', 'phpWithXdebug']
238
326
  },
239
327
  redis: {
240
328
  _: 'Redis',
@@ -254,16 +342,21 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
254
342
  mariadb: {
255
343
  _: 'MariaDB',
256
344
  healthCheck: {
257
- cmd: 'mariadb-admin ping --silent'
345
+ cmd: `${mariadb.binAdminFileName} ping --silent`
258
346
  },
259
347
  ports: [`127.0.0.1:${ports.mariadb}:3306`],
260
348
  forwardedPorts: [`127.0.0.1:${ports.mariadb}:3306`],
261
349
  mountVolumes: [
262
- `${volumes.mariadb.name}:/var/lib/mysql`,
263
- `${path.join(
264
- baseConfig.cacheDir,
265
- 'mariadb.cnf'
266
- )}:/etc/mysql/my.cnf${volumeDirective}`
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
+ })
267
360
  ],
268
361
  env: {
269
362
  MARIADB_ROOT_PASSWORD: 'scandipwa'
@@ -297,10 +390,16 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
297
390
  },
298
391
  ports: [`127.0.0.1:${ports.elasticsearch}:9200`],
299
392
  forwardedPorts: [`127.0.0.1:${ports.elasticsearch}:9200`],
300
- mounts: [
393
+ mountVolumes: [
301
394
  searchengine === 'elasticsearch'
302
- ? `source=${volumes.elasticsearch.name},target=/usr/share/elasticsearch/data`
303
- : `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
+ })
304
403
  ],
305
404
  env:
306
405
  searchengine === 'elasticsearch'
@@ -343,7 +442,12 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
343
442
  `127.0.0.1:${ports.maildevWeb}`,
344
443
  `127.0.0.1:${ports.maildevSMTP}`
345
444
  ],
346
- mountVolumes: [`${volumes.maildev.name}:/tmp/maildev`],
445
+ mountVolumes: [
446
+ containerVolume({
447
+ source: volumes.maildev.name,
448
+ target: '/tmp/maildev'
449
+ })
450
+ ],
347
451
  env: {
348
452
  MAILDEV_SMTP_PORT: isDockerDesktop
349
453
  ? '1025'
@@ -384,10 +488,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
384
488
  }`,
385
489
  name: `${prefix}_varnish`,
386
490
  mountVolumes: [
387
- `${path.join(
388
- cacheDir,
389
- 'varnish'
390
- )}:/etc/varnish${volumeDirective}`
491
+ containerVolume({
492
+ source: path.join(cacheDir, 'varnish'),
493
+ target: '/etc/varnish',
494
+ ro: true
495
+ })
391
496
  ],
392
497
  ports: isDockerDesktop
393
498
  ? [
@@ -413,8 +518,11 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
413
518
  tmpfs: ['/var/lib/varnish/varnishd:exec'],
414
519
  description: `Varnish HealthCheck status: ${logger.style.command(
415
520
  varnish.healthCheck ? 'enabled' : 'disabled'
416
- )}`
521
+ )}`,
522
+ dependsOn: ['nginx']
417
523
  }
524
+
525
+ dockerConfig.sslTerminator.dependsOn.push('varnish')
418
526
  }
419
527
 
420
528
  if (newRelic.enabled) {
@@ -98,18 +98,54 @@ const getPortsConfig = async (ports, options = {}) => {
98
98
  if (useNonOverlappingPorts) {
99
99
  p = p.concat(await getUsedByOtherCMAProjectsPorts())
100
100
  }
101
- const availablePorts = Object.fromEntries(
102
- await Promise.all(
103
- Object.entries(mergedPorts).map(async ([name, port]) => {
104
- const availablePort = await getPort(port, {
105
- portIgnoreList: p
106
- })
107
-
108
- return [name, availablePort]
109
- })
110
- )
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
+ {}
111
125
  )
112
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
+
113
149
  return availablePorts
114
150
  }
115
151
 
@@ -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
  }
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb102 = () => ({
5
5
  image: 'mariadb:10.2',
6
- useOptimizerSwitch: false
6
+ useOptimizerSwitch: false,
7
+ binFileName: 'mysql',
8
+ binAdminFileName: 'mysqladmin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb102
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb103 = () => ({
5
5
  image: 'mariadb:10.3',
6
- useOptimizerSwitch: false
6
+ useOptimizerSwitch: false,
7
+ binFileName: 'mysql',
8
+ binAdminFileName: 'mysqladmin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb103
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb104 = () => ({
5
5
  image: 'mariadb:10.4',
6
- useOptimizerSwitch: true
6
+ useOptimizerSwitch: true,
7
+ binFileName: 'mysql',
8
+ binAdminFileName: 'mysqladmin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb104
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb106 = () => ({
5
5
  image: 'mariadb:10.6',
6
- useOptimizerSwitch: true
6
+ useOptimizerSwitch: true,
7
+ binFileName: 'mysql',
8
+ binAdminFileName: 'mysqladmin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb106
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb114 = () => ({
5
5
  image: 'mariadb:11.4',
6
- useOptimizerSwitch: true
6
+ useOptimizerSwitch: true,
7
+ binFileName: 'mariadb',
8
+ binAdminFileName: 'mariadb-admin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb114
@@ -3,7 +3,9 @@
3
3
  */
4
4
  const mariadb116 = () => ({
5
5
  image: 'mariadb:11.6',
6
- useOptimizerSwitch: true
6
+ useOptimizerSwitch: true,
7
+ binFileName: 'mariadb',
8
+ binAdminFileName: 'mariadb-admin'
7
9
  })
8
10
 
9
11
  module.exports = mariadb116
@@ -4,7 +4,7 @@
4
4
  module.exports = {
5
5
  'bootstrap.memory_lock': true,
6
6
  'discovery.type': 'single-node',
7
- OPENSEARCH_JAVA_OPTS: '-Xms512m -Xmx2048m',
7
+ OPENSEARCH_JAVA_OPTS: '-Xms2g -Xmx2g',
8
8
  DISABLE_SECURITY_PLUGIN: true,
9
9
  DISABLE_PERFORMANCE_ANALYZER_AGENT_CLI: true
10
10
  }
@@ -7,6 +7,7 @@ module.exports = {
7
7
  command: ({
8
8
  version = ''
9
9
  }) => `apk add --no-cache --virtual .build-deps \\$PHPIZE_DEPS \
10
+ && apk add --no-cache linux-headers \
10
11
  && pecl install xdebug${version ? `-${version}` : ''} \
11
12
  && docker-php-ext-enable xdebug \
12
13
  && apk del -f .build-deps`,
@@ -1,13 +1,13 @@
1
1
  upstream fastcgi_backend {
2
2
  # use tcp connection
3
- server <%= it.hostMachine %>:<%= it.ports.fpm %>;
3
+ server <%= it.phpNetwork %>:<%= it.fpmPort %>;
4
4
 
5
5
  keepalive 16;
6
6
  }
7
7
 
8
8
  # Define available upstreams
9
9
  upstream fastcgi_backend_xdebug {
10
- server <%= it.hostMachine %>:<%= it.ports.fpmXdebug %>;
10
+ server <%= it.phpWithXdebugNetwork %>:<%= it.fpmXdebugPort %>;
11
11
 
12
12
  keepalive 16;
13
13
  }
@@ -4,7 +4,7 @@ log_level = debug
4
4
 
5
5
  [www]
6
6
  clear_env = no
7
- user = nobody
7
+ user = www-data
8
8
  ;; Commented because if it is not set, php-fpm will use default group.
9
9
  ;; https://www.php.net/manual/en/install.fpm.configuration.php#group
10
10
  ; group = nobody
@@ -4,7 +4,7 @@ set_real_ip_from 172.0.0.0/8;
4
4
  real_ip_recursive on;
5
5
 
6
6
  upstream app_backend {
7
- server <%= it.hostMachine %>:<% if (!it.debug && it.config.configuration.varnish.enabled) { %><%= it.ports.varnish %><% } else { %><%= it.ports.app %><% } %>;
7
+ server <%= it.backendNetwork %>:<%= it.backendPort %>;
8
8
 
9
9
  keepalive 16;
10
10
  }
@@ -7,11 +7,12 @@ const { containerApi } = require('../docker/containers')
7
7
  const createMagentoDatabase = () => ({
8
8
  title: 'Creating Magento database',
9
9
  task: async (ctx, task) => {
10
+ const { configuration } = ctx.config.overridenConfiguration
10
11
  const { mariadb } = ctx.config.docker.getContainers()
11
12
  task.title = `Creating Magento database in ${mariadb._}`
12
13
 
13
14
  await containerApi.exec({
14
- command: `mariadb -uroot -p${mariadb.env.MARIADB_ROOT_PASSWORD} -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`,
15
+ command: `${configuration.mariadb.binFileName} -uroot -p${mariadb.env.MARIADB_ROOT_PASSWORD} -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`,
15
16
  container: mariadb.name
16
17
  })
17
18
  }
@@ -1,5 +1,5 @@
1
1
  const os = require('os')
2
- const { NodeSSH } = require('node-ssh')
2
+ const { NodeSSH } = require('node-ssh-no-cpu-features')
3
3
  const pathExists = require('../../../../util/path-exists')
4
4
  const regularSSHServer = require('./regular-server')
5
5
  const readymageSSH = require('./readymage')
@@ -4,7 +4,7 @@ const { execAsyncSpawn } = require('../../../../util/exec-async-command')
4
4
  const databaseDumpCommandWithOptions = require('./database-dump-command')
5
5
 
6
6
  /**
7
- * @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
7
+ * @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh-no-cpu-features').NodeSSH }>}
8
8
  */
9
9
  const readymageSSH = () => ({
10
10
  task: async (ctx, task) => {
@@ -4,7 +4,7 @@ const { execAsyncSpawn } = require('../../../../util/exec-async-command')
4
4
  const databaseDumpCommandWithOptions = require('./database-dump-command')
5
5
  const KnownError = require('../../../../errors/known-error')
6
6
  /**
7
- * @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh').NodeSSH }>}
7
+ * @returns {import('listr2').ListrTask<import('../../../../../typings/context').ListrContext & { ssh: import('node-ssh-no-cpu-features').NodeSSH }>}
8
8
  */
9
9
  const regularSSHServer = () => ({
10
10
  task: async (ctx, task) => {
@@ -63,6 +63,11 @@ export interface ContainerExecOptions {
63
63
  * Allocate a pseudo-TTY
64
64
  */
65
65
  tty?: boolean
66
+
67
+ /**
68
+ * Keep STDIN open even if not attached
69
+ */
70
+ interactive?: boolean
66
71
  }
67
72
 
68
73
  export function exec<T>(
@@ -103,7 +103,7 @@ const run = (options, execOptions = {}) =>
103
103
  * @param {import('./container-api').ContainerExecOptions} options
104
104
  */
105
105
  const execCommand = (options) => {
106
- const { command, container, env, tty, user, workdir } = options
106
+ const { command, container, env, tty, user, workdir, interactive } = options
107
107
  const envArgs = !env
108
108
  ? ''
109
109
  : Object.entries(env)
@@ -112,6 +112,7 @@ const execCommand = (options) => {
112
112
  const ttyArg = tty ? '--tty' : ''
113
113
  const userArg = user ? `--user=${user}` : ''
114
114
  const workdirArg = workdir ? `--workdir=${workdir}` : ''
115
+ const interactiveArg = interactive ? '--interactive' : ''
115
116
 
116
117
  const dockerCommand = [
117
118
  'docker',
@@ -119,6 +120,7 @@ const execCommand = (options) => {
119
120
  'exec',
120
121
  envArgs,
121
122
  ttyArg,
123
+ interactiveArg,
122
124
  userArg,
123
125
  workdirArg,
124
126
  container,