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