@scandipwa/magento-scripts 2.0.0-alpha.10 → 2.0.0-alpha.13
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/cli.js +5 -0
- package/lib/commands/start.js +17 -3
- package/lib/commands/status.js +9 -1
- package/lib/config/config.js +20 -2
- package/lib/config/docker.js +43 -44
- package/lib/config/index.js +1 -1
- package/lib/config/php/versions/php-7.2.js +1 -0
- package/lib/config/php/versions/php-7.3.js +1 -0
- package/lib/config/php/versions/php-7.4.js +1 -0
- package/lib/config/php/versions/php-8.1.js +1 -0
- package/lib/config/php-config.js +4 -3
- package/lib/config/services/composer/versions/composer-1.js +8 -0
- package/lib/config/services/composer/versions/composer-2.js +8 -0
- package/lib/config/services/composer/versions/index.js +4 -0
- package/lib/config/services/nginx/versions/index.js +3 -0
- package/lib/config/services/nginx/versions/nginx-1.18.js +11 -0
- package/lib/config/{ssl-terminator → services/ssl-terminator}/index.js +3 -0
- package/lib/config/templates/magentorc.template +6 -5
- package/lib/config/templates/php-debug.template.ini +31 -0
- package/lib/config/templates/php-fpm.template.conf +1 -2
- package/lib/config/templates/php.template.ini +5 -201
- package/lib/config/templates/ssl-terminator.template.conf +2 -0
- package/lib/config/templates/varnish.template.vcl +20 -13
- package/lib/config/varnish/varnish-6-0.js +4 -0
- package/lib/config/varnish/varnish-6-6.js +4 -0
- package/lib/config/varnish/varnish-7-0.js +4 -0
- package/lib/config/versions/magento-2.3.0.js +5 -9
- package/lib/config/versions/magento-2.3.1.js +5 -9
- package/lib/config/versions/magento-2.3.2-p1.js +5 -9
- package/lib/config/versions/magento-2.3.2-p2.js +5 -9
- package/lib/config/versions/magento-2.3.2.js +5 -9
- package/lib/config/versions/magento-2.3.3-p1.js +5 -9
- package/lib/config/versions/magento-2.3.3.js +5 -9
- package/lib/config/versions/magento-2.3.4-p1.js +5 -9
- package/lib/config/versions/magento-2.3.4-p2.js +5 -9
- package/lib/config/versions/magento-2.3.4.js +5 -9
- package/lib/config/versions/magento-2.3.5-p1.js +5 -9
- package/lib/config/versions/magento-2.3.5-p2.js +5 -9
- package/lib/config/versions/magento-2.3.5.js +5 -9
- package/lib/config/versions/magento-2.3.6-p1.js +5 -9
- package/lib/config/versions/magento-2.3.6.js +5 -9
- package/lib/config/versions/magento-2.3.7-p1.js +5 -9
- package/lib/config/versions/magento-2.3.7-p2.js +5 -9
- package/lib/config/versions/magento-2.3.7-p3.js +5 -9
- package/lib/config/versions/magento-2.3.7-p4.js +5 -9
- package/lib/config/versions/magento-2.3.7.js +5 -9
- package/lib/config/versions/magento-2.4.0-p1.js +5 -9
- package/lib/config/versions/magento-2.4.0.js +5 -9
- package/lib/config/versions/magento-2.4.1-p1.js +5 -9
- package/lib/config/versions/magento-2.4.1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p1.js +5 -9
- package/lib/config/versions/magento-2.4.2-p2.js +5 -9
- package/lib/config/versions/magento-2.4.2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p1.js +5 -9
- package/lib/config/versions/magento-2.4.3-p2.js +5 -9
- package/lib/config/versions/magento-2.4.3-p3.js +5 -9
- package/lib/config/versions/magento-2.4.3.js +5 -9
- package/lib/config/versions/magento-2.4.4-p1.js +5 -9
- package/lib/config/versions/magento-2.4.4.js +5 -9
- package/lib/config/versions/magento-2.4.5.js +5 -9
- package/lib/tasks/composer/local-auth-json.js +1 -1
- package/lib/tasks/database/connect-to-database.js +6 -3
- package/lib/tasks/database/create-magento-database.js +5 -2
- package/lib/tasks/database/create-magento-user.js +50 -0
- package/lib/tasks/database/default-magento-database.js +3 -0
- package/lib/tasks/database/default-magento-user.js +7 -0
- package/lib/tasks/database/import-dump-to-database.js +3 -2
- package/lib/tasks/docker/api.d.ts +25 -1
- package/lib/tasks/docker/api.js +31 -1
- package/lib/tasks/docker/containers/container-api.d.ts +14 -0
- package/lib/tasks/docker/containers/container-api.js +50 -1
- package/lib/tasks/docker/containers/tasks.js +32 -1
- package/lib/tasks/docker/index.js +6 -1
- package/lib/tasks/docker/project-image-builder.js +6 -8
- package/lib/tasks/docker/volume/index.js +2 -1
- package/lib/tasks/docker/volume/tasks.js +54 -9
- package/lib/tasks/docker/volume/volume-api.d.ts +10 -0
- package/lib/tasks/docker/volume/volume-api.js +25 -1
- package/lib/tasks/execute.js +5 -2
- package/lib/tasks/file-system/create-nginx-config.js +3 -5
- package/lib/tasks/file-system/create-php-config.js +2 -23
- package/lib/tasks/file-system/create-php-debug-config.js +45 -0
- package/lib/tasks/file-system/create-php-fpm-config.js +2 -4
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -7
- package/lib/tasks/file-system/create-varnish-config.js +4 -7
- package/lib/tasks/file-system/index.js +2 -0
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +2 -4
- package/lib/tasks/magento/setup-magento/flush-redis-config.js +3 -6
- package/lib/tasks/magento/setup-magento/install-magento.js +8 -10
- package/lib/tasks/magento/setup-magento/varnish-config.js +4 -9
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +15 -16
- package/lib/tasks/php/php-container.js +1 -1
- package/lib/tasks/php/update-env-php.js +3 -4
- package/lib/tasks/requirements/composer-credentials.js +7 -3
- package/lib/tasks/requirements/docker/context.js +88 -0
- package/lib/tasks/requirements/docker/index.js +107 -18
- package/lib/tasks/requirements/docker/install.js +21 -7
- package/lib/tasks/requirements/docker/permissions.js +2 -11
- package/lib/tasks/requirements/docker/running-status.js +94 -24
- package/lib/tasks/requirements/docker/version.js +1 -0
- package/lib/tasks/requirements/index.js +0 -2
- package/lib/tasks/requirements/php-version.js +4 -2
- package/lib/tasks/start.js +27 -6
- package/lib/tasks/status/index.js +13 -11
- package/lib/tasks/stop.js +2 -0
- package/lib/util/config-file-validator.js +2 -0
- package/lib/util/execute-in-container.js +3 -3
- package/lib/util/systemctl.js +62 -13
- package/package.json +2 -2
- package/typings/context.d.ts +7 -0
- package/typings/index.d.ts +38 -1
- package/lib/tasks/requirements/dependency/arch.js +0 -50
- package/lib/tasks/requirements/dependency/centos.js +0 -36
- package/lib/tasks/requirements/dependency/fedora.js +0 -36
- package/lib/tasks/requirements/dependency/index.js +0 -33
- package/lib/tasks/requirements/dependency/mac.js +0 -124
- package/lib/tasks/requirements/dependency/ubuntu.js +0 -83
package/lib/commands/cli.js
CHANGED
|
@@ -46,6 +46,11 @@ module.exports = (yargs) => {
|
|
|
46
46
|
.addLine(`Available shortcuts: magento -> ${logger.style.command('m')}, composer -> ${logger.style.command('c')}`)
|
|
47
47
|
.addEmptyLine();
|
|
48
48
|
|
|
49
|
+
block
|
|
50
|
+
.addLine(`Execute into any service: ${logger.style.command('exec <service name>')}`)
|
|
51
|
+
.addLine(`Execute into PHP container: ${logger.style.command('exec php')}`)
|
|
52
|
+
.addEmptyLine();
|
|
53
|
+
|
|
49
54
|
if (ctx.config.overridenConfiguration.configuration.varnish.enabled) {
|
|
50
55
|
block.addLine(`Clear Varnish cache: ${logger.style.command('cvc')}`);
|
|
51
56
|
}
|
package/lib/commands/start.js
CHANGED
|
@@ -22,6 +22,7 @@ const reportErrors = async (errors) => {
|
|
|
22
22
|
const path = (error.path && ` Error path: ${error.path} `) || '';
|
|
23
23
|
if (error instanceof UnknownError || error instanceof KnownError) {
|
|
24
24
|
logger.error(error.message);
|
|
25
|
+
logger.error(error.stack);
|
|
25
26
|
if (error instanceof UnknownError) {
|
|
26
27
|
await googleAnalytics.trackError(`Unknown Error:${path}${error.stack}`);
|
|
27
28
|
} else {
|
|
@@ -29,9 +30,11 @@ const reportErrors = async (errors) => {
|
|
|
29
30
|
}
|
|
30
31
|
} else if (error instanceof Error) {
|
|
31
32
|
logger.error(error.message);
|
|
33
|
+
logger.error(error.stack);
|
|
32
34
|
await googleAnalytics.trackError(`Regular Error:${path}${error.message}`);
|
|
33
35
|
} else {
|
|
34
36
|
logger.error(error);
|
|
37
|
+
logger.error(error.stack);
|
|
35
38
|
await googleAnalytics.trackError(`Non Error:${path}${error}`); // track non-errors throws
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -83,6 +86,16 @@ module.exports = (yargs) => {
|
|
|
83
86
|
describe: 'Enable verbose logging',
|
|
84
87
|
type: 'boolean',
|
|
85
88
|
default: false
|
|
89
|
+
})
|
|
90
|
+
.option('pull-images', {
|
|
91
|
+
describe: 'Pull Docker images',
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
default: false
|
|
94
|
+
})
|
|
95
|
+
.option('reset-global-config', {
|
|
96
|
+
describe: 'Reset global magento-scripts configuration',
|
|
97
|
+
type: 'boolean',
|
|
98
|
+
default: false
|
|
86
99
|
}),
|
|
87
100
|
async (args = {}) => {
|
|
88
101
|
/**
|
|
@@ -170,10 +183,11 @@ module.exports = (yargs) => {
|
|
|
170
183
|
);
|
|
171
184
|
logger.log('');
|
|
172
185
|
|
|
173
|
-
if (
|
|
174
|
-
logger.warn('
|
|
186
|
+
if (tasks.err && tasks.err.length > 0) {
|
|
187
|
+
logger.warn('During the start, we encountered some errors that have not impacted the start-up process!');
|
|
188
|
+
logger.log('');
|
|
175
189
|
for (const err of tasks.err) {
|
|
176
|
-
logger.error(
|
|
190
|
+
logger.error(`Error path: ${err.path}\nError message: ${err.message}\n\nError stack: ${err.stack}`);
|
|
177
191
|
}
|
|
178
192
|
}
|
|
179
193
|
|
package/lib/commands/status.js
CHANGED
|
@@ -9,6 +9,7 @@ const { statusContainers } = require('../tasks/docker/containers');
|
|
|
9
9
|
const getProjectConfiguration = require('../config/get-project-configuration');
|
|
10
10
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
11
11
|
const checkPHPVersion = require('../tasks/requirements/php-version');
|
|
12
|
+
const { getComposerVersionTask } = require('../tasks/composer');
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @param {import('yargs')} yargs
|
|
@@ -21,7 +22,14 @@ module.exports = (yargs) => {
|
|
|
21
22
|
checkConfigurationFile(),
|
|
22
23
|
getProjectConfiguration(),
|
|
23
24
|
getCachedPorts(),
|
|
24
|
-
|
|
25
|
+
{
|
|
26
|
+
task: (ctx, task) => task.newListr([
|
|
27
|
+
checkPHPVersion(),
|
|
28
|
+
getComposerVersionTask()
|
|
29
|
+
], {
|
|
30
|
+
concurrent: true
|
|
31
|
+
})
|
|
32
|
+
},
|
|
25
33
|
statusContainers()
|
|
26
34
|
], {
|
|
27
35
|
concurrent: false,
|
package/lib/config/config.js
CHANGED
|
@@ -2,6 +2,16 @@ const Conf = require('conf');
|
|
|
2
2
|
|
|
3
3
|
const pkg = require('../../package.json');
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @typedef ProjectConfig
|
|
7
|
+
* @prop {String} [createdAt]
|
|
8
|
+
* @prop {String} [prefix]
|
|
9
|
+
* @prop {Boolean} debug
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('conf').default<Record<string, ProjectConfig>>}
|
|
14
|
+
*/
|
|
5
15
|
const projectsConfig = new Conf({
|
|
6
16
|
configName: 'projects',
|
|
7
17
|
projectName: 'create-magento-app',
|
|
@@ -10,6 +20,12 @@ const projectsConfig = new Conf({
|
|
|
10
20
|
});
|
|
11
21
|
const projectKey = process.cwd();
|
|
12
22
|
|
|
23
|
+
const setProjectConfig = (key, value) => {
|
|
24
|
+
projectsConfig.set(`${projectKey}.${key}`, value);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getProjectConfig = () => projectsConfig.get(projectKey);
|
|
28
|
+
|
|
13
29
|
const getProjectsFromProjectKeys = (path, project) => {
|
|
14
30
|
if (project.createdAt) {
|
|
15
31
|
return { [path]: project };
|
|
@@ -21,7 +37,7 @@ const getProjectsFromProjectKeys = (path, project) => {
|
|
|
21
37
|
};
|
|
22
38
|
/**
|
|
23
39
|
*
|
|
24
|
-
* @returns {Record<string,
|
|
40
|
+
* @returns {Record<string, ProjectConfig>}
|
|
25
41
|
*/
|
|
26
42
|
const getProjects = () => {
|
|
27
43
|
const projects = {};
|
|
@@ -45,5 +61,7 @@ const getProjects = () => {
|
|
|
45
61
|
module.exports = {
|
|
46
62
|
projectsConfig,
|
|
47
63
|
projectKey,
|
|
48
|
-
getProjects
|
|
64
|
+
getProjects,
|
|
65
|
+
setProjectConfig,
|
|
66
|
+
getProjectConfig
|
|
49
67
|
};
|
package/lib/config/docker.js
CHANGED
|
@@ -6,6 +6,7 @@ const { isIpAddress } = require('../util/ip');
|
|
|
6
6
|
const systeminformation = require('systeminformation');
|
|
7
7
|
const { deepmerge } = require('../util/deepmerge');
|
|
8
8
|
const defaultEsEnv = require('./services/elasticsearch/default-es-env');
|
|
9
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
*
|
|
@@ -24,7 +25,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
24
25
|
varnish
|
|
25
26
|
} = configuration;
|
|
26
27
|
|
|
27
|
-
const php = getPhpConfig(
|
|
28
|
+
const php = getPhpConfig(overridenConfiguration, baseConfig);
|
|
28
29
|
const {
|
|
29
30
|
prefix,
|
|
30
31
|
magentoDir,
|
|
@@ -53,51 +54,54 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
const
|
|
57
|
-
const { isWsl } = ctx;
|
|
58
|
-
const isNotNativeLinux = (!isLinux || isWsl);
|
|
57
|
+
const { isDockerDesktop } = ctx;
|
|
59
58
|
|
|
60
|
-
if (
|
|
59
|
+
if (isDockerDesktop) {
|
|
61
60
|
/**
|
|
62
|
-
* When CMA is running
|
|
63
|
-
* we need
|
|
61
|
+
* When CMA is running with Docker Desktop,
|
|
62
|
+
* we need create named volumes to avoid performance penalty
|
|
64
63
|
*/
|
|
65
64
|
volumes.php = {
|
|
66
65
|
name: `${ prefix }_project-data`,
|
|
66
|
+
driver: 'local',
|
|
67
67
|
opt: {
|
|
68
|
-
type: '
|
|
68
|
+
type: 'none',
|
|
69
69
|
device: path.join(magentoDir),
|
|
70
70
|
o: 'bind'
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
volumes.nginx = {
|
|
74
74
|
name: `${ prefix }_nginx-data`,
|
|
75
|
+
driver: 'local',
|
|
75
76
|
opt: {
|
|
76
|
-
type: '
|
|
77
|
+
type: 'none',
|
|
77
78
|
device: path.join(cacheDir, 'nginx', 'conf.d'),
|
|
78
79
|
o: 'bind'
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
volumes.appPub = {
|
|
82
83
|
name: `${ prefix }_pub-data`,
|
|
84
|
+
driver: 'local',
|
|
83
85
|
opt: {
|
|
84
|
-
type: '
|
|
86
|
+
type: 'none',
|
|
85
87
|
device: path.join(magentoDir, 'pub'),
|
|
86
88
|
o: 'bind'
|
|
87
89
|
}
|
|
88
90
|
};
|
|
89
91
|
volumes.appSetup = {
|
|
90
92
|
name: `${ prefix }_setup-data`,
|
|
93
|
+
driver: 'local',
|
|
91
94
|
opt: {
|
|
92
|
-
type: '
|
|
95
|
+
type: 'none',
|
|
93
96
|
device: path.join(magentoDir, 'setup'),
|
|
94
97
|
o: 'bind'
|
|
95
98
|
}
|
|
96
99
|
};
|
|
97
100
|
volumes.sslTerminator = {
|
|
98
101
|
name: `${ prefix }_ssl-terminator-data`,
|
|
102
|
+
driver: 'local',
|
|
99
103
|
opt: {
|
|
100
|
-
type: '
|
|
104
|
+
type: 'none',
|
|
101
105
|
device: path.join(cacheDir, 'ssl-terminator', 'conf.d'),
|
|
102
106
|
o: 'bind'
|
|
103
107
|
}
|
|
@@ -106,8 +110,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
106
110
|
if (varnish.enabled) {
|
|
107
111
|
volumes.varnish = {
|
|
108
112
|
name: `${ prefix }_varnish-data`,
|
|
113
|
+
driver: 'local',
|
|
109
114
|
opt: {
|
|
110
|
-
type: '
|
|
115
|
+
type: 'none',
|
|
111
116
|
device: path.join(cacheDir, 'varnish'),
|
|
112
117
|
o: 'bind'
|
|
113
118
|
}
|
|
@@ -122,21 +127,21 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
122
127
|
const dockerConfig = {
|
|
123
128
|
php: {
|
|
124
129
|
_: 'PHP',
|
|
125
|
-
ports:
|
|
130
|
+
ports: isDockerDesktop ? [
|
|
126
131
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.fpm }:9000`
|
|
127
132
|
] : [],
|
|
128
133
|
forwardedPorts: [
|
|
129
|
-
|
|
134
|
+
isDockerDesktop
|
|
130
135
|
? `127.0.0.1:${ ports.fpm }:9000`
|
|
131
136
|
: `127.0.0.1:${ ports.fpm }`
|
|
132
137
|
],
|
|
133
|
-
network:
|
|
138
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
134
139
|
mountVolumes: [
|
|
135
|
-
`${
|
|
140
|
+
`${ !isDockerDesktop ? magentoDir : volumes.php.name }:${containerMagentoDir}`,
|
|
136
141
|
`${ volumes.composer_home.name }:/composer/home`,
|
|
137
142
|
`${ php.iniPath }:/usr/local/etc/php/php.ini`,
|
|
138
143
|
`${ php.fpmConfPath }:/usr/local/etc/php-fpm.d/zz-docker.conf`
|
|
139
|
-
],
|
|
144
|
+
].concat(ctx.debug ? [`${ php.debugIniPath }:/usr/local/etc/php/conf.d/00-xdebug.ini`] : []),
|
|
140
145
|
env: {
|
|
141
146
|
COMPOSER_AUTH: JSON.stringify(JSON.parse(process.env.COMPOSER_AUTH), null, 0) || '',
|
|
142
147
|
COMPOSER_HOME: '/composer/home'
|
|
@@ -150,15 +155,15 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
150
155
|
],
|
|
151
156
|
name: `${ prefix }_php`,
|
|
152
157
|
connectCommand: ['/bin/sh'],
|
|
153
|
-
user:
|
|
158
|
+
user: ((ctx.platform === 'linux' && isDockerDesktop) || !isDockerDesktop) ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
154
159
|
},
|
|
155
160
|
sslTerminator: {
|
|
156
161
|
_: 'SSL Terminator (Nginx)',
|
|
157
|
-
ports:
|
|
162
|
+
ports: isDockerDesktop ? [
|
|
158
163
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.sslTerminator }:80`
|
|
159
164
|
] : [],
|
|
160
165
|
forwardedPorts: [
|
|
161
|
-
|
|
166
|
+
isDockerDesktop
|
|
162
167
|
? `127.0.0.1:${ ports.sslTerminator }:80`
|
|
163
168
|
: `127.0.0.1:${ ports.sslTerminator }`
|
|
164
169
|
],
|
|
@@ -169,21 +174,21 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
169
174
|
* Mount volumes directly on linux
|
|
170
175
|
*/
|
|
171
176
|
mountVolumes: [
|
|
172
|
-
`${
|
|
177
|
+
`${ !isDockerDesktop ? path.join(cacheDir, 'ssl-terminator', 'conf.d') : volumes.sslTerminator.name }:/etc/nginx/conf.d`
|
|
173
178
|
],
|
|
174
179
|
restart: 'on-failure:5',
|
|
175
|
-
network:
|
|
180
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
176
181
|
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
177
182
|
name: `${ prefix }_ssl-terminator`,
|
|
178
183
|
command: "nginx -g 'daemon off;'"
|
|
179
184
|
},
|
|
180
185
|
nginx: {
|
|
181
186
|
_: 'Nginx',
|
|
182
|
-
ports:
|
|
187
|
+
ports: isDockerDesktop ? [
|
|
183
188
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.app }:80`
|
|
184
189
|
] : [],
|
|
185
190
|
forwardedPorts: [
|
|
186
|
-
|
|
191
|
+
isDockerDesktop
|
|
187
192
|
? `127.0.0.1:${ ports.app }:80`
|
|
188
193
|
: `127.0.0.1:${ ports.app }`
|
|
189
194
|
],
|
|
@@ -193,7 +198,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
193
198
|
/**
|
|
194
199
|
* Mount volumes directly on linux
|
|
195
200
|
*/
|
|
196
|
-
mountVolumes:
|
|
201
|
+
mountVolumes: !isDockerDesktop ? [
|
|
197
202
|
`${ cacheDir }/nginx/conf.d:/etc/nginx/conf.d`,
|
|
198
203
|
`${ path.join(magentoDir, 'pub') }:${path.join(containerMagentoDir, 'pub')}`,
|
|
199
204
|
`${ path.join(magentoDir, 'setup') }:${path.join(containerMagentoDir, 'setup')}`
|
|
@@ -203,8 +208,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
203
208
|
`${ volumes.appSetup.name }:${path.join(containerMagentoDir, 'setup')}`
|
|
204
209
|
],
|
|
205
210
|
restart: 'on-failure:5',
|
|
206
|
-
|
|
207
|
-
network: isNotNativeLinux ? network.name : 'host',
|
|
211
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
208
212
|
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
209
213
|
name: `${ prefix }_nginx`,
|
|
210
214
|
command: "nginx -g 'daemon off;'"
|
|
@@ -217,7 +221,6 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
217
221
|
ports: [`127.0.0.1:${ ports.redis }:6379`],
|
|
218
222
|
forwardedPorts: [`127.0.0.1:${ ports.redis }:6379`],
|
|
219
223
|
mounts: [`source=${ volumes.redis.name },target=/data`],
|
|
220
|
-
// TODO: use connect instead
|
|
221
224
|
network: network.name,
|
|
222
225
|
image: `${ redis.version ? `redis:${ redis.version }` : redis.image }`,
|
|
223
226
|
name: `${ prefix }_redis`,
|
|
@@ -235,22 +238,18 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
235
238
|
`${ path.join(baseConfig.cacheDir, 'mariadb.cnf') }:/etc/mysql/my.cnf`
|
|
236
239
|
],
|
|
237
240
|
env: {
|
|
238
|
-
|
|
239
|
-
MARIADB_ROOT_PASSWORD: 'scandipwa',
|
|
240
|
-
MARIADB_USER: 'magento',
|
|
241
|
-
MARIADB_PASSWORD: 'magento',
|
|
242
|
-
MARIADB_DATABASE: 'magento'
|
|
241
|
+
MARIADB_ROOT_PASSWORD: 'scandipwa'
|
|
243
242
|
},
|
|
244
|
-
command:
|
|
245
|
-
'--log_bin_trust_function_creators=1'
|
|
246
|
-
]
|
|
247
|
-
.join(' '),
|
|
243
|
+
command: '--log_bin_trust_function_creators=1',
|
|
248
244
|
securityOptions: [
|
|
249
245
|
'seccomp=unconfined'
|
|
250
246
|
],
|
|
251
247
|
network: network.name,
|
|
252
248
|
image: `${ mariadb.version ? `mariadb:${ mariadb.version }` : mariadb.image }`,
|
|
253
|
-
name: `${ prefix }_mariadb
|
|
249
|
+
name: `${ prefix }_mariadb`,
|
|
250
|
+
description: `To connect to MariaDB you can use the following users:
|
|
251
|
+
- ${ logger.style.command('root') }@${ logger.style.command('scandipwa') }
|
|
252
|
+
- ${ logger.style.command('magento') }@${ logger.style.command('magento') }`
|
|
254
253
|
},
|
|
255
254
|
elasticsearch: {
|
|
256
255
|
_: 'ElasticSearch',
|
|
@@ -284,13 +283,13 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
284
283
|
image: `${ varnish.version ? `varnish:${ varnish.version }` : varnish.image }`,
|
|
285
284
|
name: `${ prefix }_varnish`,
|
|
286
285
|
mountVolumes: [
|
|
287
|
-
`${
|
|
286
|
+
`${ !isDockerDesktop ? path.join(cacheDir, 'varnish') : volumes.varnish.name }:/etc/varnish`
|
|
288
287
|
],
|
|
289
|
-
ports:
|
|
288
|
+
ports: isDockerDesktop ? [
|
|
290
289
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.varnish }:80`
|
|
291
290
|
] : [],
|
|
292
291
|
forwardedPorts: [
|
|
293
|
-
|
|
292
|
+
isDockerDesktop
|
|
294
293
|
? `127.0.0.1:${ ports.varnish }:80`
|
|
295
294
|
: `127.0.0.1:${ ports.varnish }`
|
|
296
295
|
],
|
|
@@ -298,9 +297,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
298
297
|
VARNISH_SIZE: '2G'
|
|
299
298
|
},
|
|
300
299
|
restart: 'on-failure:30',
|
|
301
|
-
network:
|
|
300
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
302
301
|
// eslint-disable-next-line max-len
|
|
303
|
-
command: `/bin/bash -c "varnishd -a :${
|
|
302
|
+
command: `/bin/bash -c "varnishd -a :${ isDockerDesktop ? 80 : ports.varnish } -t 600 -f /etc/varnish/default.vcl -s Cache=malloc,2048m -s Transient=malloc,512m -p http_resp_hdr_len=70000 -p http_resp_size=100000 && varnishlog"`,
|
|
304
303
|
tmpfs: [
|
|
305
304
|
'/var/lib/varnish:exec'
|
|
306
305
|
]
|
package/lib/config/index.js
CHANGED
|
@@ -56,7 +56,7 @@ module.exports = {
|
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
return {
|
|
59
|
-
php: getPhpConfig(overridenConfiguration
|
|
59
|
+
php: getPhpConfig(overridenConfiguration, newBaseConfig),
|
|
60
60
|
docker: await getDockerConfig(ctx, overridenConfiguration, newBaseConfig),
|
|
61
61
|
magentoConfiguration: getMagentoConfig(overridenConfiguration.magento),
|
|
62
62
|
baseConfig: newBaseConfig,
|
|
@@ -14,6 +14,7 @@ const php72 = ({
|
|
|
14
14
|
debugImage: `${ baseImage }-debug`,
|
|
15
15
|
configTemplate: path.join(templateDir || '', 'php.template.ini'),
|
|
16
16
|
fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
|
|
17
|
+
debugTemplate: path.join(templateDir || '', 'php-debug.template.ini'),
|
|
17
18
|
extensions: {
|
|
18
19
|
xdebug,
|
|
19
20
|
...extensions
|
|
@@ -14,6 +14,7 @@ const php73 = ({
|
|
|
14
14
|
debugImage: `${ baseImage }-debug`,
|
|
15
15
|
configTemplate: path.join(templateDir || '', 'php.template.ini'),
|
|
16
16
|
fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
|
|
17
|
+
debugTemplate: path.join(templateDir || '', 'php-debug.template.ini'),
|
|
17
18
|
extensions: {
|
|
18
19
|
xdebug,
|
|
19
20
|
...extensions
|
|
@@ -14,6 +14,7 @@ const php74 = ({
|
|
|
14
14
|
debugImage: `${ baseImage }-debug`,
|
|
15
15
|
configTemplate: path.join(templateDir || '', 'php.template.ini'),
|
|
16
16
|
fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
|
|
17
|
+
debugTemplate: path.join(templateDir || '', 'php-debug.template.ini'),
|
|
17
18
|
extensions: {
|
|
18
19
|
xdebug,
|
|
19
20
|
...extensions
|
|
@@ -14,6 +14,7 @@ const php81 = ({
|
|
|
14
14
|
debugImage: `${ baseImage }-debug`,
|
|
15
15
|
configTemplate: path.join(templateDir || '', 'php.template.ini'),
|
|
16
16
|
fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
|
|
17
|
+
debugTemplate: path.join(templateDir || '', 'php-debug.template.ini'),
|
|
17
18
|
extensions: {
|
|
18
19
|
xdebug,
|
|
19
20
|
...extensions
|
package/lib/config/php-config.js
CHANGED
|
@@ -5,17 +5,18 @@ const path = require('path');
|
|
|
5
5
|
* @param {import('../../typings/context').ListrContext['config']['baseConfig']} baseConfig
|
|
6
6
|
*/
|
|
7
7
|
module.exports = (overridenConfiguration, baseConfig) => {
|
|
8
|
-
const { php } = overridenConfiguration;
|
|
8
|
+
const { configuration: { php } } = overridenConfiguration;
|
|
9
9
|
|
|
10
10
|
const { cacheDir } = baseConfig;
|
|
11
11
|
|
|
12
12
|
const phpConfiguration = {
|
|
13
13
|
iniPath: path.join(cacheDir, 'php.ini'),
|
|
14
14
|
iniTemplatePath: php.configTemplate,
|
|
15
|
+
debugIniPath: path.join(cacheDir, 'xdebug.ini'),
|
|
16
|
+
debugTemplatePath: php.debugTemplate,
|
|
15
17
|
fpmTemplatePath: php.fpmConfigTemplate,
|
|
16
18
|
fpmConfPath: path.join(cacheDir, 'php-fpm.conf'),
|
|
17
|
-
extensions: php.extensions
|
|
18
|
-
version: php.version
|
|
19
|
+
extensions: php.extensions
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
return phpConfiguration;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @returns {import('../../../../../typings/index').NginxConfiguration}
|
|
5
|
+
*/
|
|
6
|
+
const nginx118 = ({ templateDir }) => ({
|
|
7
|
+
version: '1.18.0',
|
|
8
|
+
configTemplate: path.join(templateDir || '', 'nginx.template.conf')
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
module.exports = nginx118;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @returns {import('../../../../typings/index').SSLTerminatorConfiguration}
|
|
5
|
+
*/
|
|
3
6
|
const sslTerminator = ({ templateDir }) => ({
|
|
4
7
|
version: '1.18.0',
|
|
5
8
|
configTemplate: path.join(templateDir || '', 'ssl-terminator.template.conf')
|
|
@@ -2,16 +2,17 @@ RED='\033[0;31m'
|
|
|
2
2
|
GREEN='\033[0;32m'
|
|
3
3
|
NC='\033[0m' # No Color
|
|
4
4
|
|
|
5
|
-
alias
|
|
5
|
+
alias exec="node ./node_modules/.bin/magento-scripts-exec"
|
|
6
|
+
alias php="exec php php"
|
|
6
7
|
alias magento="php bin/magento"
|
|
7
8
|
alias magneto="echo -e 'Not ${RED}magneto${NC} but ${GREEN}magento${NC} please! or at least ${GREEN}m${NC}!' && magento"
|
|
8
9
|
alias m="magento"
|
|
9
|
-
alias composer="
|
|
10
|
+
alias composer="exec php composer"
|
|
10
11
|
alias c="composer"
|
|
11
12
|
<% if (it.varnishEnabled) { %>
|
|
12
|
-
alias cvc="
|
|
13
|
+
alias cvc="exec varnish varnishadm ban req.url '~ /' && echo 'Varnish cache cleared!'"
|
|
13
14
|
<% } %>
|
|
14
|
-
alias mariadb="
|
|
15
|
-
alias mariadbroot="
|
|
15
|
+
alias mariadb="exec mariadb 'mysql -umagento -pmagento'"
|
|
16
|
+
alias mariadbroot="exec mariadb 'mysql -uroot -pscandipwa'"
|
|
16
17
|
|
|
17
18
|
export BASH_SILENCE_DEPRECATION_WARNING=1
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[xdebug]
|
|
2
|
+
error_reporting=E_ALL
|
|
3
|
+
|
|
4
|
+
xdebug.idekey=PHPSTORM
|
|
5
|
+
|
|
6
|
+
<% if (it.isXDebug2) { %>
|
|
7
|
+
xdebug.remote_autostart=1
|
|
8
|
+
xdebug.remote_enable=1
|
|
9
|
+
|
|
10
|
+
xdebug.remote_host=<%~ it.hostMachine %>
|
|
11
|
+
|
|
12
|
+
xdebug.remote_port=9003
|
|
13
|
+
|
|
14
|
+
xdebug.remote_log=<%~ it.mageRoot %>/var/log/xdebug.log
|
|
15
|
+
|
|
16
|
+
<% } else { %>
|
|
17
|
+
|
|
18
|
+
xdebug.mode=debug
|
|
19
|
+
xdebug.client_host=<%~ it.hostMachine %>
|
|
20
|
+
|
|
21
|
+
xdebug.client_port=9003
|
|
22
|
+
|
|
23
|
+
; THIS THING WILL BREAK PHP
|
|
24
|
+
; xdebug.start_with_request=yes
|
|
25
|
+
|
|
26
|
+
xdebug.discover_client_host=false
|
|
27
|
+
xdebug.start_upon_error=yes
|
|
28
|
+
|
|
29
|
+
xdebug.log=<%~ it.mageRoot %>/var/log/xdebug.log
|
|
30
|
+
|
|
31
|
+
<% } %>
|
|
@@ -3,6 +3,7 @@ daemonize = no
|
|
|
3
3
|
log_level = debug
|
|
4
4
|
|
|
5
5
|
[www]
|
|
6
|
+
clear_env = no
|
|
6
7
|
user = nobody
|
|
7
8
|
;; Commented because if it is not set, php-fpm will use default group.
|
|
8
9
|
;; https://www.php.net/manual/en/install.fpm.configuration.php#group
|
|
@@ -17,5 +18,3 @@ pm.max_requests = 5000
|
|
|
17
18
|
pm.process_idle_timeout = 10s
|
|
18
19
|
pm.status_path = /fpmstatus
|
|
19
20
|
listen = <%~ it.port %>
|
|
20
|
-
|
|
21
|
-
env[PATH] = $PATH
|