@scandipwa/magento-scripts 2.0.0-alpha.0 → 2.0.0-alpha.11
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/exec.js +71 -0
- package/index.js +1 -1
- package/lib/commands/cli.js +7 -2
- package/lib/commands/execute.js +3 -58
- package/lib/commands/import-db.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/start.js +18 -8
- package/lib/commands/status.js +9 -1
- package/lib/config/config.js +20 -2
- package/lib/config/docker.js +79 -85
- package/lib/config/index.js +2 -2
- 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/port-config.js +1 -1
- 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/elasticsearch/base-repo.js +3 -0
- package/lib/config/services/elasticsearch/default-es-env.js +6 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
- package/lib/config/services/elasticsearch/versions/index.js +5 -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/mariadb.template.cnf +191 -0
- 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 +6 -202
- package/lib/config/templates/ssl-terminator.template.conf +10 -3
- 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 +7 -12
- package/lib/config/versions/magento-2.3.1.js +7 -12
- package/lib/config/versions/magento-2.3.2-p1.js +7 -12
- package/lib/config/versions/magento-2.3.2-p2.js +7 -12
- package/lib/config/versions/magento-2.3.2.js +7 -12
- package/lib/config/versions/magento-2.3.3-p1.js +7 -12
- package/lib/config/versions/magento-2.3.3.js +7 -12
- package/lib/config/versions/magento-2.3.4-p1.js +7 -12
- package/lib/config/versions/magento-2.3.4-p2.js +7 -12
- package/lib/config/versions/magento-2.3.4.js +7 -12
- 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 +40 -0
- 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 +42 -0
- package/lib/config/versions/magento-2.4.3.js +5 -9
- package/lib/config/versions/magento-2.4.4-p1.js +42 -0
- package/lib/config/versions/magento-2.4.4.js +5 -9
- package/lib/config/versions/magento-2.4.5.js +42 -0
- package/lib/tasks/cleanup.js +1 -1
- package/lib/tasks/composer/local-auth-json.js +1 -1
- package/lib/tasks/database/connect-to-database.js +120 -0
- package/lib/tasks/database/create-magento-database.js +21 -0
- 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/{mysql → database}/dump-theme-config.js +3 -3
- package/lib/tasks/{mysql → database}/fix-db.js +2 -2
- package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +21 -20
- package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
- package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
- package/lib/tasks/{mysql → database}/index.js +2 -2
- package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
- package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
- 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 +18 -0
- package/lib/tasks/docker/containers/container-api.js +76 -17
- package/lib/tasks/docker/containers/tasks.js +32 -1
- package/lib/tasks/docker/convert-legacy-volumes.js +8 -7
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
- package/lib/tasks/docker/index.js +6 -1
- package/lib/tasks/docker/network/network-api.d.ts +1 -1
- package/lib/tasks/docker/project-image-builder.js +7 -9
- package/lib/tasks/docker/volume/index.js +9 -0
- package/lib/tasks/docker/volume/tasks.js +94 -0
- package/lib/tasks/docker/volume/volume-api.d.ts +49 -0
- package/lib/tasks/docker/volume/volume-api.js +90 -0
- package/lib/tasks/execute.js +100 -0
- package/lib/tasks/file-system/create-mariadb-config.js +23 -0
- 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-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +1 -1
- 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 +5 -1
- package/lib/tasks/import-dump.js +6 -6
- package/lib/tasks/link.js +4 -2
- package/lib/tasks/magento/enable-magento-composer-plugins.js +85 -30
- package/lib/tasks/magento/install-magento-project.js +3 -2
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +3 -5
- package/lib/tasks/magento/setup-magento/create-admin.js +1 -1
- package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
- package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
- package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
- package/lib/tasks/magento/setup-magento/flush-redis-config.js +3 -6
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/install-magento.js +15 -17
- package/lib/tasks/magento/setup-magento/migrate-database.js +5 -11
- package/lib/tasks/magento/setup-magento/set-base-url.js +3 -3
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
- package/lib/tasks/magento/setup-magento/varnish-config.js +8 -13
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +17 -16
- package/lib/tasks/php/php-container.js +7 -3
- package/lib/tasks/php/update-env-php.js +7 -6
- package/lib/tasks/php/update-env.php +12 -12
- 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 +110 -19
- 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 +32 -31
- package/lib/tasks/status/index.js +17 -13
- package/lib/tasks/stop.js +2 -0
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/util/config-file-validator.js +29 -13
- package/lib/util/database.js +7 -7
- package/lib/util/execute-in-container.js +63 -0
- package/lib/util/prefix.js +1 -1
- package/lib/util/systemctl.js +62 -13
- package/package.json +4 -3
- package/typings/context.d.ts +12 -5
- package/typings/index.d.ts +69 -31
- package/lib/tasks/docker/volumes.js +0 -63
- package/lib/tasks/execute/index.js +0 -23
- package/lib/tasks/mysql/connect-to-mysql.js +0 -127
- package/lib/tasks/mysql/create-magento-database.js +0 -18
- 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/config/docker.js
CHANGED
|
@@ -4,6 +4,9 @@ const getPhpConfig = require('./php-config');
|
|
|
4
4
|
const { isIpAddress } = require('../util/ip');
|
|
5
5
|
|
|
6
6
|
const systeminformation = require('systeminformation');
|
|
7
|
+
const { deepmerge } = require('../util/deepmerge');
|
|
8
|
+
const defaultEsEnv = require('./services/elasticsearch/default-es-env');
|
|
9
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
*
|
|
@@ -22,7 +25,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
22
25
|
varnish
|
|
23
26
|
} = configuration;
|
|
24
27
|
|
|
25
|
-
const php = getPhpConfig(
|
|
28
|
+
const php = getPhpConfig(overridenConfiguration, baseConfig);
|
|
26
29
|
const {
|
|
27
30
|
prefix,
|
|
28
31
|
magentoDir,
|
|
@@ -30,69 +33,75 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
30
33
|
cacheDir
|
|
31
34
|
} = baseConfig;
|
|
32
35
|
|
|
33
|
-
const cpuSupportedFlags = await systeminformation.cpuFlags();
|
|
36
|
+
const cpuSupportedFlags = (await systeminformation.cpuFlags()).split(' ');
|
|
34
37
|
|
|
35
38
|
const network = {
|
|
36
39
|
name: `${ prefix }_network`
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
const volumes = {
|
|
40
|
-
|
|
41
|
-
name: `${ prefix }
|
|
43
|
+
mariadb: {
|
|
44
|
+
name: `${ prefix }_mariadb-data`
|
|
42
45
|
},
|
|
43
46
|
redis: {
|
|
44
47
|
name: `${ prefix }_redis-data`
|
|
45
48
|
},
|
|
46
49
|
elasticsearch: {
|
|
47
50
|
name: `${ prefix }_elasticsearch-data`
|
|
51
|
+
},
|
|
52
|
+
composer_home: {
|
|
53
|
+
name: 'composer_home-data'
|
|
48
54
|
}
|
|
49
55
|
};
|
|
50
56
|
|
|
51
|
-
const
|
|
52
|
-
const { isWsl } = ctx;
|
|
53
|
-
const isNotNativeLinux = (!isLinux || isWsl);
|
|
57
|
+
const { isDockerDesktop } = ctx;
|
|
54
58
|
|
|
55
|
-
if (
|
|
59
|
+
if (isDockerDesktop) {
|
|
56
60
|
/**
|
|
57
|
-
* When CMA is running
|
|
58
|
-
* we need
|
|
61
|
+
* When CMA is running with Docker Desktop,
|
|
62
|
+
* we need create named volumes to avoid performance penalty
|
|
59
63
|
*/
|
|
60
64
|
volumes.php = {
|
|
61
65
|
name: `${ prefix }_project-data`,
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
driver: 'local',
|
|
67
|
+
opt: {
|
|
68
|
+
type: 'none',
|
|
64
69
|
device: path.join(magentoDir),
|
|
65
70
|
o: 'bind'
|
|
66
71
|
}
|
|
67
72
|
};
|
|
68
73
|
volumes.nginx = {
|
|
69
74
|
name: `${ prefix }_nginx-data`,
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
driver: 'local',
|
|
76
|
+
opt: {
|
|
77
|
+
type: 'none',
|
|
72
78
|
device: path.join(cacheDir, 'nginx', 'conf.d'),
|
|
73
79
|
o: 'bind'
|
|
74
80
|
}
|
|
75
81
|
};
|
|
76
82
|
volumes.appPub = {
|
|
77
83
|
name: `${ prefix }_pub-data`,
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
driver: 'local',
|
|
85
|
+
opt: {
|
|
86
|
+
type: 'none',
|
|
80
87
|
device: path.join(magentoDir, 'pub'),
|
|
81
88
|
o: 'bind'
|
|
82
89
|
}
|
|
83
90
|
};
|
|
84
91
|
volumes.appSetup = {
|
|
85
92
|
name: `${ prefix }_setup-data`,
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
driver: 'local',
|
|
94
|
+
opt: {
|
|
95
|
+
type: 'none',
|
|
88
96
|
device: path.join(magentoDir, 'setup'),
|
|
89
97
|
o: 'bind'
|
|
90
98
|
}
|
|
91
99
|
};
|
|
92
100
|
volumes.sslTerminator = {
|
|
93
101
|
name: `${ prefix }_ssl-terminator-data`,
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
driver: 'local',
|
|
103
|
+
opt: {
|
|
104
|
+
type: 'none',
|
|
96
105
|
device: path.join(cacheDir, 'ssl-terminator', 'conf.d'),
|
|
97
106
|
o: 'bind'
|
|
98
107
|
}
|
|
@@ -101,8 +110,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
101
110
|
if (varnish.enabled) {
|
|
102
111
|
volumes.varnish = {
|
|
103
112
|
name: `${ prefix }_varnish-data`,
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
driver: 'local',
|
|
114
|
+
opt: {
|
|
115
|
+
type: 'none',
|
|
106
116
|
device: path.join(cacheDir, 'varnish'),
|
|
107
117
|
o: 'bind'
|
|
108
118
|
}
|
|
@@ -117,22 +127,24 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
117
127
|
const dockerConfig = {
|
|
118
128
|
php: {
|
|
119
129
|
_: 'PHP',
|
|
120
|
-
ports:
|
|
130
|
+
ports: isDockerDesktop ? [
|
|
121
131
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.fpm }:9000`
|
|
122
132
|
] : [],
|
|
123
133
|
forwardedPorts: [
|
|
124
|
-
|
|
134
|
+
isDockerDesktop
|
|
125
135
|
? `127.0.0.1:${ ports.fpm }:9000`
|
|
126
136
|
: `127.0.0.1:${ ports.fpm }`
|
|
127
137
|
],
|
|
128
|
-
network:
|
|
138
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
129
139
|
mountVolumes: [
|
|
130
|
-
`${
|
|
140
|
+
`${ !isDockerDesktop ? magentoDir : volumes.php.name }:${containerMagentoDir}`,
|
|
141
|
+
`${ volumes.composer_home.name }:/composer/home`,
|
|
131
142
|
`${ php.iniPath }:/usr/local/etc/php/php.ini`,
|
|
132
143
|
`${ php.fpmConfPath }:/usr/local/etc/php-fpm.d/zz-docker.conf`
|
|
133
|
-
],
|
|
144
|
+
].concat(ctx.debug ? [`${ php.debugIniPath }:/usr/local/etc/php/conf.d/00-xdebug.ini`] : []),
|
|
134
145
|
env: {
|
|
135
|
-
COMPOSER_AUTH: process.env.COMPOSER_AUTH || ''
|
|
146
|
+
COMPOSER_AUTH: JSON.stringify(JSON.parse(process.env.COMPOSER_AUTH), null, 0) || '',
|
|
147
|
+
COMPOSER_HOME: '/composer/home'
|
|
136
148
|
},
|
|
137
149
|
restart: 'on-failure:5',
|
|
138
150
|
image: `local-cma-project:${ prefix }`,
|
|
@@ -143,15 +155,15 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
143
155
|
],
|
|
144
156
|
name: `${ prefix }_php`,
|
|
145
157
|
connectCommand: ['/bin/sh'],
|
|
146
|
-
user:
|
|
158
|
+
user: ((ctx.platform === 'linux' && isDockerDesktop) || !isDockerDesktop) ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
|
|
147
159
|
},
|
|
148
160
|
sslTerminator: {
|
|
149
161
|
_: 'SSL Terminator (Nginx)',
|
|
150
|
-
ports:
|
|
162
|
+
ports: isDockerDesktop ? [
|
|
151
163
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.sslTerminator }:80`
|
|
152
164
|
] : [],
|
|
153
165
|
forwardedPorts: [
|
|
154
|
-
|
|
166
|
+
isDockerDesktop
|
|
155
167
|
? `127.0.0.1:${ ports.sslTerminator }:80`
|
|
156
168
|
: `127.0.0.1:${ ports.sslTerminator }`
|
|
157
169
|
],
|
|
@@ -162,21 +174,21 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
162
174
|
* Mount volumes directly on linux
|
|
163
175
|
*/
|
|
164
176
|
mountVolumes: [
|
|
165
|
-
`${
|
|
177
|
+
`${ !isDockerDesktop ? path.join(cacheDir, 'ssl-terminator', 'conf.d') : volumes.sslTerminator.name }:/etc/nginx/conf.d`
|
|
166
178
|
],
|
|
167
179
|
restart: 'on-failure:5',
|
|
168
|
-
network:
|
|
169
|
-
image: `nginx:${ nginx.version }`,
|
|
180
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
181
|
+
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
170
182
|
name: `${ prefix }_ssl-terminator`,
|
|
171
183
|
command: "nginx -g 'daemon off;'"
|
|
172
184
|
},
|
|
173
185
|
nginx: {
|
|
174
186
|
_: 'Nginx',
|
|
175
|
-
ports:
|
|
187
|
+
ports: isDockerDesktop ? [
|
|
176
188
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.app }:80`
|
|
177
189
|
] : [],
|
|
178
190
|
forwardedPorts: [
|
|
179
|
-
|
|
191
|
+
isDockerDesktop
|
|
180
192
|
? `127.0.0.1:${ ports.app }:80`
|
|
181
193
|
: `127.0.0.1:${ ports.app }`
|
|
182
194
|
],
|
|
@@ -186,7 +198,7 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
186
198
|
/**
|
|
187
199
|
* Mount volumes directly on linux
|
|
188
200
|
*/
|
|
189
|
-
mountVolumes:
|
|
201
|
+
mountVolumes: !isDockerDesktop ? [
|
|
190
202
|
`${ cacheDir }/nginx/conf.d:/etc/nginx/conf.d`,
|
|
191
203
|
`${ path.join(magentoDir, 'pub') }:${path.join(containerMagentoDir, 'pub')}`,
|
|
192
204
|
`${ path.join(magentoDir, 'setup') }:${path.join(containerMagentoDir, 'setup')}`
|
|
@@ -196,9 +208,8 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
196
208
|
`${ volumes.appSetup.name }:${path.join(containerMagentoDir, 'setup')}`
|
|
197
209
|
],
|
|
198
210
|
restart: 'on-failure:5',
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
image: `nginx:${ nginx.version }`,
|
|
211
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
212
|
+
image: `${ nginx.version ? `nginx:${ nginx.version }` : nginx.image }`,
|
|
202
213
|
name: `${ prefix }_nginx`,
|
|
203
214
|
command: "nginx -g 'daemon off;'"
|
|
204
215
|
},
|
|
@@ -210,50 +221,35 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
210
221
|
ports: [`127.0.0.1:${ ports.redis }:6379`],
|
|
211
222
|
forwardedPorts: [`127.0.0.1:${ ports.redis }:6379`],
|
|
212
223
|
mounts: [`source=${ volumes.redis.name },target=/data`],
|
|
213
|
-
// TODO: use connect instead
|
|
214
224
|
network: network.name,
|
|
215
|
-
image: `redis:${ redis.version }`,
|
|
216
|
-
imageDetails: {
|
|
217
|
-
name: 'redis',
|
|
218
|
-
tag: redis.version
|
|
219
|
-
},
|
|
225
|
+
image: `${ redis.version ? `redis:${ redis.version }` : redis.image }`,
|
|
220
226
|
name: `${ prefix }_redis`,
|
|
221
227
|
connectCommand: ['redis-cli']
|
|
222
228
|
},
|
|
223
|
-
|
|
229
|
+
mariadb: {
|
|
224
230
|
_: 'MariaDB',
|
|
225
231
|
healthCheck: {
|
|
226
232
|
cmd: 'mysqladmin ping --silent'
|
|
227
233
|
},
|
|
228
|
-
ports: [`127.0.0.1:${ ports.
|
|
229
|
-
forwardedPorts: [`127.0.0.1:${ ports.
|
|
230
|
-
|
|
234
|
+
ports: [`127.0.0.1:${ ports.mariadb }:3306`],
|
|
235
|
+
forwardedPorts: [`127.0.0.1:${ ports.mariadb }:3306`],
|
|
236
|
+
mountVolumes: [
|
|
237
|
+
`${ volumes.mariadb.name }:/var/lib/mysql`,
|
|
238
|
+
`${ path.join(baseConfig.cacheDir, 'mariadb.cnf') }:/etc/mysql/my.cnf`
|
|
239
|
+
],
|
|
231
240
|
env: {
|
|
232
|
-
|
|
233
|
-
MYSQL_ROOT_PASSWORD: 'scandipwa',
|
|
234
|
-
MYSQL_USER: 'magento',
|
|
235
|
-
MYSQL_PASSWORD: 'magento',
|
|
236
|
-
MYSQL_DATABASE: 'magento'
|
|
241
|
+
MARIADB_ROOT_PASSWORD: 'scandipwa'
|
|
237
242
|
},
|
|
238
|
-
|
|
239
|
-
* When database dump contains functions, MySQL can throw and error "access denied for those functions"
|
|
240
|
-
* so to overcome this issue, we need to enable trust option for these functions to avoid errors during migrations.
|
|
241
|
-
*
|
|
242
|
-
* Documentation reference: https://dev.mysql.com/doc/refman/5.7/en/stored-programs-logging.html
|
|
243
|
-
*/
|
|
244
|
-
command: [
|
|
245
|
-
'--log_bin_trust_function_creators=1',
|
|
246
|
-
'--default-authentication-plugin=mysql_native_password',
|
|
247
|
-
'--max_allowed_packet=1GB',
|
|
248
|
-
'--bind-address=0.0.0.0'
|
|
249
|
-
]
|
|
250
|
-
.join(' '),
|
|
243
|
+
command: '--log_bin_trust_function_creators=1',
|
|
251
244
|
securityOptions: [
|
|
252
245
|
'seccomp=unconfined'
|
|
253
246
|
],
|
|
254
247
|
network: network.name,
|
|
255
|
-
image: `mariadb:${ mariadb.version }`,
|
|
256
|
-
name: `${ prefix }_mariadb
|
|
248
|
+
image: `${ mariadb.version ? `mariadb:${ mariadb.version }` : mariadb.image }`,
|
|
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') }`
|
|
257
253
|
},
|
|
258
254
|
elasticsearch: {
|
|
259
255
|
_: 'ElasticSearch',
|
|
@@ -263,22 +259,20 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
263
259
|
ports: [`127.0.0.1:${ ports.elasticsearch }:9200`],
|
|
264
260
|
forwardedPorts: [`127.0.0.1:${ ports.elasticsearch }:9200`],
|
|
265
261
|
mounts: [`source=${ volumes.elasticsearch.name },target=/usr/share/elasticsearch/data`],
|
|
266
|
-
env:
|
|
267
|
-
|
|
268
|
-
'xpack.security.enabled': false,
|
|
269
|
-
'discovery.type': 'single-node',
|
|
270
|
-
ES_JAVA_OPTS: '-Xms512m -Xmx512m',
|
|
262
|
+
env: deepmerge(
|
|
263
|
+
{
|
|
271
264
|
// https://www.elastic.co/guide/en/elasticsearch/reference/master/ml-settings.html
|
|
272
|
-
|
|
273
|
-
|
|
265
|
+
'xpack.ml.enabled': ['sse4.2', 'sse4_2'].some((sse42Flag) => cpuSupportedFlags.includes(sse42Flag))
|
|
266
|
+
}, elasticsearch.env || defaultEsEnv
|
|
267
|
+
),
|
|
274
268
|
network: network.name,
|
|
275
|
-
image: `elasticsearch:${ elasticsearch.version }`,
|
|
269
|
+
image: `${ elasticsearch.version ? `elasticsearch:${ elasticsearch.version }` : elasticsearch.image }`,
|
|
276
270
|
name: `${ prefix }_elasticsearch`
|
|
277
271
|
}
|
|
278
272
|
};
|
|
279
273
|
|
|
280
274
|
if (ssl.enabled) {
|
|
281
|
-
dockerConfig.
|
|
275
|
+
dockerConfig.sslTerminator.ports.push(
|
|
282
276
|
`${isIpAddress(host) ? host : '127.0.0.1'}:443:443`
|
|
283
277
|
);
|
|
284
278
|
}
|
|
@@ -286,16 +280,16 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
286
280
|
if (!ctx.debug && varnish.enabled) {
|
|
287
281
|
dockerConfig.varnish = {
|
|
288
282
|
_: 'Varnish',
|
|
289
|
-
image: `varnish:${ varnish.version }`,
|
|
283
|
+
image: `${ varnish.version ? `varnish:${ varnish.version }` : varnish.image }`,
|
|
290
284
|
name: `${ prefix }_varnish`,
|
|
291
285
|
mountVolumes: [
|
|
292
|
-
`${
|
|
286
|
+
`${ !isDockerDesktop ? path.join(cacheDir, 'varnish') : volumes.varnish.name }:/etc/varnish`
|
|
293
287
|
],
|
|
294
|
-
ports:
|
|
288
|
+
ports: isDockerDesktop ? [
|
|
295
289
|
`${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.varnish }:80`
|
|
296
290
|
] : [],
|
|
297
291
|
forwardedPorts: [
|
|
298
|
-
|
|
292
|
+
isDockerDesktop
|
|
299
293
|
? `127.0.0.1:${ ports.varnish }:80`
|
|
300
294
|
: `127.0.0.1:${ ports.varnish }`
|
|
301
295
|
],
|
|
@@ -303,9 +297,9 @@ module.exports = async (ctx, overridenConfiguration, baseConfig) => {
|
|
|
303
297
|
VARNISH_SIZE: '2G'
|
|
304
298
|
},
|
|
305
299
|
restart: 'on-failure:30',
|
|
306
|
-
network:
|
|
300
|
+
network: isDockerDesktop ? network.name : 'host',
|
|
307
301
|
// eslint-disable-next-line max-len
|
|
308
|
-
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"`,
|
|
309
303
|
tmpfs: [
|
|
310
304
|
'/var/lib/varnish:exec'
|
|
311
305
|
]
|
package/lib/config/index.js
CHANGED
|
@@ -19,7 +19,7 @@ const darwinMinimalVersion = '10.5';
|
|
|
19
19
|
const getBaseConfig = (projectPath = process.cwd(), prefix = folderName) => ({
|
|
20
20
|
prefix: getPrefix(prefix),
|
|
21
21
|
magentoDir: projectPath,
|
|
22
|
-
containerMagentoDir:
|
|
22
|
+
containerMagentoDir: projectPath,
|
|
23
23
|
templateDir: path.join(__dirname, 'templates'),
|
|
24
24
|
cacheDir: path.join(projectPath, 'node_modules', '.create-magento-app-cache')
|
|
25
25
|
});
|
|
@@ -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,19 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const { getArchSync } = require('../../../../util/arch');
|
|
3
|
+
const { deepmerge } = require('../../../../util/deepmerge');
|
|
4
|
+
const { repo } = require('../base-repo');
|
|
5
|
+
const defaultEnv = require('../default-es-env');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @returns {import('../../../../../typings/index').ServiceWithImage}
|
|
9
|
+
*/
|
|
10
|
+
const elasticsearch68 = ({
|
|
11
|
+
image = `${ repo }:elasticsearch-6.8`
|
|
12
|
+
} = {}) => ({
|
|
13
|
+
image,
|
|
14
|
+
env: deepmerge(defaultEnv, os.platform() === 'darwin' && getArchSync() === 'arm64' ? {
|
|
15
|
+
'xpack.ml.enabled': false
|
|
16
|
+
} : {})
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
module.exports = elasticsearch68;
|
|
@@ -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
|
|
15
|
-
alias
|
|
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
|