@scandipwa/magento-scripts 2.0.2 → 2.0.3-alpha.0
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/config/docker.js
CHANGED
|
@@ -24,7 +24,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
24
24
|
elasticsearch,
|
|
25
25
|
mariadb,
|
|
26
26
|
varnish,
|
|
27
|
-
maildev
|
|
27
|
+
maildev,
|
|
28
|
+
newRelic
|
|
28
29
|
} = configuration;
|
|
29
30
|
|
|
30
31
|
const php = getPhpConfig(overridenConfiguration, baseConfig);
|
|
@@ -347,6 +348,22 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
347
348
|
};
|
|
348
349
|
}
|
|
349
350
|
|
|
351
|
+
if (newRelic.enabled) {
|
|
352
|
+
dockerConfig.newRelicPHPDaemon = {
|
|
353
|
+
_: 'New Relic PHP daemon',
|
|
354
|
+
ports: [],
|
|
355
|
+
name: `${ prefix }_newrelic-php-daemon`,
|
|
356
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
357
|
+
image: 'newrelic/php-daemon',
|
|
358
|
+
mountVolumes: [
|
|
359
|
+
'/var/run/docker.sock:/var/run/docker.sock',
|
|
360
|
+
'/:/host:ro',
|
|
361
|
+
`${path.join(process.cwd(), 'newrelic-infra.yml')}:/etc/newrelic-infra.yml`
|
|
362
|
+
],
|
|
363
|
+
capAdd: 'SYS_PTRACE'
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
|
|
350
367
|
return dockerConfig;
|
|
351
368
|
};
|
|
352
369
|
|
|
@@ -4,7 +4,13 @@ const semver = require('semver');
|
|
|
4
4
|
const { deepmerge } = require('../../util/deepmerge');
|
|
5
5
|
|
|
6
6
|
const defaultCMAConfig = {
|
|
7
|
-
prefix: true
|
|
7
|
+
prefix: true,
|
|
8
|
+
configuration: {
|
|
9
|
+
newRelic: {
|
|
10
|
+
enabled: false,
|
|
11
|
+
agentVersion: '10.2.0.314'
|
|
12
|
+
}
|
|
13
|
+
}
|
|
8
14
|
};
|
|
9
15
|
|
|
10
16
|
const magentoVersions = fs.readdirSync(__dirname, {
|
|
@@ -128,6 +128,23 @@ const buildDockerFileInstructions = async (ctx, { image, tag }) => {
|
|
|
128
128
|
PATH: `${ imagePathEnv.split('=').pop() }:${ magentoBinDir }:${vendorBinDir }`
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
+
if (ctx.config.overridenConfiguration.configuration.newRelic.enabled) {
|
|
132
|
+
const { agentVersion, licenseKey } = ctx.config.overridenConfiguration.configuration.newRelic;
|
|
133
|
+
|
|
134
|
+
dockerFileInstructions
|
|
135
|
+
.run('apk add --no-cache gcompat')
|
|
136
|
+
// eslint-disable-next-line max-len
|
|
137
|
+
.run(`curl -L https://download.newrelic.com/php_agent/archive/${agentVersion}/newrelic-php5-${agentVersion}-linux.tar.gz | tar -C /tmp -zx \
|
|
138
|
+
&& export NR_INSTALL_USE_CP_NOT_LN=1 \
|
|
139
|
+
&& export NR_INSTALL_SILENT=1 \
|
|
140
|
+
&& /tmp/newrelic-php5-${agentVersion}-linux/newrelic-install install \
|
|
141
|
+
&& rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*`)
|
|
142
|
+
.run(`sed -i -e "s/REPLACE_WITH_REAL_KEY/${licenseKey}/" \
|
|
143
|
+
-e "s/newrelic.appname[[:space:]]=[[:space:]].*/newrelic.appname=\\"${ctx.config.baseConfig.prefix}\\"/" \
|
|
144
|
+
-e '\\$anewrelic.daemon.address="${ ctx.isDockerDesktop ? 'host.docker.internal' : 'localhost' }:31339"' \
|
|
145
|
+
\\$PHP_INI_DIR/conf.d/newrelic.ini`);
|
|
146
|
+
}
|
|
147
|
+
|
|
131
148
|
return dockerFileInstructions;
|
|
132
149
|
};
|
|
133
150
|
|
|
@@ -111,12 +111,12 @@ const elasticsearchConfigurationSchema = Joi.object({
|
|
|
111
111
|
* @type {Joi.ObjectSchema<import('../../typings').ComposerConfiguration>}
|
|
112
112
|
*/
|
|
113
113
|
const composerConfigurationSchema = Joi.object({
|
|
114
|
-
version: Joi.string().optional().custom((value) => {
|
|
114
|
+
version: Joi.string().optional().custom((value, helpers) => {
|
|
115
115
|
if (['1', '2'].includes(value)) {
|
|
116
116
|
return undefined;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
return versionValidator(value);
|
|
119
|
+
return versionValidator(value, helpers);
|
|
120
120
|
}),
|
|
121
121
|
plugins: Joi.object()
|
|
122
122
|
.pattern(
|
|
@@ -130,6 +130,21 @@ const composerConfigurationSchema = Joi.object({
|
|
|
130
130
|
)
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @type {Joi.ObjectSchema<import('../../typings').NewRelicConfiguration>}
|
|
135
|
+
*/
|
|
136
|
+
const newRelicConfigurationSchema = Joi.object({
|
|
137
|
+
enabled: Joi.boolean().optional(),
|
|
138
|
+
agentVersion: Joi.string().optional(),
|
|
139
|
+
licenseKey: Joi.string().optional()
|
|
140
|
+
}).custom((d, helpers) => {
|
|
141
|
+
if (d.enabled && !d.licenseKey) {
|
|
142
|
+
return helpers.message('when newRelic is enabled license key is required!');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return true;
|
|
146
|
+
});
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
* @type {Joi.ObjectSchema<import('../../typings').CMAConfiguration['configuration']>}
|
|
135
150
|
*/
|
|
@@ -142,7 +157,8 @@ const configurationSchema = Joi.object({
|
|
|
142
157
|
composer: composerConfigurationSchema.optional(),
|
|
143
158
|
varnish: varnishConfigurationSchema.optional(),
|
|
144
159
|
sslTerminator: nginxConfigurationSchema.optional(),
|
|
145
|
-
maildev: serviceConfigurationSchema.optional()
|
|
160
|
+
maildev: serviceConfigurationSchema.optional(),
|
|
161
|
+
newRelic: newRelicConfigurationSchema.optional()
|
|
146
162
|
});
|
|
147
163
|
|
|
148
164
|
/**
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Scripts and configuration used by CMA.",
|
|
4
4
|
"homepage": "https://docs.create-magento-app.com/",
|
|
5
5
|
"repository": "github:scandipwa/create-magento-app",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.3-alpha.0",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"mysql",
|
|
55
55
|
"scandipwa"
|
|
56
56
|
],
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "c9e600b48c4f6d2dd612d234aaf839f8cbcf1734"
|
|
58
58
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -199,6 +199,23 @@ export interface SSLConfiguration {
|
|
|
199
199
|
ssl_certificate_key: string
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
export interface NewRelicConfiguration {
|
|
203
|
+
/**
|
|
204
|
+
* Enables or disables New Relic in application
|
|
205
|
+
*/
|
|
206
|
+
enabled: boolean
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* New Relic Agent version
|
|
210
|
+
*/
|
|
211
|
+
agentVersion?: string
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* New Relic license key
|
|
215
|
+
*/
|
|
216
|
+
licenseKey?: string
|
|
217
|
+
}
|
|
218
|
+
|
|
202
219
|
export interface CMAConfiguration {
|
|
203
220
|
/**
|
|
204
221
|
* Services configuration
|
|
@@ -243,6 +260,11 @@ export interface CMAConfiguration {
|
|
|
243
260
|
* SSL Terminator configuration
|
|
244
261
|
*/
|
|
245
262
|
sslTerminator: SSLTerminatorConfiguration
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* New Relic configuration
|
|
266
|
+
*/
|
|
267
|
+
newRelic: NewRelicConfiguration
|
|
246
268
|
}
|
|
247
269
|
/**
|
|
248
270
|
* Magento configuration
|