@scandipwa/magento-scripts 1.16.0 → 2.0.0-alpha.1

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 (225) hide show
  1. package/lib/commands/cli.js +4 -6
  2. package/lib/commands/execute.js +29 -4
  3. package/lib/commands/import-db.js +1 -1
  4. package/lib/commands/logs.js +1 -1
  5. package/lib/commands/start.js +38 -20
  6. package/lib/commands/status.js +2 -0
  7. package/lib/config/docker.js +98 -83
  8. package/lib/config/get-project-configuration.js +3 -1
  9. package/lib/config/index.js +10 -7
  10. package/lib/config/magento/required-php-extensions/index.js +29 -0
  11. package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
  12. package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
  13. package/lib/config/php/base-repo.js +3 -0
  14. package/lib/config/php/extensions/apcu.js +12 -0
  15. package/lib/config/php/extensions/bcmath.js +7 -0
  16. package/lib/config/php/extensions/curl.js +11 -0
  17. package/lib/config/php/extensions/gd.js +14 -0
  18. package/lib/config/php/extensions/index.js +18 -2
  19. package/lib/config/php/extensions/intl.js +10 -0
  20. package/lib/config/php/extensions/opcache.js +10 -0
  21. package/lib/config/php/extensions/pdo_mysql.js +7 -0
  22. package/lib/config/php/extensions/soap.js +10 -0
  23. package/lib/config/php/extensions/sodium.js +10 -0
  24. package/lib/config/php/extensions/xdebug.js +8 -5
  25. package/lib/config/php/extensions/xsl.js +10 -0
  26. package/lib/config/php/extensions/zip.js +10 -0
  27. package/lib/config/php/{releases → versions}/index.js +0 -0
  28. package/lib/config/php/versions/php-7.2.js +23 -0
  29. package/lib/config/php/versions/php-7.3.js +23 -0
  30. package/lib/config/php/versions/php-7.4.js +23 -0
  31. package/lib/config/php/versions/php-8.1.js +23 -0
  32. package/lib/config/php-config.js +8 -12
  33. package/lib/config/port-config.js +2 -6
  34. package/lib/config/services/elasticsearch/base-repo.js +3 -0
  35. package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +23 -0
  36. package/lib/config/services/elasticsearch/versions/index.js +5 -0
  37. package/lib/config/templates/magentorc.template +5 -5
  38. package/lib/config/templates/mariadb.template.cnf +191 -0
  39. package/lib/config/templates/php-fpm.template.conf +3 -3
  40. package/lib/config/templates/php.template.ini +12 -6
  41. package/lib/config/templates/ssl-terminator.template.conf +1 -1
  42. package/lib/config/templates/vscode-launch.template.json +3 -1
  43. package/lib/config/versions/magento-2.3.0.js +10 -5
  44. package/lib/config/versions/magento-2.3.1.js +10 -5
  45. package/lib/config/versions/magento-2.3.2-p1.js +43 -0
  46. package/lib/config/versions/magento-2.3.2-p2.js +10 -5
  47. package/lib/config/versions/magento-2.3.2.js +10 -5
  48. package/lib/config/versions/magento-2.3.3-p1.js +10 -5
  49. package/lib/config/versions/magento-2.3.3.js +10 -5
  50. package/lib/config/versions/magento-2.3.4-p1.js +43 -0
  51. package/lib/config/versions/magento-2.3.4-p2.js +10 -5
  52. package/lib/config/versions/magento-2.3.4.js +10 -5
  53. package/lib/config/versions/magento-2.3.5-p1.js +8 -2
  54. package/lib/config/versions/magento-2.3.5-p2.js +8 -2
  55. package/lib/config/versions/magento-2.3.5.js +8 -2
  56. package/lib/config/versions/magento-2.3.6-p1.js +8 -2
  57. package/lib/config/versions/magento-2.3.6.js +8 -2
  58. package/lib/config/versions/magento-2.3.7-p1.js +8 -2
  59. package/lib/config/versions/magento-2.3.7-p2.js +8 -2
  60. package/lib/config/versions/magento-2.3.7-p3.js +8 -2
  61. package/lib/config/versions/magento-2.3.7.js +8 -2
  62. package/lib/config/versions/magento-2.4.0-p1.js +9 -3
  63. package/lib/config/versions/magento-2.4.0.js +9 -3
  64. package/lib/config/versions/magento-2.4.1-p1.js +6 -5
  65. package/lib/config/versions/magento-2.4.1.js +9 -2
  66. package/lib/config/versions/magento-2.4.2-p1.js +6 -5
  67. package/lib/config/versions/magento-2.4.2-p2.js +6 -6
  68. package/lib/config/versions/magento-2.4.2.js +6 -6
  69. package/lib/config/versions/magento-2.4.3-p1.js +7 -7
  70. package/lib/config/versions/magento-2.4.3-p2.js +7 -7
  71. package/lib/config/versions/magento-2.4.3.js +7 -7
  72. package/lib/config/versions/magento-2.4.4.js +9 -2
  73. package/lib/tasks/cleanup.js +3 -3
  74. package/lib/tasks/composer/index.js +14 -104
  75. package/lib/tasks/database/connect-to-database.js +117 -0
  76. package/lib/tasks/database/create-magento-database.js +18 -0
  77. package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
  78. package/lib/tasks/{mysql → database}/fix-db.js +2 -2
  79. package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +65 -22
  80. package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
  81. package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
  82. package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
  83. package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
  84. package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
  85. package/lib/tasks/{mysql → database}/index.js +2 -2
  86. package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
  87. package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
  88. package/lib/tasks/docker/api.d.ts +71 -0
  89. package/lib/tasks/docker/api.js +30 -0
  90. package/lib/tasks/docker/containers/container-api.d.ts +128 -0
  91. package/lib/tasks/docker/containers/container-api.js +153 -0
  92. package/lib/tasks/docker/containers/index.js +19 -0
  93. package/lib/tasks/docker/containers/tasks.js +215 -0
  94. package/lib/tasks/docker/convert-legacy-volumes.js +15 -10
  95. package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
  96. package/lib/tasks/docker/image/image-api.d.ts +34 -0
  97. package/lib/tasks/docker/image/image-api.js +49 -0
  98. package/lib/tasks/docker/image/index.js +5 -0
  99. package/lib/tasks/docker/index.js +1 -13
  100. package/lib/tasks/docker/network/index.js +7 -0
  101. package/lib/tasks/docker/network/network-api.d.ts +103 -0
  102. package/lib/tasks/docker/network/network-api.js +99 -0
  103. package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
  104. package/lib/tasks/docker/project-image-builder.js +167 -0
  105. package/lib/tasks/docker/volume/index.js +8 -0
  106. package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
  107. package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
  108. package/lib/tasks/docker/volume/volume-api.js +66 -0
  109. package/lib/tasks/execute/index.js +5 -2
  110. package/lib/tasks/file-system/create-mariadb-config.js +23 -0
  111. package/lib/tasks/file-system/create-nginx-config.js +2 -3
  112. package/lib/tasks/file-system/create-php-config.js +20 -5
  113. package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
  114. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
  115. package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
  116. package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
  117. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
  118. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
  119. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
  120. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
  121. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
  122. package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
  123. package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
  124. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
  125. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
  126. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
  127. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
  128. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
  129. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
  130. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
  131. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
  132. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
  133. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
  134. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
  135. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
  136. package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
  137. package/lib/tasks/file-system/create-vscode-config.js +57 -42
  138. package/lib/tasks/file-system/index.js +5 -2
  139. package/lib/tasks/import-dump.js +6 -6
  140. package/lib/tasks/link.js +5 -4
  141. package/lib/tasks/magento/install-magento-project.js +31 -63
  142. package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
  143. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +7 -3
  144. package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
  145. package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
  146. package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
  147. package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
  148. package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
  149. package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
  150. package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
  151. package/lib/tasks/magento/setup-magento/index.js +3 -3
  152. package/lib/tasks/magento/setup-magento/install-magento.js +47 -40
  153. package/lib/tasks/magento/setup-magento/migrate-database.js +7 -14
  154. package/lib/tasks/magento/setup-magento/set-base-url.js +2 -2
  155. package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
  156. package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
  157. package/lib/tasks/magento/setup-magento/varnish-config.js +11 -9
  158. package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +128 -3
  159. package/lib/tasks/php/php-container.js +108 -0
  160. package/lib/tasks/php/update-env-php.js +39 -21
  161. package/lib/tasks/php/update-env.php +66 -61
  162. package/lib/tasks/php/working_health_check.php +85 -0
  163. package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
  164. package/lib/tasks/requirements/docker/index.js +15 -12
  165. package/lib/tasks/requirements/docker/performance.js +54 -0
  166. package/lib/tasks/requirements/docker/version.js +8 -8
  167. package/lib/tasks/requirements/index.js +5 -8
  168. package/lib/tasks/requirements/php-version.js +8 -116
  169. package/lib/tasks/requirements/platform.js +12 -25
  170. package/lib/tasks/start.js +24 -51
  171. package/lib/tasks/status/index.js +8 -12
  172. package/lib/tasks/stop.js +0 -2
  173. package/lib/tasks/theme/install-theme.js +1 -1
  174. package/lib/tasks/theme/link-theme.js +2 -2
  175. package/lib/tasks/theme/symlink-theme.js +2 -3
  176. package/lib/util/config-file-validator.js +27 -13
  177. package/lib/util/config-php-json.js +13 -4
  178. package/lib/util/database.js +7 -7
  179. package/lib/util/dockerfile-builder/build-instructions.js +197 -0
  180. package/lib/util/dockerfile-builder/index.js +276 -0
  181. package/lib/util/dockerfile-builder/types.d.ts +123 -0
  182. package/lib/util/env-php-json.js +10 -6
  183. package/lib/util/exec-async-command.js +3 -9
  184. package/lib/util/macos-version.js +20 -0
  185. package/lib/util/magento-task.js +3 -4
  186. package/lib/util/nginx-logs-parser.js +122 -0
  187. package/lib/util/php-task.js +3 -6
  188. package/lib/util/run-composer.js +6 -14
  189. package/lib/util/run-container-image.js +17 -0
  190. package/lib/util/run-magento.js +6 -14
  191. package/lib/util/run-php.js +6 -17
  192. package/package.json +9 -9
  193. package/typings/context.d.ts +7 -13
  194. package/typings/index.d.ts +67 -85
  195. package/yarn-error.log +9660 -0
  196. package/lib/config/composer.js +0 -11
  197. package/lib/config/php/extensions/libsodium.js +0 -36
  198. package/lib/config/php/releases/php-7.2.js +0 -25
  199. package/lib/config/php/releases/php-7.3.js +0 -25
  200. package/lib/config/php/releases/php-7.4.js +0 -23
  201. package/lib/config/php/releases/php-8.1.js +0 -25
  202. package/lib/config/phpbrew.js +0 -12
  203. package/lib/tasks/composer/install-prestissimo.js +0 -103
  204. package/lib/tasks/docker/containers.js +0 -231
  205. package/lib/tasks/mysql/connect-to-mysql.js +0 -114
  206. package/lib/tasks/mysql/create-magento-database.js +0 -18
  207. package/lib/tasks/php/bundled-extensions.js +0 -27
  208. package/lib/tasks/php/compile-options.js +0 -56
  209. package/lib/tasks/php/compile.js +0 -55
  210. package/lib/tasks/php/configure.js +0 -89
  211. package/lib/tasks/php/extensions/disable.js +0 -49
  212. package/lib/tasks/php/extensions/enable.js +0 -52
  213. package/lib/tasks/php/extensions/index.js +0 -80
  214. package/lib/tasks/php/extensions/install.js +0 -54
  215. package/lib/tasks/php/index.js +0 -79
  216. package/lib/tasks/php/install-sodium.js +0 -93
  217. package/lib/tasks/php/update-phpbrew.js +0 -45
  218. package/lib/tasks/php/validate-php.js +0 -67
  219. package/lib/tasks/php-fpm/get-process-id.js +0 -14
  220. package/lib/tasks/php-fpm/index.js +0 -4
  221. package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
  222. package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
  223. package/lib/tasks/requirements/phpbrew/index.js +0 -61
  224. package/lib/tasks/requirements/phpbrew/install.js +0 -159
  225. package/lib/tasks/requirements/phpbrew/version.js +0 -28
