@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.
Files changed (165) hide show
  1. package/exec.js +71 -0
  2. package/index.js +1 -1
  3. package/lib/commands/cli.js +7 -2
  4. package/lib/commands/execute.js +3 -58
  5. package/lib/commands/import-db.js +1 -1
  6. package/lib/commands/logs.js +1 -1
  7. package/lib/commands/start.js +18 -8
  8. package/lib/commands/status.js +9 -1
  9. package/lib/config/config.js +20 -2
  10. package/lib/config/docker.js +79 -85
  11. package/lib/config/index.js +2 -2
  12. package/lib/config/php/versions/php-7.2.js +1 -0
  13. package/lib/config/php/versions/php-7.3.js +1 -0
  14. package/lib/config/php/versions/php-7.4.js +1 -0
  15. package/lib/config/php/versions/php-8.1.js +1 -0
  16. package/lib/config/php-config.js +4 -3
  17. package/lib/config/port-config.js +1 -1
  18. package/lib/config/services/composer/versions/composer-1.js +8 -0
  19. package/lib/config/services/composer/versions/composer-2.js +8 -0
  20. package/lib/config/services/composer/versions/index.js +4 -0
  21. package/lib/config/services/elasticsearch/base-repo.js +3 -0
  22. package/lib/config/services/elasticsearch/default-es-env.js +6 -0
  23. package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
  24. package/lib/config/services/elasticsearch/versions/index.js +5 -0
  25. package/lib/config/services/nginx/versions/index.js +3 -0
  26. package/lib/config/services/nginx/versions/nginx-1.18.js +11 -0
  27. package/lib/config/{ssl-terminator → services/ssl-terminator}/index.js +3 -0
  28. package/lib/config/templates/magentorc.template +6 -5
  29. package/lib/config/templates/mariadb.template.cnf +191 -0
  30. package/lib/config/templates/php-debug.template.ini +31 -0
  31. package/lib/config/templates/php-fpm.template.conf +1 -2
  32. package/lib/config/templates/php.template.ini +6 -202
  33. package/lib/config/templates/ssl-terminator.template.conf +10 -3
  34. package/lib/config/templates/varnish.template.vcl +20 -13
  35. package/lib/config/varnish/varnish-6-0.js +4 -0
  36. package/lib/config/varnish/varnish-6-6.js +4 -0
  37. package/lib/config/varnish/varnish-7-0.js +4 -0
  38. package/lib/config/versions/magento-2.3.0.js +7 -12
  39. package/lib/config/versions/magento-2.3.1.js +7 -12
  40. package/lib/config/versions/magento-2.3.2-p1.js +7 -12
  41. package/lib/config/versions/magento-2.3.2-p2.js +7 -12
  42. package/lib/config/versions/magento-2.3.2.js +7 -12
  43. package/lib/config/versions/magento-2.3.3-p1.js +7 -12
  44. package/lib/config/versions/magento-2.3.3.js +7 -12
  45. package/lib/config/versions/magento-2.3.4-p1.js +7 -12
  46. package/lib/config/versions/magento-2.3.4-p2.js +7 -12
  47. package/lib/config/versions/magento-2.3.4.js +7 -12
  48. package/lib/config/versions/magento-2.3.5-p1.js +5 -9
  49. package/lib/config/versions/magento-2.3.5-p2.js +5 -9
  50. package/lib/config/versions/magento-2.3.5.js +5 -9
  51. package/lib/config/versions/magento-2.3.6-p1.js +5 -9
  52. package/lib/config/versions/magento-2.3.6.js +5 -9
  53. package/lib/config/versions/magento-2.3.7-p1.js +5 -9
  54. package/lib/config/versions/magento-2.3.7-p2.js +5 -9
  55. package/lib/config/versions/magento-2.3.7-p3.js +5 -9
  56. package/lib/config/versions/magento-2.3.7-p4.js +40 -0
  57. package/lib/config/versions/magento-2.3.7.js +5 -9
  58. package/lib/config/versions/magento-2.4.0-p1.js +5 -9
  59. package/lib/config/versions/magento-2.4.0.js +5 -9
  60. package/lib/config/versions/magento-2.4.1-p1.js +5 -9
  61. package/lib/config/versions/magento-2.4.1.js +5 -9
  62. package/lib/config/versions/magento-2.4.2-p1.js +5 -9
  63. package/lib/config/versions/magento-2.4.2-p2.js +5 -9
  64. package/lib/config/versions/magento-2.4.2.js +5 -9
  65. package/lib/config/versions/magento-2.4.3-p1.js +5 -9
  66. package/lib/config/versions/magento-2.4.3-p2.js +5 -9
  67. package/lib/config/versions/magento-2.4.3-p3.js +42 -0
  68. package/lib/config/versions/magento-2.4.3.js +5 -9
  69. package/lib/config/versions/magento-2.4.4-p1.js +42 -0
  70. package/lib/config/versions/magento-2.4.4.js +5 -9
  71. package/lib/config/versions/magento-2.4.5.js +42 -0
  72. package/lib/tasks/cleanup.js +1 -1
  73. package/lib/tasks/composer/local-auth-json.js +1 -1
  74. package/lib/tasks/database/connect-to-database.js +120 -0
  75. package/lib/tasks/database/create-magento-database.js +21 -0
  76. package/lib/tasks/database/create-magento-user.js +50 -0
  77. package/lib/tasks/database/default-magento-database.js +3 -0
  78. package/lib/tasks/database/default-magento-user.js +7 -0
  79. package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
  80. package/lib/tasks/{mysql → database}/fix-db.js +2 -2
  81. package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +21 -20
  82. package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
  83. package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
  84. package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
  85. package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
  86. package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
  87. package/lib/tasks/{mysql → database}/index.js +2 -2
  88. package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
  89. package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
  90. package/lib/tasks/docker/api.d.ts +25 -1
  91. package/lib/tasks/docker/api.js +31 -1
  92. package/lib/tasks/docker/containers/container-api.d.ts +18 -0
  93. package/lib/tasks/docker/containers/container-api.js +76 -17
  94. package/lib/tasks/docker/containers/tasks.js +32 -1
  95. package/lib/tasks/docker/convert-legacy-volumes.js +8 -7
  96. package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
  97. package/lib/tasks/docker/index.js +6 -1
  98. package/lib/tasks/docker/network/network-api.d.ts +1 -1
  99. package/lib/tasks/docker/project-image-builder.js +7 -9
  100. package/lib/tasks/docker/volume/index.js +9 -0
  101. package/lib/tasks/docker/volume/tasks.js +94 -0
  102. package/lib/tasks/docker/volume/volume-api.d.ts +49 -0
  103. package/lib/tasks/docker/volume/volume-api.js +90 -0
  104. package/lib/tasks/execute.js +100 -0
  105. package/lib/tasks/file-system/create-mariadb-config.js +23 -0
  106. package/lib/tasks/file-system/create-nginx-config.js +3 -5
  107. package/lib/tasks/file-system/create-php-config.js +2 -23
  108. package/lib/tasks/file-system/create-php-debug-config.js +45 -0
  109. package/lib/tasks/file-system/create-php-fpm-config.js +2 -4
  110. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +1 -1
  111. package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -7
  112. package/lib/tasks/file-system/create-varnish-config.js +4 -7
  113. package/lib/tasks/file-system/index.js +5 -1
  114. package/lib/tasks/import-dump.js +6 -6
  115. package/lib/tasks/link.js +4 -2
  116. package/lib/tasks/magento/enable-magento-composer-plugins.js +85 -30
  117. package/lib/tasks/magento/install-magento-project.js +3 -2
  118. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +3 -5
  119. package/lib/tasks/magento/setup-magento/create-admin.js +1 -1
  120. package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
  121. package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
  122. package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
  123. package/lib/tasks/magento/setup-magento/flush-redis-config.js +3 -6
  124. package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
  125. package/lib/tasks/magento/setup-magento/index.js +2 -0
  126. package/lib/tasks/magento/setup-magento/install-magento.js +15 -17
  127. package/lib/tasks/magento/setup-magento/migrate-database.js +5 -11
  128. package/lib/tasks/magento/setup-magento/set-base-url.js +3 -3
  129. package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
  130. package/lib/tasks/magento/setup-magento/varnish-config.js +8 -13
  131. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +17 -16
  132. package/lib/tasks/php/php-container.js +7 -3
  133. package/lib/tasks/php/update-env-php.js +7 -6
  134. package/lib/tasks/php/update-env.php +12 -12
  135. package/lib/tasks/requirements/composer-credentials.js +7 -3
  136. package/lib/tasks/requirements/docker/context.js +88 -0
  137. package/lib/tasks/requirements/docker/index.js +110 -19
  138. package/lib/tasks/requirements/docker/install.js +21 -7
  139. package/lib/tasks/requirements/docker/permissions.js +2 -11
  140. package/lib/tasks/requirements/docker/running-status.js +94 -24
  141. package/lib/tasks/requirements/docker/version.js +1 -0
  142. package/lib/tasks/requirements/index.js +0 -2
  143. package/lib/tasks/requirements/php-version.js +4 -2
  144. package/lib/tasks/start.js +32 -31
  145. package/lib/tasks/status/index.js +17 -13
  146. package/lib/tasks/stop.js +2 -0
  147. package/lib/tasks/theme/link-theme.js +2 -2
  148. package/lib/util/config-file-validator.js +29 -13
  149. package/lib/util/database.js +7 -7
  150. package/lib/util/execute-in-container.js +63 -0
  151. package/lib/util/prefix.js +1 -1
  152. package/lib/util/systemctl.js +62 -13
  153. package/package.json +4 -3
  154. package/typings/context.d.ts +12 -5
  155. package/typings/index.d.ts +69 -31
  156. package/lib/tasks/docker/volumes.js +0 -63
  157. package/lib/tasks/execute/index.js +0 -23
  158. package/lib/tasks/mysql/connect-to-mysql.js +0 -127
  159. package/lib/tasks/mysql/create-magento-database.js +0 -18
  160. package/lib/tasks/requirements/dependency/arch.js +0 -50
  161. package/lib/tasks/requirements/dependency/centos.js +0 -36
  162. package/lib/tasks/requirements/dependency/fedora.js +0 -36
  163. package/lib/tasks/requirements/dependency/index.js +0 -33
  164. package/lib/tasks/requirements/dependency/mac.js +0 -124
  165. package/lib/tasks/requirements/dependency/ubuntu.js +0 -83
