@scandipwa/magento-scripts 2.4.0-alpha.1 → 2.4.0-alpha.3
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/lib/commands/import-db.js +36 -3
- package/lib/config/docker.js +164 -56
- package/lib/config/port-config.js +46 -10
- package/lib/config/services/elasticsearch/default-es-env.js +1 -1
- package/lib/config/services/mariadb/versions/mariadb-10.2.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.3.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.4.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-10.6.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-11.4.js +3 -1
- package/lib/config/services/mariadb/versions/mariadb-11.6.js +3 -1
- package/lib/config/services/opensearch/default-os-env.js +1 -1
- package/lib/config/services/php/extensions/xdebug.js +1 -0
- package/lib/config/templates/nginx.template.conf +2 -2
- package/lib/config/templates/php-fpm.template.conf +3 -4
- package/lib/config/templates/ssl-terminator.template.conf +1 -1
- package/lib/tasks/database/create-magento-database.js +2 -1
- package/lib/tasks/database/fix-db.js +2 -0
- package/lib/tasks/database/import-dump-to-database.js +7 -4
- package/lib/tasks/database/import-remote-db/ssh/index.js +1 -1
- package/lib/tasks/database/import-remote-db/ssh/readymage.js +1 -1
- package/lib/tasks/database/import-remote-db/ssh/regular-server.js +1 -1
- package/lib/tasks/docker/containers/container-api.d.ts +5 -0
- package/lib/tasks/docker/containers/container-api.js +3 -1
- package/lib/tasks/docker/containers/tasks.js +86 -21
- package/lib/tasks/docker/project-image-builder.js +57 -44
- package/lib/tasks/docker/system/system-api.d.ts +66 -0
- package/lib/tasks/docker/system/system-api.js +28 -1
- package/lib/tasks/execute.js +1 -1
- package/lib/tasks/file-system/create-nginx-config.js +22 -8
- package/lib/tasks/file-system/create-php-fpm-config.js +6 -1
- package/lib/tasks/file-system/create-php-fpm-debug-config.js +6 -1
- package/lib/tasks/file-system/create-ssl-terminator-config.js +20 -7
- package/lib/tasks/magento/install-magento-project.js +101 -34
- package/lib/tasks/magento/setup-magento/check-file-permissions.php +55 -0
- package/lib/tasks/magento/setup-magento/disable-custom-admin-path.js +21 -0
- package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +13 -0
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/make-magento-binaries-executable.js +44 -0
- package/lib/tasks/magento/setup-magento/set-deployment-mode.js +8 -5
- package/lib/tasks/magento/setup-magento/set-mail-config.js +16 -2
- package/lib/tasks/magento/setup-magento/setup-file-permissions.js +236 -0
- package/lib/tasks/php/php-container.js +21 -6
- package/lib/tasks/php/update-env-php.js +3 -9
- package/lib/tasks/requirements/cgroup-version.js +69 -0
- package/lib/tasks/requirements/elasticsearch-version.js +19 -3
- package/lib/tasks/requirements/index.js +3 -0
- package/lib/tasks/requirements/opensearch-version.js +1 -1
- package/lib/tasks/requirements/searchengine-version.js +1 -2
- package/lib/tasks/status/index.js +1 -0
- package/lib/util/database.js +36 -0
- package/lib/util/dockerfile-builder/build-instructions.js +5 -1
- package/lib/util/dockerfile-builder/types.d.ts +1 -1
- package/lib/util/execute-in-container.js +3 -1
- package/lib/util/get-installed-magento-version.js +60 -2
- package/lib/util/portscanner.js +3 -3
- package/lib/util/run-composer.js +1 -1
- package/lib/util/run-magento.js +2 -1
- package/lib/util/run-php.js +2 -1
- package/lib/util/set-config.js +4 -2
- package/package.json +16 -16
- package/typings/context.d.ts +4 -2
- package/typings/index.d.ts +10 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const logger = require('@scandipwa/scandipwa-dev-utils/logger')
|
|
2
2
|
const { Listr } = require('listr2')
|
|
3
3
|
const importDump = require('../tasks/import-dump')
|
|
4
|
+
const { getInstanceMetadata } = require('../util/instance-metadata')
|
|
5
|
+
const ConsoleBlock = require('../util/console-block')
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @param {import('yargs')} yargs
|
|
@@ -37,14 +39,45 @@ module.exports = (yargs) => {
|
|
|
37
39
|
}
|
|
38
40
|
})
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @type {import('../../typings/context').ListrContext}
|
|
44
|
+
*/
|
|
45
|
+
let ctx
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
try {
|
|
48
|
+
ctx = await tasks.run()
|
|
44
49
|
} catch (e) {
|
|
45
50
|
logger.error(e.message || e)
|
|
46
51
|
process.exit(1)
|
|
47
52
|
}
|
|
53
|
+
|
|
54
|
+
const instanceMetadata = getInstanceMetadata(ctx)
|
|
55
|
+
|
|
56
|
+
const block = new ConsoleBlock()
|
|
57
|
+
block.addHeader('Magento 2').addEmptyLine()
|
|
58
|
+
|
|
59
|
+
block.addLine(logger.style.misc('Frontend'))
|
|
60
|
+
instanceMetadata.frontend.forEach(({ title, text }) => {
|
|
61
|
+
block.addLine(` ${title}: ${text}`)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
block.addEmptyLine()
|
|
65
|
+
|
|
66
|
+
block.addLine(logger.style.misc('Admin'))
|
|
67
|
+
instanceMetadata.admin.forEach(({ title, text }) => {
|
|
68
|
+
block.addLine(` ${title}: ${text}`)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
block.addEmptyLine()
|
|
72
|
+
|
|
73
|
+
block.addLine(logger.style.misc('MailDev'))
|
|
74
|
+
instanceMetadata.maildev.forEach(({ title, text }) => {
|
|
75
|
+
block.addLine(` ${title}: ${text}`)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
block.log()
|
|
79
|
+
|
|
80
|
+
process.exit(0)
|
|
48
81
|
}
|
|
49
82
|
)
|
|
50
83
|
}
|
package/lib/config/docker.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
180
|
-
cacheDir,
|
|
181
|
-
'
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
220
|
-
cacheDir,
|
|
221
|
-
'nginx',
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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:
|
|
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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
|
|
393
|
+
mountVolumes: [
|
|
301
394
|
searchengine === 'elasticsearch'
|
|
302
|
-
?
|
|
303
|
-
|
|
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: [
|
|
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
|
-
|
|
388
|
-
cacheDir,
|
|
389
|
-
'varnish'
|
|
390
|
-
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
|
@@ -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.
|
|
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.
|
|
10
|
+
server <%= it.phpWithXdebugNetwork %>:<%= it.fpmXdebugPort %>;
|
|
11
11
|
|
|
12
12
|
keepalive 16;
|
|
13
13
|
}
|
|
@@ -4,10 +4,9 @@ log_level = debug
|
|
|
4
4
|
|
|
5
5
|
[www]
|
|
6
6
|
clear_env = no
|
|
7
|
-
user =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
; group = nobody
|
|
7
|
+
user = <%= it.user %>
|
|
8
|
+
|
|
9
|
+
group = <%= it.user %>
|
|
11
10
|
|
|
12
11
|
catch_workers_output = yes
|
|
13
12
|
|
|
@@ -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.
|
|
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:
|
|
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
|
}
|
|
@@ -2,6 +2,7 @@ const configureElasticsearch = require('../magento/setup-magento/configure-searc
|
|
|
2
2
|
const deleteAdminUsers = require('../magento/setup-magento/delete-admin-users')
|
|
3
3
|
const deleteCustomers = require('../magento/setup-magento/delete-customers')
|
|
4
4
|
const deleteOrders = require('../magento/setup-magento/delete-orders')
|
|
5
|
+
const disableCustomAdminPath = require('../magento/setup-magento/disable-custom-admin-path')
|
|
5
6
|
const varnishConfigSetup = require('../magento/setup-magento/varnish-config')
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -30,6 +31,7 @@ const fixDB = () => ({
|
|
|
30
31
|
[
|
|
31
32
|
varnishConfigSetup(),
|
|
32
33
|
configureElasticsearch(),
|
|
34
|
+
disableCustomAdminPath(),
|
|
33
35
|
{
|
|
34
36
|
title: 'Deleting customers data',
|
|
35
37
|
skip: ({ withCustomersData }) => withCustomersData,
|