@@ -0,0 +1,29 @@
1
+ const magento24RequiredPHPExtensions = [
2
+ 'bcmath',
3
+ 'ctype',
4
+ 'curl',
5
+ 'dom',
6
+ 'fileinfo',
7
+ 'gd',
8
+ 'hash',
9
+ 'iconv',
10
+ 'intl',
11
+ 'json',
12
+ 'libxml',
13
+ 'mbstring',
14
+ 'openssl',
15
+ 'pcre',
16
+ 'pdo_mysql',
17
+ 'simplexml',
18
+ 'soap',
19
+ 'sockets',
20
+ 'sodium',
21
+ 'tokenizer',
22
+ 'xmlwriter',
23
+ 'xsl',
24
+ 'zip',
25
+ 'libxml',
26
+ 'openssl'
27
+ ];
28
+
29
+ module.exports = magento24RequiredPHPExtensions;
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ repo: 'ghcr.io/scandipwa/create-magento-app'
3
+ };
@@ -0,0 +1,12 @@
1
+ /* eslint-disable max-len */
2
+ /**
3
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
4
+ */
5
+ module.exports = {
6
+ name: 'apcu',
7
+ // eslint-disable-next-line quotes
8
+ command: `apk add --no-cache --virtual .build-deps \\$PHPIZE_DEPS \
9
+ && pecl install apcu \
10
+ && docker-php-ext-enable apcu \
11
+ && apk del -f .build-deps`
12
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'bcmath',
6
+ command: 'docker-php-ext-install bcmath'
7
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'curl',
6
+ command: 'docker-php-ext-install curl',
7
+ dependencies: [
8
+ 'curl-dev',
9
+ 'libcurl'
10
+ ]
11
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'gd',
6
+ command: 'docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && docker-php-ext-install gd',
7
+ dependencies: [
8
+ 'freetype-dev',
9
+ 'libjpeg-turbo-dev',
10
+ 'libpng-dev',
11
+ 'zlib-dev',
12
+ 'libwebp-dev'
13
+ ]
14
+ };
@@ -1,4 +1,20 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+
4
+ /**
5
+ * @type {Record<string, import('../../../../typings/index').PHPExtensionInstallationInstruction>}
6
+ */
7
+ const phpExtensionInstallationInstructions = fs.readdirSync(__dirname, {
8
+ withFileTypes: true
9
+ })
10
+ .filter((f) => f.isFile())
11
+ .filter((f) => f.name !== 'index.js')
12
+ .map((f) => ({
13
+ name: path.parse(f.name).name,
14
+ extension: require(path.join(__dirname, f.name))
15
+ }))
16
+ .reduce((acc, val) => ({ ...acc, [val.name]: val.extension }), {});
17
+
1
18
  module.exports = {
2
- libsodium: require('./libsodium'),
3
- xdebug: require('./xdebug')
19
+ phpExtensionInstallationInstructions
4
20
  };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'intl',