@@ -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(configuration, baseConfig);
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
- mysql: {
41
- name: `${ prefix }_mysql-data`
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 isLinux = ctx.platform === 'linux';
52
- const { isWsl } = ctx;
53
- const isNotNativeLinux = (!isLinux || isWsl);
57
+ const { isDockerDesktop } = ctx;
54
58
 
55
- if (!isLinux) {
59
+ if (isDockerDesktop) {
56
60
  /**
57
- * When CMA is running in non-native linux environment,
58
- * we need also create named volumes for nginx to avoid performance penalty
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
- opts: {
63
- type: 'nfs',
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
- opts: {
71
- type: 'nfs',
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
- opts: {
79
- type: 'nfs',
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
- opts: {
87
- type: 'nfs',
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
- opts: {
95
- type: 'nfs',
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
- opts: {
105
- type: 'nfs',
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: isNotNativeLinux ? [
130
+ ports: isDockerDesktop ? [
121
131
  `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.fpm }:9000`
122
132
  ] : [],
123
133
  forwardedPorts: [
124
- isNotNativeLinux
134
+ isDockerDesktop
125
135
  ? `127.0.0.1:${ ports.fpm }:9000`
126
136
  : `127.0.0.1:${ ports.fpm }`
127
137
  ],
128
- network: isNotNativeLinux ? network.name : 'host',
138
+ network: isDockerDesktop ? network.name : 'host',
129
139
  mountVolumes: [
130
- `${ isLinux ? magentoDir : volumes.php.name }:${containerMagentoDir}`,
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: isLinux ? `${os.userInfo().uid}:${os.userInfo().gid}` : ''
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: isNotNativeLinux ? [
162
+ ports: isDockerDesktop ? [
151
163
  `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.sslTerminator }:80`
152
164
  ] : [],
153
165
  forwardedPorts: [
154
- isNotNativeLinux
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
- `${ isLinux ? path.join(cacheDir, 'ssl-terminator', 'conf.d') : volumes.sslTerminator.name }:/etc/nginx/conf.d`
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: isNotNativeLinux ? network.name : 'host',
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: isNotNativeLinux ? [
187
+ ports: isDockerDesktop ? [
176
188
  `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.app }:80`
177
189
  ] : [],
178
190
  forwardedPorts: [
179
- isNotNativeLinux
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: isLinux ? [
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
- // TODO: use connect instead
200
- network: isNotNativeLinux ? network.name : 'host',
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
- mysql: {
229
+ mariadb: {
224
230
  _: 'MariaDB',
225
231
  healthCheck: {
226
232
  cmd: 'mysqladmin ping --silent'
227
233
  },
228
- ports: [`127.0.0.1:${ ports.mysql }:3306`],
229
- forwardedPorts: [`127.0.0.1:${ ports.mysql }:3306`],
230
- mounts: [`source=${ volumes.mysql.name },target=/var/lib/mysql`],
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
- MYSQL_PORT: 3306,
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
- 'bootstrap.memory_lock': true,
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
- 'xpack.ml.enabled': ['sse4.2', 'sse4_2'].some((sse42Flag) => cpuSupportedFlags.includes(sse42Flag))
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.nginx.ports.push(
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
- `${ isLinux ? path.join(cacheDir, 'varnish') : volumes.varnish.name }:/etc/varnish`
286
+ `${ !isDockerDesktop ? path.join(cacheDir, 'varnish') : volumes.varnish.name }:/etc/varnish`
293
287
  ],
294
- ports: isNotNativeLinux ? [
288
+ ports: isDockerDesktop ? [
295
289
  `${ isIpAddress(host) ? host : '127.0.0.1' }:${ ports.varnish }:80`
296
290
  ] : [],
297
291
  forwardedPorts: [
298
- isNotNativeLinux
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: isNotNativeLinux ? network.name : 'host',
300
+ network: isDockerDesktop ? network.name : 'host',
307
301
  // eslint-disable-next-line max-len
308
- command: `/bin/bash -c "varnishd -a :${ isNotNativeLinux ? 80 : ports.varnish } -t 600 -f /etc/varnish/default.vcl -s malloc,512m -p http_resp_hdr_len=70000 -p http_resp_size=100000 && varnishlog"`,
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
  ]
@@ -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: '/var/www/html',
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.configuration, newBaseConfig),
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
@@ -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;
@@ -58,7 +58,7 @@ const defaultPorts = {
58
58
  varnish: 8080,
59
59
  sslTerminator: 80,
60
60
  fpm: 9000,
61
- mysql: 3306,
61
+ mariadb: 3306,
62
62
  redis: 6379,
63
63
  elasticsearch: 9200
64
64
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').ComposerConfiguration}
3
+ */
4
+ const composer1 = () => ({
5
+ version: '1'
6
+ });
7
+
8
+ module.exports = composer1;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @returns {import('../../../../../typings/index').ComposerConfiguration}
3
+ */
4
+ const composer2 = () => ({
5
+ version: '2'
6
+ });
7
+
8
+ module.exports = composer2;
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ composer1: require('./composer-1'),
3
+ composer2: require('./composer-2')
4
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ repo: 'ghcr.io/scandipwa/create-magento-app'
3
+ };
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ 'bootstrap.memory_lock': true,
3
+ 'xpack.security.enabled': false,
4
+ 'discovery.type': 'single-node',
5
+ ES_JAVA_OPTS: '-Xms512m -Xmx512m'
6
+ };
@@ -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,5 @@
1
+ const elasticsearch68 = require('./elasticsearch-6.8');
2
+
3
+ module.exports = {
4
+ elasticsearch68
5
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ nginx118: require('./nginx-1.18')
3
+ };
@@ -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 php="npm run exec php php"
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="npm run exec php composer"
10
+ alias composer="exec php composer"
10
11
  alias c="composer"
11
12
  <% if (it.varnishEnabled) { %>
12
- alias cvc="npm run exec varnish varnishadm ban req.url '~ /' && echo 'Varnish cache cleared!'"
13
+ alias cvc="exec varnish varnishadm ban req.url '~ /' && echo 'Varnish cache cleared!'"
13
14
  <% } %>
14
- alias mysql="npm run exec mysql 'mysql -umagento -pmagento'"
15
- alias mysqlroot="npm run exec mysql 'mysql -uroot -pscandipwa'"
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