6
+ command: 'docker-php-ext-install intl',
7
+ dependencies: [
8
+ 'icu-dev'
9
+ ]
10
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'opcache',
6
+ alternativeName: [
7
+ 'Zend OPcache'
8
+ ],
9
+ command: 'docker-php-ext-install opcache'
10
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'pdo_mysql',
6
+ command: 'docker-php-ext-install pdo_mysql'
7
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'soap',
6
+ command: 'docker-php-ext-install soap',
7
+ dependencies: [
8
+ 'libxml2-dev'
9
+ ]
10
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'sodium',
6
+ command: 'docker-php-ext-install sodium',
7
+ dependencies: [
8
+ 'libsodium-dev'
9
+ ]
10
+ };
@@ -1,9 +1,12 @@
1
+ /* eslint-disable max-len */
1
2
  /**
2
- * @type {import('../../../../typings/index').PHPExtension}
3
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
4
  */
4
- const xdebugExtension = {
5
- extensionName: 'xdebug',
5
+ module.exports = {
6
+ name: 'xdebug',
7
+ command: ({ version = '' } = {}) => `apk add --no-cache --virtual .build-deps \\$PHPIZE_DEPS \
8
+ && pecl install xdebug${version ? `-${version}` : ''} \
9
+ && docker-php-ext-enable xdebug \
10
+ && apk del -f .build-deps`,
6
11
  version: '3.1.5'
7
12
  };
8
-
9
- module.exports = xdebugExtension;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'xsl',
6
+ command: 'docker-php-ext-install xsl',
7
+ dependencies: [
8
+ 'libxslt-dev'
9
+ ]
10
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @type {import('../../../../typings/index').PHPExtensionInstallationInstruction}
3
+ */
4
+ module.exports = {
5
+ name: 'zip',
6
+ command: 'docker-php-ext-install zip',
7
+ dependencies: [
8
+ 'libzip-dev'
9
+ ]
10
+ };
File without changes
@@ -0,0 +1,23 @@
1
+ const path = require('path');
2
+ const { repo } = require('../base-repo');
3
+ const xdebug = require('../extensions/xdebug');
4
+
5
+ /**
6
+ * @returns {import('../../../../typings/index').PHPConfiguration}
7
+ */
8
+ const php72 = ({
9
+ templateDir,
10
+ extensions = {},
11
+ baseImage = `${ repo }:php-7.2`
12
+ } = {}) => ({
13
+ baseImage,
14
+ debugImage: `${ baseImage }-debug`,
15
+ configTemplate: path.join(templateDir || '', 'php.template.ini'),
16
+ fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
17
+ extensions: {
18
+ xdebug,
19
+ ...extensions
20
+ }
21
+ });
22
+
23
+ module.exports = php72;
@@ -0,0 +1,23 @@
1
+ const path = require('path');
2
+ const { repo } = require('../base-repo');
3
+ const xdebug = require('../extensions/xdebug');
4
+
5
+ /**
6
+ * @returns {import('../../../../typings/index').PHPConfiguration}
7
+ */
8
+ const php73 = ({
9
+ templateDir,
10
+ extensions = {},
11
+ baseImage = `${ repo }:php-7.3`
12
+ } = {}) => ({
13
+ baseImage,
14
+ debugImage: `${ baseImage }-debug`,
15
+ configTemplate: path.join(templateDir || '', 'php.template.ini'),
16
+ fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
17
+ extensions: {
18
+ xdebug,
19
+ ...extensions
20
+ }
21
+ });
22
+
23
+ module.exports = php73;
@@ -0,0 +1,23 @@
1
+ const path = require('path');
2
+ const { repo } = require('../base-repo');
3
+ const xdebug = require('../extensions/xdebug');
4
+
5
+ /**
6
+ * @returns {import('../../../../typings/index').PHPConfiguration}
7
+ */
8
+ const php74 = ({
9
+ templateDir,
10
+ extensions = {},
11
+ baseImage = `${ repo }:php-7.4`
12
+ } = {}) => ({
13
+ baseImage,
14
+ debugImage: `${ baseImage }-debug`,
15
+ configTemplate: path.join(templateDir || '', 'php.template.ini'),
16
+ fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
17
+ extensions: {
18
+ xdebug,
19
+ ...extensions
20
+ }
21
+ });
22
+
23
+ module.exports = php74;
@@ -0,0 +1,23 @@
1
+ const path = require('path');
2
+ const { repo } = require('../base-repo');
3
+ const xdebug = require('../extensions/xdebug');
4
+
5
+ /**
6
+ * @returns {import('../../../../typings/index').PHPConfiguration}
7
+ */
8
+ const php81 = ({
9
+ templateDir,
10
+ extensions = {},
11
+ baseImage = `${ repo }:php-8.1`
12
+ } = {}) => ({
13
+ baseImage,
14
+ debugImage: `${ baseImage }-debug`,
15
+ configTemplate: path.join(templateDir || '', 'php.template.ini'),
16
+ fpmConfigTemplate: path.join(templateDir || '', 'php-fpm.template.conf'),
17
+ extensions: {
18
+ xdebug,
19
+ ...extensions
20
+ }
21
+ });
22
+
23
+ module.exports = php81;
@@ -1,23 +1,19 @@
1
1
  const path = require('path');
2
- const phpbrewConfig = require('./phpbrew');
3
2
 
4
- module.exports = (app, config) => {
5
- const { php } = app;
3
+ /**
4
+ * @param {import('../../typings/context').ListrContext['config']['overridenConfiguration']} overridenConfiguration
5
+ * @param {import('../../typings/context').ListrContext['config']['baseConfig']} baseConfig
6
+ */
7
+ module.exports = (overridenConfiguration, baseConfig) => {
8
+ const { php } = overridenConfiguration;
6
9
 
7
- const { cacheDir } = config;
8
-
9
- const phpVersionDir = path.join(
10
- phpbrewConfig.phpPath,
11
- `php-${ php.version }`
12
- );
10
+ const { cacheDir } = baseConfig;
13
11
 
14
12
  const phpConfiguration = {
15
- binPath: path.join(phpVersionDir, 'bin', 'php'),
16
13
  iniPath: path.join(cacheDir, 'php.ini'),
17
14
  iniTemplatePath: php.configTemplate,
18
- fpmBinPath: path.join(phpVersionDir, 'sbin', 'php-fpm'),
15
+ fpmTemplatePath: php.fpmConfigTemplate,
19
16
  fpmConfPath: path.join(cacheDir, 'php-fpm.conf'),
20
- fpmPidFilePath: path.join(cacheDir, 'php-fpm.pid'),
21
17
  extensions: php.extensions,
22
18
  version: php.version
23
19
  };
@@ -58,8 +58,7 @@ const defaultPorts = {
58
58
  varnish: 8080,
59
59
  sslTerminator: 80,
60
60
  fpm: 9000,
61
- xdebug: 9111,
62
- mysql: 3306,
61
+ mariadb: 3306,
63
62
  redis: 6379,
64
63
  elasticsearch: 9200
65
64
  };
@@ -74,10 +73,7 @@ const defaultPorts = {
74
73
  const getPortsConfig = async (ports, options = {}) => {
75
74
  const { useNonOverlappingPorts } = options;
76
75
  const mergedPorts = deepmerge(defaultPorts, ports || {});
77
- let p = [
78
- 9003,
79
- 9111
80
- ];
76
+ let p = [];
81
77
 
82
78
  if (useNonOverlappingPorts) {
83
79
  p = p.concat(await getUsedByOtherCMAProjectsPorts());
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ repo: 'ghcr.io/scandipwa/create-magento-app'
3
+ };
@@ -0,0 +1,23 @@
1
+ const os = require('os');
2
+ const { getArchSync } = require('../../../../util/arch');
3
+ const { deepmerge } = require('../../../../util/deepmerge');
4
+ const { repo } = require('../base-repo');
5
+
6
+ /**
7
+ * @returns {import('../../../../../typings/index').ServiceWithImage}
8
+ */
9
+ const elasticsearch68 = ({
10
+ image = `${ repo }:elasticsearch-6.8`
11
+ } = {}) => ({
12
+ image,
13
+ env: deepmerge({
14
+ 'bootstrap.memory_lock': true,
15
+ 'xpack.security.enabled': false,
16
+ 'discovery.type': 'single-node',
17
+ ES_JAVA_OPTS: '-Xms512m -Xmx512m'
18
+ }, os.platform() === 'darwin' && getArchSync() === 'arm64' ? {
19
+ 'xpack.ml.enabled': false
20
+ } : {})
21
+ });
22
+
23
+ module.exports = elasticsearch68;
@@ -0,0 +1,5 @@
1
+ const elasticsearch68 = require('./elasticsearch-6.8');
2
+
3
+ module.exports = {
4
+ elasticsearch68
5
+ };
@@ -2,16 +2,16 @@ RED='\033[0;31m'
2
2
  GREEN='\033[0;32m'
3
3
  NC='\033[0m' # No Color
4
4
 
5
- alias php="$HOME/.phpbrew/php/php-<%= it.php.version %>/bin/php -c $PWD/node_modules/.create-magento-app-cache/php.ini"
6
- alias magento="php $PWD/bin/magento"
5
+ alias php="npm run exec php php"
6
+ alias magento="php bin/magento"
7
7
  alias magneto="echo -e 'Not ${RED}magneto${NC} but ${GREEN}magento${NC} please! or at least ${GREEN}m${NC}!' && magento"
8
8
  alias m="magento"
9
- alias composer="php $PWD/node_modules/.create-magento-app-cache/composer/composer.phar"
9
+ alias composer="npm run exec php composer"
10
10
  alias c="composer"
11
11
  <% if (it.varnishEnabled) { %>
12
12
  alias cvc="npm run exec varnish varnishadm ban req.url '~ /' && echo 'Varnish cache cleared!'"
13
13
  <% } %>
14
- alias mysql="npm run exec mysql 'mysql -umagento -pmagento'"
15
- alias mysqlroot="npm run exec mysql 'mysql -uroot -pscandipwa'"
14
+ alias mariadb="npm run exec mariadb 'mysql -umagento -pmagento'"
15
+ alias mariadbroot="npm run exec mariadb 'mysql -uroot -pscandipwa'"
16
16
 
17
17
  export BASH_SILENCE_DEPRECATION_WARNING=1
@@ -0,0 +1,191 @@
1
+ # MariaDB database server configuration file.
2
+ #
3
+ # You can copy this file to one of:
4
+ # - "/etc/mysql/my.cnf" to set global options,
5
+ # - "~/.my.cnf" to set user-specific options.
6
+ #
7
+ # One can use all long options that the program supports.
8
+ # Run program with --help to get a list of available options and with
9
+ # --print-defaults to see which it would actually understand and use.
10
+ #
11
+ # For explanations see
12
+ # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
13
+
14
+ # This will be passed to all mysql clients
15
+ # It has been reported that passwords should be enclosed with ticks/quotes
16
+ # escpecially if they contain "#" chars...
17
+ # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
18
+ [client]
19
+ port = 3306
20
+ socket = /var/run/mysqld/mysqld.sock
21
+
22
+ # Here is entries for some specific programs
23
+ # The following values assume you have at least 32M ram
24
+
25
+ # This was formally known as [safe_mysqld]. Both versions are currently parsed.
26
+ [mysqld_safe]
27
+ socket = /var/run/mysqld/mysqld.sock
28
+ nice = 0
29
+
30
+ [mysqld]
31
+ #
32
+ # * Basic Settings
33
+ #
34
+ #user = mysql
35
+ pid-file = /var/run/mysqld/mysqld.pid
36
+ socket = /var/run/mysqld/mysqld.sock
37
+ port = 3306
38
+ basedir = /usr
39
+ datadir = /var/lib/mysql
40
+ tmpdir = /tmp
41
+ lc_messages_dir = /usr/share/mysql
42
+ lc_messages = en_US
43
+ skip-external-locking
44
+ #q
45
+ # Instead of skip-networking the default is now to listen only on
46
+ # localhost which is more compatible and is not less secure.
47
+ # bind-address = 0.0.0.0
48
+ #
49
+ # * Fine Tuning
50
+ #
51
+ max_connections = 100
52
+ connect_timeout = 200
53
+ wait_timeout = 28800
54
+ max_allowed_packet = 1GB
55
+ thread_cache_size = 128
56
+ sort_buffer_size = 4M
57
+ bulk_insert_buffer_size = 16M
58
+ tmp_table_size = 32M
59
+ max_heap_table_size = 32M
60
+ #
61
+ # * MyISAM
62
+ #
63
+ # This replaces the startup script and checks MyISAM tables if needed
64
+ # the first time they are touched. On error, make copy and try a repair.
65
+ myisam_recover_options = BACKUP
66
+ key_buffer_size = 128M
67
+ #open-files-limit = 2000
68
+ table_open_cache = 400
69
+ myisam_sort_buffer_size = 512M
70
+ concurrent_insert = 2
71
+ read_buffer_size = 2M
72
+ read_rnd_buffer_size = 1M
73
+ #
74
+ # * Query Cache Configuration
75
+ #
76
+ # Cache only tiny result sets, so we can fit more in the query cache.
77
+ query_cache_limit = 128K
78
+ query_cache_size = 64M
79
+ # for more write intensive setups, set to DEMAND or OFF
80
+ #query_cache_type = DEMAND
81
+ #
82
+ # * Logging and Replication
83
+ #
84
+ # Both location gets rotated by the cronjob.
85
+ # Be aware that this log type is a performance killer.
86
+ # As of 5.1 you can enable the log at runtime!
87
+ #general_log_file = /var/log/mysql/mysql.log
88
+ #general_log = 1
89
+ #
90
+ # Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
91
+ #
92
+ # we do want to know about network errors and such
93
+ #log_warnings = 2
94
+ #
95
+ # Enable the slow query log to see queries with especially long duration
96
+ #slow_query_log[={0|1}]
97
+ slow_query_log_file = /var/log/mysql/mariadb-slow.log
98
+ long_query_time = 10
99
+ #log_slow_rate_limit = 1000
100
+ #log_slow_verbosity = query_plan
101
+
102
+ #log-queries-not-using-indexes
103
+ #log_slow_admin_statements
104
+ #
105
+ # The following can be used as easy to replay backup logs or for replication.
106
+ # note: if you are setting up a replication slave, see README.Debian about
107
+ # other settings you may need to change.
108
+ #server-id = 1
109
+ #report_host = master1
110
+ #auto_increment_increment = 2
111
+ #auto_increment_offset = 1
112
+ #log_bin = /var/log/mysql/mariadb-bin
113
+ #log_bin_index = /var/log/mysql/mariadb-bin.index
114
+ # not fab for performance, but safer
115
+ #sync_binlog = 1
116
+ expire_logs_days = 10
117
+ max_binlog_size = 100M
118
+ # slaves
119
+ #relay_log = /var/log/mysql/relay-bin
120
+ #relay_log_index = /var/log/mysql/relay-bin.index
121
+ #relay_log_info_file = /var/log/mysql/relay-bin.info
122
+ #log_slave_updates
123
+ #read_only
124
+ #
125
+ # If applications support it, this stricter sql_mode prevents some
126
+ # mistakes like inserting invalid dates etc.
127
+ #sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
128
+ #
129
+ # * InnoDB
130
+ #
131
+ # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
132
+ # Read the manual for more InnoDB related options. There are many!
133
+ default_storage_engine = InnoDB
134
+ innodb_buffer_pool_size = 256M
135
+ innodb_log_buffer_size = 8M
136
+ innodb_file_per_table = 1
137
+ innodb_open_files = 400
138
+ innodb_io_capacity = 400
139
+ innodb_flush_method = O_DIRECT
140
+ #
141
+ # * Security Features
142
+ #
143
+ # Read the manual, too, if you want chroot!
144
+ # chroot = /var/lib/mysql/
145
+ #
146
+ # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
147
+ #
148
+ # ssl-ca=/etc/mysql/cacert.pem
149
+ # ssl-cert=/etc/mysql/server-cert.pem
150
+ # ssl-key=/etc/mysql/server-key.pem
151
+
152
+ #
153
+ # * Galera-related settings
154
+ #
155
+ [galera]
156
+ # Mandatory settings
157
+ #wsrep_on=ON
158
+ #wsrep_provider=
159
+ #wsrep_cluster_address=
160
+ #binlog_format=row
161
+ #default_storage_engine=InnoDB
162
+ #innodb_autoinc_lock_mode=2
163
+ #
164
+ # Allow server to accept connections on all interfaces.
165
+ #
166
+ #bind-address=0.0.0.0
167
+ #
168
+ # Optional setting
169
+ #wsrep_slave_threads=1
170
+ #innodb_flush_log_at_trx_commit=0
171
+
172
+ [mysqldump]
173
+ quick
174
+ quote-names
175
+ max_allowed_packet = 16M
176
+
177
+ [mysql]
178
+ #no-auto-rehash # faster start of mysql but no tab completion
179
+
180
+ [isamchk]
181
+ key_buffer = 16M
182
+
183
+ #
184
+ # * IMPORTANT: Additional settings that can override those from this file!
185
+ # The files must end with '.cnf', otherwise they'll be ignored.
186
+ #
187
+ [mariadb]
188
+ skip-host-cache
189
+ skip-name-resolve
190
+
191
+ !includedir /etc/mysql/conf.d/
@@ -1,5 +1,5 @@
1
1
  [global]
2
-
2
+ daemonize = no
3
3
  log_level = debug
4
4
 
5
5
  [www]
@@ -12,10 +12,10 @@ catch_workers_output = yes
12
12
 
13
13
  pm = ondemand
14
14
  pm.max_children = 32
15
- pm.start_servers = 15
15
+ pm.start_servers = 3
16
16
  pm.max_requests = 5000
17
17
  pm.process_idle_timeout = 10s
18
18
  pm.status_path = /fpmstatus
19
- listen = 127.0.0.1:<%= it.ports.fpm %>
19
+ listen = <%~ it.port %>
20
20
 
21
21
  env[PATH] = $PATH
@@ -1999,28 +1999,34 @@ opcache.save_comments=1
1999
1999
 
2000
2000
  [xdebug]
2001
2001
  <% if (it.debug) { %>
2002
+ error_reporting=E_ALL
2003
+
2004
+ xdebug.idekey=PHPSTORM
2002
2005
 
2003
2006
  <% if (it.isXDebug2) { %>
2004
2007
  xdebug.remote_autostart=1
2005
2008
  xdebug.remote_enable=1
2006
- xdebug.remote_host=127.0.0.1
2007
- xdebug.remote_port=9111
2008
2009
 
2009
- xdebug.idekey=PHPSTORM
2010
+ xdebug.remote_host=<%~ it.hostMachine %>
2011
+
2012
+ xdebug.remote_port=9003
2013
+
2014
+ xdebug.remote_log=<%~ it.mageRoot %>/var/log/xdebug.log
2010
2015
 
2011
2016
  <% } else { %>
2012
2017
 
2013
2018
  xdebug.mode=debug
2014
- xdebug.client_host=localhost
2019
+ xdebug.client_host=<%~ it.hostMachine %>
2020
+
2015
2021
  xdebug.client_port=9003
2016
- xdebug.log=<%~ it.mageRoot %>/var/log/xdebug.log
2017
2022
 
2018
2023
  ; THIS THING WILL BREAK PHP
2019
2024
  ; xdebug.start_with_request=yes
2020
2025
 
2021
2026
  xdebug.discover_client_host=false
2022
2027
  xdebug.start_upon_error=yes
2023
- xdebug.idekey=PHPSTORM
2028
+
2029
+ xdebug.log=<%~ it.mageRoot %>/var/log/xdebug.log
2024
2030
 
2025
2031
  <% } %>
2026
2032